From 5ae1a533c727d9e9ec344c83a96d06835d941004 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Thu, 11 Dec 2014 15:00:57 +0100 Subject: [PATCH] ARM: can build with llvm, switch to EABI . bitcode fixes . switch to compiler-rt instead of netbsd libc functions or libgcc for support functions for both x86 and arm . minor build fixes . allow build with llvm without crossbuilding llvm itself . can now build minix/arm using llvm and eabi - without C++ support for now (hence crossbuilding llvm itself is turned off for minix/arm) Change-Id: If5c44ef766f5b4fc4394d4586ecc289927a0d6eb --- common/lib/libc/Makefile.inc | 2 +- common/lib/libc/arch/arm/gen/divide.S | 381 ------------------ common/lib/libc/arch/arm/gen/divsi3.S | 79 ---- common/lib/libc/arch/arm/gen/modsi3.S | 38 -- common/lib/libc/arch/arm/gen/udivsi3.S | 74 ---- common/lib/libc/arch/arm/gen/umodsi3.S | 37 -- common/lib/libc/arch/arm/string/memset.S | 21 +- distrib/sets/lists/minix/md.evbarm | 12 +- distrib/sets/lists/minix/mi | 88 ++-- external/bsd/Makefile | 2 + .../llvm/dist/clang/lib/Driver/ToolChain.cpp | 6 + external/bsd/nvi/dist/common/put.c | 2 +- external/bsd/nvi/usr.bin/nvi/Makefile | 5 + lib/Makefile | 2 + lib/libc/Makefile | 9 +- lib/libc/arch/arm/Makefile.inc | 6 +- lib/libc/arch/arm/gen/Makefile.inc | 6 +- lib/libc/compiler_rt/Makefile.inc | 244 +++++++---- lib/libc/dlfcn/dlfcn_elf.c | 2 + lib/libcurses/Makefile | 5 + lib/libm/Makefile | 5 +- lib/librmt/Makefile | 7 + lib/librmt/rmtlib.c | 2 +- lib/libutil/sockaddr_snprintf.c | 2 +- minix/drivers/sensors/bmp085/Makefile | 2 + minix/kernel/Makefile | 5 + minix/kernel/arch/earm/Makefile.inc | 31 +- minix/kernel/arch/earm/phys_memset.S | 148 ++++--- minix/lib/libminc/Makefile | 16 +- minix/lib/libminc/arch/earm/Makefile.libc.inc | 21 +- minix/servers/is/dmp_pm.c | 3 +- minix/servers/is/dmp_rs.c | 5 +- releasetools/arm_sdimage.sh | 2 + share/mk/bsd.own.mk | 2 +- .../bsd/compiler_rt/dist/lib/int_lib.h | 18 + .../bsd/compiler_rt/dist/lib/modsi3.c | 4 + sys/lib/libunwind/Makefile.inc | 4 + usr.bin/tic/tic.c | 4 + 38 files changed, 459 insertions(+), 843 deletions(-) delete mode 100644 common/lib/libc/arch/arm/gen/divide.S delete mode 100644 common/lib/libc/arch/arm/gen/divsi3.S delete mode 100644 common/lib/libc/arch/arm/gen/modsi3.S delete mode 100644 common/lib/libc/arch/arm/gen/udivsi3.S delete mode 100644 common/lib/libc/arch/arm/gen/umodsi3.S diff --git a/common/lib/libc/Makefile.inc b/common/lib/libc/Makefile.inc index 94ae1819b..d31411d51 100644 --- a/common/lib/libc/Makefile.inc +++ b/common/lib/libc/Makefile.inc @@ -2,7 +2,7 @@ COMMON_DIR:=${.PARSEDIR} .if defined(__MINIX) -COMMON_CODEDIRS=atomic gen inet md net quad stdlib string +COMMON_CODEDIRS=atomic gen inet md net stdlib string .else COMMON_CODEDIRS=atomic gen gmon inet md net quad stdlib string sys .endif diff --git a/common/lib/libc/arch/arm/gen/divide.S b/common/lib/libc/arch/arm/gen/divide.S deleted file mode 100644 index c5b7a8a68..000000000 --- a/common/lib/libc/arch/arm/gen/divide.S +++ /dev/null @@ -1,381 +0,0 @@ -/* $NetBSD: divide.S,v 1.4 2013/08/19 03:47:06 matt Exp $ */ - -/* - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef __ARM_ARCH_EXT_IDIV__ - -#include - -/* - * stack is aligned as there's a possibility of branching to .L_overflow - * which makes a C call - */ - -_ARM_ENTRY(__udivide) /* r0 = r0 / r1; r1 = r0 % r1 */ - eor r0, r1, r0 - eor r1, r0, r1 - eor r0, r1, r0 - /* r0 = r1 / r0; r1 = r1 % r0 */ - cmp r0, #1 - bcc .L_overflow - beq .L_divide_l0 - mov ip, #0 - movs r1, r1 - bpl .L_divide_l1 - orr ip, ip, #0x20000000 /* ip bit 0x20000000 = -ve r1 */ - movs r1, r1, lsr #1 - orrcs ip, ip, #0x10000000 /* ip bit 0x10000000 = bit 0 of r1 */ - b .L_divide_l1 - -.L_divide_l0: /* r0 == 1 */ - mov r0, r1 - mov r1, #0 - RET -END(__udivide) - -_ARM_ENTRY(__divide) /* r0 = r0 / r1; r1 = r0 % r1 */ - eor r0, r1, r0 - eor r1, r0, r1 - eor r0, r1, r0 - /* r0 = r1 / r0; r1 = r1 % r0 */ - cmp r0, #1 - bcc .L_overflow - beq .L_divide_l0 - ands ip, r0, #0x80000000 - rsbmi r0, r0, #0 - ands r2, r1, #0x80000000 - eor ip, ip, r2 - rsbmi r1, r1, #0 - orr ip, r2, ip, lsr #1 /* ip bit 0x40000000 = -ve division */ - /* ip bit 0x80000000 = -ve remainder */ - -.L_divide_l1: - mov r2, #1 - mov r3, #0 - - /* - * If the highest bit of the dividend is set, we have to be - * careful when shifting the divisor. Test this. - */ - movs r1,r1 - bpl .L_old_code - - /* - * At this point, the highest bit of r1 is known to be set. - * We abuse this below in the tst instructions. - */ - tst r1, r0 /*, lsl #0 */ - bmi .L_divide_b1 - tst r1, r0, lsl #1 - bmi .L_divide_b2 - tst r1, r0, lsl #2 - bmi .L_divide_b3 - tst r1, r0, lsl #3 - bmi .L_divide_b4 - tst r1, r0, lsl #4 - bmi .L_divide_b5 - tst r1, r0, lsl #5 - bmi .L_divide_b6 - tst r1, r0, lsl #6 - bmi .L_divide_b7 - tst r1, r0, lsl #7 - bmi .L_divide_b8 - tst r1, r0, lsl #8 - bmi .L_divide_b9 - tst r1, r0, lsl #9 - bmi .L_divide_b10 - tst r1, r0, lsl #10 - bmi .L_divide_b11 - tst r1, r0, lsl #11 - bmi .L_divide_b12 - tst r1, r0, lsl #12 - bmi .L_divide_b13 - tst r1, r0, lsl #13 - bmi .L_divide_b14 - tst r1, r0, lsl #14 - bmi .L_divide_b15 - tst r1, r0, lsl #15 - bmi .L_divide_b16 - tst r1, r0, lsl #16 - bmi .L_divide_b17 - tst r1, r0, lsl #17 - bmi .L_divide_b18 - tst r1, r0, lsl #18 - bmi .L_divide_b19 - tst r1, r0, lsl #19 - bmi .L_divide_b20 - tst r1, r0, lsl #20 - bmi .L_divide_b21 - tst r1, r0, lsl #21 - bmi .L_divide_b22 - tst r1, r0, lsl #22 - bmi .L_divide_b23 - tst r1, r0, lsl #23 - bmi .L_divide_b24 - tst r1, r0, lsl #24 - bmi .L_divide_b25 - tst r1, r0, lsl #25 - bmi .L_divide_b26 - tst r1, r0, lsl #26 - bmi .L_divide_b27 - tst r1, r0, lsl #27 - bmi .L_divide_b28 - tst r1, r0, lsl #28 - bmi .L_divide_b29 - tst r1, r0, lsl #29 - bmi .L_divide_b30 - tst r1, r0, lsl #30 - bmi .L_divide_b31 -/* - * instead of: - * tst r1, r0, lsl #31 - * bmi .L_divide_b32 - */ - b .L_divide_b32 - -.L_old_code: - cmp r1, r0 - bcc .L_divide_b0 - cmp r1, r0, lsl #1 - bcc .L_divide_b1 - cmp r1, r0, lsl #2 - bcc .L_divide_b2 - cmp r1, r0, lsl #3 - bcc .L_divide_b3 - cmp r1, r0, lsl #4 - bcc .L_divide_b4 - cmp r1, r0, lsl #5 - bcc .L_divide_b5 - cmp r1, r0, lsl #6 - bcc .L_divide_b6 - cmp r1, r0, lsl #7 - bcc .L_divide_b7 - cmp r1, r0, lsl #8 - bcc .L_divide_b8 - cmp r1, r0, lsl #9 - bcc .L_divide_b9 - cmp r1, r0, lsl #10 - bcc .L_divide_b10 - cmp r1, r0, lsl #11 - bcc .L_divide_b11 - cmp r1, r0, lsl #12 - bcc .L_divide_b12 - cmp r1, r0, lsl #13 - bcc .L_divide_b13 - cmp r1, r0, lsl #14 - bcc .L_divide_b14 - cmp r1, r0, lsl #15 - bcc .L_divide_b15 - cmp r1, r0, lsl #16 - bcc .L_divide_b16 - cmp r1, r0, lsl #17 - bcc .L_divide_b17 - cmp r1, r0, lsl #18 - bcc .L_divide_b18 - cmp r1, r0, lsl #19 - bcc .L_divide_b19 - cmp r1, r0, lsl #20 - bcc .L_divide_b20 - cmp r1, r0, lsl #21 - bcc .L_divide_b21 - cmp r1, r0, lsl #22 - bcc .L_divide_b22 - cmp r1, r0, lsl #23 - bcc .L_divide_b23 - cmp r1, r0, lsl #24 - bcc .L_divide_b24 - cmp r1, r0, lsl #25 - bcc .L_divide_b25 - cmp r1, r0, lsl #26 - bcc .L_divide_b26 - cmp r1, r0, lsl #27 - bcc .L_divide_b27 - cmp r1, r0, lsl #28 - bcc .L_divide_b28 - cmp r1, r0, lsl #29 - bcc .L_divide_b29 - cmp r1, r0, lsl #30 - bcc .L_divide_b30 -.L_divide_b32: - cmp r1, r0, lsl #31 - subhs r1, r1,r0, lsl #31 - addhs r3, r3,r2, lsl #31 -.L_divide_b31: - cmp r1, r0, lsl #30 - subhs r1, r1,r0, lsl #30 - addhs r3, r3,r2, lsl #30 -.L_divide_b30: - cmp r1, r0, lsl #29 - subhs r1, r1,r0, lsl #29 - addhs r3, r3,r2, lsl #29 -.L_divide_b29: - cmp r1, r0, lsl #28 - subhs r1, r1,r0, lsl #28 - addhs r3, r3,r2, lsl #28 -.L_divide_b28: - cmp r1, r0, lsl #27 - subhs r1, r1,r0, lsl #27 - addhs r3, r3,r2, lsl #27 -.L_divide_b27: - cmp r1, r0, lsl #26 - subhs r1, r1,r0, lsl #26 - addhs r3, r3,r2, lsl #26 -.L_divide_b26: - cmp r1, r0, lsl #25 - subhs r1, r1,r0, lsl #25 - addhs r3, r3,r2, lsl #25 -.L_divide_b25: - cmp r1, r0, lsl #24 - subhs r1, r1,r0, lsl #24 - addhs r3, r3,r2, lsl #24 -.L_divide_b24: - cmp r1, r0, lsl #23 - subhs r1, r1,r0, lsl #23 - addhs r3, r3,r2, lsl #23 -.L_divide_b23: - cmp r1, r0, lsl #22 - subhs r1, r1,r0, lsl #22 - addhs r3, r3,r2, lsl #22 -.L_divide_b22: - cmp r1, r0, lsl #21 - subhs r1, r1,r0, lsl #21 - addhs r3, r3,r2, lsl #21 -.L_divide_b21: - cmp r1, r0, lsl #20 - subhs r1, r1,r0, lsl #20 - addhs r3, r3,r2, lsl #20 -.L_divide_b20: - cmp r1, r0, lsl #19 - subhs r1, r1,r0, lsl #19 - addhs r3, r3,r2, lsl #19 -.L_divide_b19: - cmp r1, r0, lsl #18 - subhs r1, r1,r0, lsl #18 - addhs r3, r3,r2, lsl #18 -.L_divide_b18: - cmp r1, r0, lsl #17 - subhs r1, r1,r0, lsl #17 - addhs r3, r3,r2, lsl #17 -.L_divide_b17: - cmp r1, r0, lsl #16 - subhs r1, r1,r0, lsl #16 - addhs r3, r3,r2, lsl #16 -.L_divide_b16: - cmp r1, r0, lsl #15 - subhs r1, r1,r0, lsl #15 - addhs r3, r3,r2, lsl #15 -.L_divide_b15: - cmp r1, r0, lsl #14 - subhs r1, r1,r0, lsl #14 - addhs r3, r3,r2, lsl #14 -.L_divide_b14: - cmp r1, r0, lsl #13 - subhs r1, r1,r0, lsl #13 - addhs r3, r3,r2, lsl #13 -.L_divide_b13: - cmp r1, r0, lsl #12 - subhs r1, r1,r0, lsl #12 - addhs r3, r3,r2, lsl #12 -.L_divide_b12: - cmp r1, r0, lsl #11 - subhs r1, r1,r0, lsl #11 - addhs r3, r3,r2, lsl #11 -.L_divide_b11: - cmp r1, r0, lsl #10 - subhs r1, r1,r0, lsl #10 - addhs r3, r3,r2, lsl #10 -.L_divide_b10: - cmp r1, r0, lsl #9 - subhs r1, r1,r0, lsl #9 - addhs r3, r3,r2, lsl #9 -.L_divide_b9: - cmp r1, r0, lsl #8 - subhs r1, r1,r0, lsl #8 - addhs r3, r3,r2, lsl #8 -.L_divide_b8: - cmp r1, r0, lsl #7 - subhs r1, r1,r0, lsl #7 - addhs r3, r3,r2, lsl #7 -.L_divide_b7: - cmp r1, r0, lsl #6 - subhs r1, r1,r0, lsl #6 - addhs r3, r3,r2, lsl #6 -.L_divide_b6: - cmp r1, r0, lsl #5 - subhs r1, r1,r0, lsl #5 - addhs r3, r3,r2, lsl #5 -.L_divide_b5: - cmp r1, r0, lsl #4 - subhs r1, r1,r0, lsl #4 - addhs r3, r3,r2, lsl #4 -.L_divide_b4: - cmp r1, r0, lsl #3 - subhs r1, r1,r0, lsl #3 - addhs r3, r3,r2, lsl #3 -.L_divide_b3: - cmp r1, r0, lsl #2 - subhs r1, r1,r0, lsl #2 - addhs r3, r3,r2, lsl #2 -.L_divide_b2: - cmp r1, r0, lsl #1 - subhs r1, r1,r0, lsl #1 - addhs r3, r3,r2, lsl #1 -.L_divide_b1: - cmp r1, r0 - subhs r1, r1, r0 - addhs r3, r3, r2 -.L_divide_b0: - - tst ip, #0x20000000 - bne .L_udivide_l1 - mov r0, r3 - cmp ip, #0 - rsbmi r1, r1, #0 - movs ip, ip, lsl #1 - bicmi r0, r0, #0x80000000 /* Fix incase we divided 0x80000000 */ - rsbmi r0, r0, #0 - RET - -.L_udivide_l1: - tst ip, #0x10000000 - mov r1, r1, lsl #1 - orrne r1, r1, #1 - mov r3, r3, lsl #1 - cmp r1, r0 - subhs r1, r1, r0 - addhs r3, r3, r2 - mov r0, r3 - RET - -.L_overflow: -#if !defined(_KERNEL) && !defined(_STANDALONE) -#ifdef __ARM_EABI__ - mov r0, r1 /* return quotient */ - b PLT_SYM(__aeabi_idiv0) -#else - mov r0, #8 /* SIGFPE */ - bl PLT_SYM(_C_LABEL(raise)) /* raise it */ - mov r0, #0 - RET -#endif -#else - /* XXX should cause a fatal error */ - mvn r0, #0 - RET -#endif - -END(__divide) - -#endif /* __ARM_ARCH_EXT_IDIV__ */ diff --git a/common/lib/libc/arch/arm/gen/divsi3.S b/common/lib/libc/arch/arm/gen/divsi3.S deleted file mode 100644 index f9320ebc6..000000000 --- a/common/lib/libc/arch/arm/gen/divsi3.S +++ /dev/null @@ -1,79 +0,0 @@ -/* $NetBSD: divsi3.S,v 1.13 2013/09/12 15:36:14 joerg Exp $ */ - -/* - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(__thumb__) && !defined(_ARM_ARCH_T2) -ARM_ENTRY(__divsi3) -#else -ENTRY(__divsi3) -#endif -#if defined(__ARM_ARCH_EXT_IDIV__) -# if defined(__ARM_EABI__) - mov r3, r0 @ save for mls -# endif - sdiv r0, r0, r1 -# if defined(__ARM_EABI__) - mls r1, r0, r1, r3 @ return modulus in r1 -# endif - RET -#elif defined(__ARM_EABI__) && defined(_LIBC) - cmp r1, #0 @ dividing by 0? - beq .Ldiv0 @ call __aeabi_idiv0 - ldr r2, .Lhwdiv_present -#ifdef __PIC__ - add r2, r2, pc @ pc = &.LPIC0 -# endif - ldr r2, [r2] -.LPIC0: cmp r2, #0 - beq __divide - mov r3, r0 -# if defined(__ARM_ARCH_EXT_IDIV__) - sdiv r0, r0, r1 - mls r1, r0, r1, r3 @ return modulus in r1 -# elif defined(__thumb__) && defined(_ARM_ARCH_T2) - .inst.w 0xfb90f0f1 - .inst.w 0xfb003111 -# else - .inst 0xe710f110 - .inst 0xe0613190 -# endif - RET - - .align 0 -.Lhwdiv_present: - .word REL_SYM(_libc_arm_hwdiv_present, .LPIC0) - - .align 0 -.Ldiv0: push {r0, lr} /* save r0 */ - cmp r0, #0 - mvnge r0, #0x80000000 /* INT_MAX = 0x7fffffff */ - movlt r0, #0x80000000 /* INT_MIN = 0x80000000 */ - bl _C_LABEL(__aeabi_idiv0) - pop {r1, pc} /* restore r0 as r1 */ -#else /* !__ARM_EABI__ */ - b __divide -#endif -END(__divsi3) - -#if defined(__ARM_EABI__) -STRONG_ALIAS(__aeabi_idivmod, __divsi3) -STRONG_ALIAS(__aeabi_idiv, __divsi3) -#if defined(PIC_SYMVER) - .symver __aeabi_idiv,__aeabi_idiv@@GCC_3.5 - .symver __aeabi_idivmod,__aeabi_idivmod@@GCC_3.5 -#endif -#endif diff --git a/common/lib/libc/arch/arm/gen/modsi3.S b/common/lib/libc/arch/arm/gen/modsi3.S deleted file mode 100644 index 5d8c6102a..000000000 --- a/common/lib/libc/arch/arm/gen/modsi3.S +++ /dev/null @@ -1,38 +0,0 @@ -/* $NetBSD: modsi3.S,v 1.4 2013/08/15 21:40:11 matt Exp $ */ - -/* - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#ifndef __ARM_EABI__ -/* - * stack is aligned as there's a possibility of branching to .L_overflow - * which makes a C call - */ - -ENTRY(__modsi3) -#ifdef __ARM_ARCH_EXT_IDIV__ - sdiv r3, r0, r1 - mls r0, r3, r1, r0 -#else - str lr, [sp, #-8]! /* push lr */ - bl PIC_SYM(__divsi3, PLT) - mov r0, r1 - ldr lr, [sp], #8 /* pop lr */ -#endif - RET -END(__modsi3) - -#endif diff --git a/common/lib/libc/arch/arm/gen/udivsi3.S b/common/lib/libc/arch/arm/gen/udivsi3.S deleted file mode 100644 index 5e6a77a2f..000000000 --- a/common/lib/libc/arch/arm/gen/udivsi3.S +++ /dev/null @@ -1,74 +0,0 @@ -/* $NetBSD: udivsi3.S,v 1.9 2013/09/12 15:36:14 joerg Exp $ */ - -/* - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(__ARM_EABI__) && defined(__thumb__) && !defined(_ARM_ARCH_T2) -ARM_ENTRY(__udivsi3) -#else -ENTRY(__udivsi3) -#endif -#if defined(__ARM_ARCH_EXT_IDIV__) -# if defined(__ARM_EABI__) - mov r3, r0 @ save for mls -# endif - udiv r0, r0, r1 -# if defined(__ARM_EABI__) - mls r1, r0, r1, r3 @ return modulus in r1 -# endif - RET -#elif defined(__ARM_EABI__) && defined(_LIBC) - cmp r1, #0 - beq .Ldiv0 - ldr r2, .Lhwdiv_present -#ifdef __PIC__ - add r2, r2, pc /* pc = &.LPIC0 */ -# endif - ldr r2, [r2] -.LPIC0: cmp r2, #0 - beq __udivide - mov r3, r0 -# if defined(__ARM_ARCH_EXT_IDIV__) - udiv r0, r0, r1 - mls r1, r0, r1, r3 /* return modulus in r1 */ -# elif defined(__thumb__) && defined(_ARM_ARCH_T2) - .inst.w 0xfbb0f0f1 - .inst.w 0xfb003111 -# else - .inst 0xe730f110 - .inst 0xe0613190 -# endif - RET - - .align 0 -.Lhwdiv_present: - .word REL_SYM(_libc_arm_hwdiv_present, .LPIC0) - - /* Handle divide by zero */ - .align 0 -.Ldiv0: push {r0, lr} /* save r0 */ - mvns r0, #0 /* thumb2 */ - bl _C_LABEL(__aeabi_idiv0) - pop {r1, pc} /* restore r0 as r1 */ -#else - b __udivide -#endif -END(__udivsi3) - -#ifdef __ARM_EABI__ -STRONG_ALIAS(__aeabi_uidivmod, __udivsi3) -STRONG_ALIAS(__aeabi_uidiv, __udivsi3) -#endif diff --git a/common/lib/libc/arch/arm/gen/umodsi3.S b/common/lib/libc/arch/arm/gen/umodsi3.S deleted file mode 100644 index 35f5da246..000000000 --- a/common/lib/libc/arch/arm/gen/umodsi3.S +++ /dev/null @@ -1,37 +0,0 @@ -/* $NetBSD: umodsi3.S,v 1.4 2013/08/15 21:40:11 matt Exp $ */ - -/* - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#ifndef __ARM_EABI__ -/* - * stack is aligned as there's a possibility of branching to .L_overflow - * which makes a C call - */ - -ENTRY(__umodsi3) -#ifdef __ARM_ARCH_EXT_IDIV__ - udiv r3, r0, r1 - mls r0, r3, r1, r0 -#else - str lr, [sp, #-8]! /* push lr */ - bl PIC_SYM(__udivsi3, PLT) - mov r0, r1 - ldr lr, [sp], #8 /* pop lr */ -#endif - RET -END(__umodsi3) -#endif diff --git a/common/lib/libc/arch/arm/string/memset.S b/common/lib/libc/arch/arm/string/memset.S index 500ddfef4..5b1281bb7 100644 --- a/common/lib/libc/arch/arm/string/memset.S +++ b/common/lib/libc/arch/arm/string/memset.S @@ -1,4 +1,4 @@ -/* $NetBSD: memset.S,v 1.6 2013/11/30 21:09:11 joerg Exp $ */ +/* $NetBSD: memset.S,v 1.7 2013/12/02 21:21:33 joerg Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -68,8 +68,23 @@ #include -#if defined(__ARM_EABI__) && !defined(BZER0) -STRONG_ALIAS(__aeabi_memset, memset) +#if defined(__ARM_EABI__) && !defined(_BZERO) +ENTRY(__aeabi_memset) + mov r3, r1 + mov r1, r2 + mov r2, r3 + b memset +END(__aeabi_memset) +STRONG_ALIAS(__aeabi_memset4, __aeabi_memset) +STRONG_ALIAS(__aeabi_memset8, __aeabi_memset) + +ENTRY(__aeabi_memclr) + mov r2, r1 + mov r1, #0 + b memset +END(__aeabi_memclr) +STRONG_ALIAS(__aeabi_memclr4, __aeabi_memclr) +STRONG_ALIAS(__aeabi_memclr8, __aeabi_memclr) #endif /* diff --git a/distrib/sets/lists/minix/md.evbarm b/distrib/sets/lists/minix/md.evbarm index b99548b03..78c2704c3 100644 --- a/distrib/sets/lists/minix/md.evbarm +++ b/distrib/sets/lists/minix/md.evbarm @@ -95,12 +95,12 @@ ./usr/include/i386 minix-sys ./usr/lib/libclkconf.a minix-sys ./usr/lib/libclkconf_pic.a minix-sys -./usr/lib/libc_vfp.a minix-sys -./usr/lib/libc_vfp_pic.a minix-sys -./usr/lib/libc_vfp.so.0.0 minix-sys -./usr/lib/libc_vfp.so.0 minix-sys -./usr/lib/libc_vfp.so minix-sys -./usr/lib/libgcc_eh.a minix-sys +./usr/lib/libc_vfp.a minix-sys obsolete +./usr/lib/libc_vfp_pic.a minix-sys obsolete +./usr/lib/libc_vfp.so.0.0 minix-sys obsolete +./usr/lib/libc_vfp.so.0 minix-sys obsolete +./usr/lib/libc_vfp.so minix-sys obsolete +./usr/lib/libgcc_eh.a minix-sys gcccmds ./usr/lib/libgpio.a minix-sys ./usr/lib/libgpio_pic.a minix-sys ./usr/lib/libi2cdriver.a minix-sys diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index bf2d36920..320c424f5 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -283,12 +283,12 @@ ./usr/bin/bzip2 minix-sys ./usr/bin/bzip2recover minix-sys ./usr/bin/c++ minix-sys gcccmds -./usr/bin/c++ minix-sys llvm +./usr/bin/c++ minix-sys llvm,llvmcmds ./usr/bin/cal minix-sys ./usr/bin/calendar minix-sys ./usr/bin/cawf minix-sys ./usr/bin/cc minix-sys gcccmds -./usr/bin/cc minix-sys llvm +./usr/bin/cc minix-sys llvm,llvmcmds ./usr/bin/cc1 minix-sys gcccmds ./usr/bin/cc1obj minix-sys gcccmds ./usr/bin/cc1plus minix-sys gcccmds @@ -301,10 +301,10 @@ ./usr/bin/chsh minix-sys ./usr/bin/ci minix-sys ./usr/bin/cksum minix-sys -./usr/bin/clang++ minix-sys llvm -./usr/bin/clang minix-sys llvm -./usr/bin/clang-cpp minix-sys llvm -./usr/bin/clang-tblgen minix-sys llvm +./usr/bin/clang++ minix-sys llvm,llvmcmds +./usr/bin/clang minix-sys llvm,llvmcmds +./usr/bin/clang-cpp minix-sys llvm,llvmcmds +./usr/bin/clang-tblgen minix-sys llvm,llvmcmds ./usr/bin/cleantmp minix-sys ./usr/bin/clear minix-sys ./usr/bin/cmp minix-sys @@ -317,7 +317,7 @@ ./usr/bin/compress minix-sys ./usr/bin/cpio minix-sys ./usr/bin/cpp minix-sys gcccmds -./usr/bin/cpp minix-sys llvm +./usr/bin/cpp minix-sys llvm,llvmcmds ./usr/bin/cprofalyze minix-sys obsolete ./usr/bin/crc minix-sys ./usr/bin/cron minix-sys @@ -412,7 +412,7 @@ ./usr/bin/lessecho minix-sys ./usr/bin/lesskey minix-sys ./usr/bin/lex minix-sys -./usr/bin/llvm-tblgen minix-sys llvm +./usr/bin/llvm-tblgen minix-sys llvm,llvmcmds ./usr/bin/loadfont minix-sys ./usr/bin/loadramdisk minix-sys ./usr/bin/lock minix-sys @@ -796,36 +796,36 @@ ./usr/include/cdbr.h minix-sys ./usr/include/cdbw.h minix-sys ./usr/include/clang-3.4 minix-sys -./usr/include/clang-3.4/ammintrin.h minix-sys llvm -./usr/include/clang-3.4/avx2intrin.h minix-sys llvm -./usr/include/clang-3.4/avxintrin.h minix-sys llvm -./usr/include/clang-3.4/bmi2intrin.h minix-sys llvm -./usr/include/clang-3.4/bmiintrin.h minix-sys llvm -./usr/include/clang-3.4/emmintrin.h minix-sys llvm -./usr/include/clang-3.4/f16cintrin.h minix-sys llvm -./usr/include/clang-3.4/fma4intrin.h minix-sys llvm -./usr/include/clang-3.4/fmaintrin.h minix-sys llvm -./usr/include/clang-3.4/immintrin.h minix-sys llvm -./usr/include/clang-3.4/lzcntintrin.h minix-sys llvm -./usr/include/clang-3.4/mm3dnow.h minix-sys llvm -./usr/include/clang-3.4/mmintrin.h minix-sys llvm -./usr/include/clang-3.4/mm_malloc.h minix-sys llvm -./usr/include/clang-3.4/nmmintrin.h minix-sys llvm -./usr/include/clang-3.4/pmmintrin.h minix-sys llvm -./usr/include/clang-3.4/popcntintrin.h minix-sys llvm -./usr/include/clang-3.4/prfchwintrin.h minix-sys llvm -./usr/include/clang-3.4/rdseedintrin.h minix-sys llvm -./usr/include/clang-3.4/rtmintrin.h minix-sys llvm -./usr/include/clang-3.4/shaintrin.h minix-sys llvm -./usr/include/clang-3.4/smmintrin.h minix-sys llvm -./usr/include/clang-3.4/tbmintrin.h minix-sys llvm -./usr/include/clang-3.4/tmmintrin.h minix-sys llvm -./usr/include/clang-3.4/__wmmintrin_aes.h minix-sys llvm -./usr/include/clang-3.4/wmmintrin.h minix-sys llvm -./usr/include/clang-3.4/__wmmintrin_pclmul.h minix-sys llvm -./usr/include/clang-3.4/x86intrin.h minix-sys llvm -./usr/include/clang-3.4/xmmintrin.h minix-sys llvm -./usr/include/clang-3.4/xopintrin.h minix-sys llvm +./usr/include/clang-3.4/ammintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/avx2intrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/avxintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/bmi2intrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/bmiintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/emmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/f16cintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/fma4intrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/fmaintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/immintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/lzcntintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/mm3dnow.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/mmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/mm_malloc.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/nmmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/pmmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/popcntintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/prfchwintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/rdseedintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/rtmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/shaintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/smmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/tbmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/tmmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/__wmmintrin_aes.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/wmmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/__wmmintrin_pclmul.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/x86intrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/xmmintrin.h minix-sys llvm,llvmcmds +./usr/include/clang-3.4/xopintrin.h minix-sys llvm,llvmcmds ./usr/include/compat minix-sys ./usr/include/compat/machine minix-sys ./usr/include/complex.h minix-sys @@ -1895,7 +1895,7 @@ ./usr/include/ulimit.h minix-sys ./usr/include/unctrl.h minix-sys ./usr/include/unistd.h minix-sys -./usr/include/unwind.h minix-sys llvm +./usr/include/unwind.h minix-sys llvm,llvmcmds ./usr/include/util.h minix-sys ./usr/include/utime.h minix-sys ./usr/include/utmp.h minix-sys @@ -1945,7 +1945,7 @@ ./usr/lib/bc/libc.a minix-sys bitcode ./usr/lib/bc/libc++.a minix-sys bitcode ./usr/lib/bc/libchardriver.a minix-sys bitcode -./usr/lib/bc/libcompat_minix.a minix-sys bitcode obsolete +./usr/lib/bc/libcompat_minix.a minix-sys bitcode,obsolete ./usr/lib/bc/libcrypt.a minix-sys bitcode ./usr/lib/bc/libcurses.a minix-sys bitcode ./usr/lib/bc/libddekit.a minix-sys bitcode @@ -1953,6 +1953,10 @@ ./usr/lib/bc/libddekit_usb_server.a minix-sys bitcode ./usr/lib/bc/libdevman.a minix-sys bitcode ./usr/lib/bc/libedit.a minix-sys bitcode +./usr/lib/bc/libevent.a minix-sys bitcode +./usr/lib/bc/libexpat.a minix-sys bitcode +./usr/lib/bc/libfsdriver.a minix-sys bitcode +./usr/lib/bc/libpci.a minix-sys bitcode ./usr/lib/bc/libelf.a minix-sys bitcode ./usr/lib/bc/libexec.a minix-sys bitcode ./usr/lib/bc/libexecinfo.a minix-sys bitcode @@ -1973,7 +1977,7 @@ ./usr/lib/bc/libmenu.a minix-sys bitcode ./usr/lib/bc/libminc.a minix-sys bitcode ./usr/lib/bc/libminixfs.a minix-sys bitcode -./usr/lib/bc/libminlib.a minix-sys bitcode obsolete +./usr/lib/bc/libminlib.a minix-sys bitcode,obsolete ./usr/lib/bc/libmthread.a minix-sys bitcode ./usr/lib/bc/libnetdriver.a minix-sys bitcode ./usr/lib/bc/libnetsock.a minix-sys bitcode @@ -5410,7 +5414,7 @@ ./usr/share/doc/usd/03.shell/t3 minix-sys ./usr/share/doc/usd/03.shell/t4 minix-sys ./usr/share/doc/usd/03.shell/t.mac minix-sys -./usr/share/examples minix-sys atf +./usr/share/examples minix-sys ./usr/share/examples/atf minix-sys atf ./usr/share/examples/atf/atf-run.hooks minix-sys atf,!kyua ./usr/share/examples/atf/tests-results.css minix-sys atf,!kyua diff --git a/external/bsd/Makefile b/external/bsd/Makefile index 1b4650723..40200a964 100644 --- a/external/bsd/Makefile +++ b/external/bsd/Makefile @@ -29,7 +29,9 @@ SUBDIR+= openldap SUBDIR+= libc++ .endif .if (${MKLLVM} != "no") +.if (${MKLLVMCMDS} != "no") SUBDIR+= llvm +.endif # (${MKLLVMCMDS} != "no") .endif .if (${MKPCC} != "no") SUBDIR+= pcc diff --git a/external/bsd/llvm/dist/clang/lib/Driver/ToolChain.cpp b/external/bsd/llvm/dist/clang/lib/Driver/ToolChain.cpp index faa06b68e..e054dc5c8 100644 --- a/external/bsd/llvm/dist/clang/lib/Driver/ToolChain.cpp +++ b/external/bsd/llvm/dist/clang/lib/Driver/ToolChain.cpp @@ -280,8 +280,14 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, // Thumb2 is the default for V7 on Darwin. // // FIXME: Thumb should just be another -target-feaure, not in the triple. +#if 1 + // Minix/ARM-specific force to ARMv7 and EABI. + StringRef Suffix = "v7"; + Triple.setEnvironment(llvm::Triple::EABI); +#else StringRef Suffix = getLLVMArchSuffixForARM(getARMTargetCPU(Args, Triple)); +#endif bool ThumbDefault = Suffix.startswith("v6m") || (Suffix.startswith("v7") && getTriple().isOSDarwin()); std::string ArchName = "arm"; diff --git a/external/bsd/nvi/dist/common/put.c b/external/bsd/nvi/dist/common/put.c index 237e08a04..eed65737d 100644 --- a/external/bsd/nvi/dist/common/put.c +++ b/external/bsd/nvi/dist/common/put.c @@ -30,7 +30,7 @@ static const char sccsid[] = "Id: put.c,v 10.18 2001/06/25 15:19:11 skimo Exp ( * put -- * Put text buffer contents into the file. * - * PUBLIC: int put __P((SCR *, CB *, CHAR_T *, MARK *, MARK *, int)); + * PUBLIC: int put __P((SCR *, CB *, ARG_CHAR_T *, MARK *, MARK *, int)); */ int put(SCR *sp, CB *cbp, ARG_CHAR_T *namep, MARK *cp, MARK *rp, int append) diff --git a/external/bsd/nvi/usr.bin/nvi/Makefile b/external/bsd/nvi/usr.bin/nvi/Makefile index 4c902cbf7..65d8603ca 100644 --- a/external/bsd/nvi/usr.bin/nvi/Makefile +++ b/external/bsd/nvi/usr.bin/nvi/Makefile @@ -2,6 +2,11 @@ .include +.if defined(__MINIX) +#/usr/minix/src-clang/external/bsd/nvi/dist/ex/ex.c:533:18: error: comparison of integers of different signs: 'CHAR_T' (aka 'unsigned int') and 'ARG_CHAR_T' (aka 'int') [-Werror,-Wsign-compare] +NOCLANGERROR=yes +.endif + USE_WIDECHAR?=yes CWARNFLAGS.clang+= -Wno-uninitialized -Wno-format-security diff --git a/lib/Makefile b/lib/Makefile index aa3dce34e..936b1404e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -98,9 +98,11 @@ SUBDIR+= \ .if (${MACHINE_CPU} == "arm") LIBC_MACHINE_ARCH?=${MACHINE_ARCH} .if empty(LIBC_MACHINE_ARCH:M*hf*) +.if !defined(__MINIX) SUBDIR+= libc_vfp .endif .endif +.endif .if (${MKRUMP} != "no") SUBDIR+= librumpclient .endif diff --git a/lib/libc/Makefile b/lib/libc/Makefile index 32775fb03..a587a259c 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -68,7 +68,7 @@ SUBDIR+= pkgconfig .include "${.CURDIR}/db/Makefile.inc" .include "${.CURDIR}/citrus/Makefile.inc" .include "${.CURDIR}/compat-43/Makefile.inc" -.if ${HAVE_LIBGCC} == "no" +.if ${HAVE_LIBGCC} == "no" || defined(__MINIX) .include "${.CURDIR}/compiler_rt/Makefile.inc" .endif .include "${.CURDIR}/dlfcn/Makefile.inc" @@ -89,7 +89,7 @@ SUBDIR+= pkgconfig .include "${.CURDIR}/net/Makefile.inc" .include "${.CURDIR}/nameser/Makefile.inc" .include "${.CURDIR}/nls/Makefile.inc" -.if (${MACHINE_ARCH} != "alpha") && (${ARCHSUBDIR} != "sparc64") +.if (${MACHINE_ARCH} != "alpha") && (${ARCHSUBDIR} != "sparc64") && !defined(__MINIX) .include "${.CURDIR}/quad/Makefile.inc" .endif .if (${USE_LIBTRE} == "yes") @@ -116,9 +116,10 @@ SUBDIR+= pkgconfig .include "${.CURDIR}/tls/Makefile.inc" .endif .include "${.CURDIR}/sys/Makefile.inc" -.if ${HAVE_LIBGCC} == "no" +.if ${HAVE_LIBGCC} == "no" && ${MACHINE_ARCH} != "earm" && defined(__MINIX) +# Currently unavailable on minix/arm - BJG .include "${NETBSDSRCDIR}/sys/lib/libunwind/Makefile.inc" -.endif +.endif # ${HAVE_LIBGCC} == "no" && ${MACHINE_ARCH} != "earm" && defined(__MINIX) .include "${.CURDIR}/uuid/Makefile.inc" .if (${MKYP} != "no") .include "${.CURDIR}/yp/Makefile.inc" diff --git a/lib/libc/arch/arm/Makefile.inc b/lib/libc/arch/arm/Makefile.inc index bef93afc4..a9e3fbc7c 100644 --- a/lib/libc/arch/arm/Makefile.inc +++ b/lib/libc/arch/arm/Makefile.inc @@ -13,10 +13,6 @@ AFLAGS+= -marm CPPFLAGS += -I. .if !empty(LIBC_MACHINE_ARCH:Mearm*) -SRCS+= __aeabi_ldivmod.S __aeabi_uldivmod.S -SRCS+= __aeabi_lcmp.c __aeabi_ulcmp.c -SRCS+= fixunsgen_ieee754.c fixunssfsi_ieee754.c -SRCS+= fixunsgen64_ieee754.c fixunsdfsi_ieee754.c SRCS+= arm_initfini.c .endif @@ -26,7 +22,7 @@ CPPFLAGS += -DSOFTFLOAT # for earm, use the 64-bit softfloat .if ${LIBC_MACHINE_ARCH} == "arm" || ${LIBC_MACHINE_ARCH} == "armeb" SOFTFLOAT_BITS=32 -#SRCS+= floatunsidf_ieee754.c floatunsisf_ieee754.c +SRCS+= floatunsidf_ieee754.c floatunsisf_ieee754.c .endif .include diff --git a/lib/libc/arch/arm/gen/Makefile.inc b/lib/libc/arch/arm/gen/Makefile.inc index ea8985c1c..213781172 100644 --- a/lib/libc/arch/arm/gen/Makefile.inc +++ b/lib/libc/arch/arm/gen/Makefile.inc @@ -1,7 +1,7 @@ # $NetBSD: Makefile.inc,v 1.25 2013/08/21 03:09:39 matt Exp $ -SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divide.S divsi3.S \ - fabs.c flt_rounds.c udivsi3.S +SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c \ + fabs.c flt_rounds.c CPUFLAGS.divide.S+= -marm @@ -16,8 +16,6 @@ SRCS+= signbitf_ieee754.c signbitd_ieee754.c .if !empty(LIBC_MACHINE_ARCH:Mearm*) SRCS+= __aeabi_fcmpun.c __aeabi_dcmpun.c SRCS+= __aeabi_idiv0.c __aeabi_ldiv0.c -.else -SRCS+= modsi3.S umodsi3.S .endif SRCS+= nanf.c diff --git a/lib/libc/compiler_rt/Makefile.inc b/lib/libc/compiler_rt/Makefile.inc index b7183e40f..2f19eeb0d 100644 --- a/lib/libc/compiler_rt/Makefile.inc +++ b/lib/libc/compiler_rt/Makefile.inc @@ -10,11 +10,16 @@ COMPILER_RT_CPU_DIR= ${COMPILER_RT_SRCDIR}/lib/${MACHINE_CPU} COMPILER_RT_ARCH_DIR= ${COMPILER_RT_SRCDIR}/lib/${MACHINE_ARCH} .endif +.if defined(__MINIX) +LIBC_MACHINE_CPU?= ${MACHINE_CPU} +.endif # defined(__MINIX) -.if !defined(__MINIX) +.if !empty(LIBC_MACHINE_ARCH:Mearm*) && defined(__MINIX) +# BJG - we skip these for minix/x86 as the .S versions give problems +# for dynamic binaries. .PATH: ${COMPILER_RT_CPU_DIR} .PATH: ${COMPILER_RT_ARCH_DIR} -.endif # !defined(__MINIX) +.endif # .if !empty(LIBC_MACHINE_ARCH:Mearm*) && defined(__MINIX) .PATH: ${COMPILER_RT_SRCDIR}/lib # Complex support needs parts of libm @@ -25,127 +30,190 @@ COMPILER_RT_ARCH_DIR= ${COMPILER_RT_SRCDIR}/lib/${MACHINE_ARCH} # divdc3.c \ # divsc3.c +# Implemented on top of our atomic interface. +#GENERIC_SRCS+= atomic.c + +.if ${HAVE_LIBGCC_EH:Uyes} == "no" GENERIC_SRCS+= \ - absvdi2.c \ - absvsi2.c \ - absvti2.c \ + gcc_personality_v0.c +.endif + +.if 0 +# Conflicts with soft-float +GENERIC_SRCS+= \ + comparedf2.c \ + comparesf2.c \ adddf3.c \ addsf3.c \ - addvdi3.c \ + addtf3.c \ + divdf3.c \ + divsf3.c \ + divtf3.c \ + extendsfdf2.c \ + extendsftf2.c \ + extenddftf2.c \ + fixdfsi.c \ + fixdfti.c \ + fixsfsi.c \ + fixsfti.c \ + floatsidf.c \ + floatsisf.c \ + floatunsidf.c \ + floatunsisf.c \ + muldf3.c \ + mulsf3.c \ + multf3.c \ + subdf3.c \ + subsf3.c \ + subtf3.c \ + truncdfsf2.c \ + trunctfdf2.c \ + trunctfsf2.c +.endif + +GENERIC_SRCS+= \ + absvsi2.c \ + absvti2.c \ addvsi3.c \ addvti3.c \ - ashldi3.c \ ashlti3.c \ - ashrdi3.c \ ashrti3.c \ - atomic.c \ - clzdi2.c \ - clzsi2.c \ clzti2.c \ - cmpdi2.c \ cmpti2.c \ - comparedf2.c \ - comparesf2.c \ - ctzdi2.c \ - ctzsi2.c \ ctzti2.c \ - divdf3.c \ - divdi3.c \ - divmoddi4.c \ - divmodsi4.c \ - divsf3.c \ - divsi3.c \ divti3.c \ - extendsfdf2.c \ - ffsdi2.c \ ffsti2.c \ - fixdfdi.c \ - fixdfsi.c \ - fixdfti.c \ fixsfdi.c \ - fixsfsi.c \ - fixsfti.c \ + fixdfdi.c \ fixunsdfdi.c \ fixunsdfsi.c \ - fixunsdfti.c \ fixunssfdi.c \ fixunssfsi.c \ - fixunssfti.c \ fixunsxfdi.c \ fixunsxfsi.c \ - fixunsxfti.c \ fixxfdi.c \ - fixxfti.c \ floatdidf.c \ floatdisf.c \ floatdixf.c \ - floatsidf.c \ - floatsisf.c \ - floattidf.c \ - floattisf.c \ - floattixf.c \ floatundidf.c \ floatundisf.c \ floatundixf.c \ - floatunsidf.c \ - floatunsisf.c \ - floatuntidf.c \ - floatuntisf.c \ - floatuntixf.c \ - gcc_personality_v0.c \ int_util.c \ - lshrdi3.c \ lshrti3.c \ - moddi3.c \ - modsi3.c \ modti3.c \ muldc3.c \ - muldf3.c \ - muldi3.c \ - mulodi4.c \ mulosi4.c \ muloti4.c \ - mulsf3.c \ multi3.c \ - mulvdi3.c \ mulvsi3.c \ mulvti3.c \ negdf2.c \ - negdi2.c \ negsf2.c \ negti2.c \ - negvdi2.c \ negvsi2.c \ negvti2.c \ - paritydi2.c \ paritysi2.c \ parityti2.c \ - popcountdi2.c \ popcountsi2.c \ popcountti2.c \ powidf2.c \ powisf2.c \ powitf2.c \ powixf2.c \ - subdf3.c \ - subsf3.c \ - subvdi3.c \ subvsi3.c \ subvti3.c \ - truncdfsf2.c \ - ucmpdi2.c \ ucmpti2.c \ - udivdi3.c \ - udivmoddi4.c \ - udivmodsi4.c \ udivmodti4.c \ - udivsi3.c \ udivti3.c \ - umoddi3.c \ - umodsi3.c \ umodti3.c -.if ${MACHINE_ARCH} == "powerpc" +.if ${MACHINE_ARCH} != "aarch64" +GENERIC_SRCS+= \ + fixunsdfti.c \ + fixunssfti.c \ + fixunsxfti.c \ + fixxfti.c \ + floattidf.c \ + floattisf.c \ + floattixf.c \ + floatuntidf.c \ + floatuntisf.c \ + floatuntixf.c +.endif + +# These have h/w instructions which are always used. +.if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_CPU} != "aarch64" \ + && ${LIBC_MACHINE_CPU} != "powerpc" && ${LIBC_MACHINE_CPU} != "or1k" +GENERIC_SRCS+= \ + clzsi2.c +.endif + +# These have h/w instructions which are always used. +.if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_ARCH} != "vax" \ + && ${LIBC_MACHINE_CPU} != "aarch64" && ${LIBC_MACHINE_CPU} != "powerpc" \ + && ${LIBC_MACHINE_CPU} != "or1k" +GENERIC_SRCS+= \ + ctzsi2.c +.endif + +# These have h/w instructions which are always used. +.if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_CPU} != "powerpc" \ + && ${LIBC_MACHINE_CPU} != "aarch64" && ${LIBC_MACHINE_ARCH} != "vax" +GENERIC_SRCS+= \ + divmodsi4.c \ + divsi3.c \ + modsi3.c \ + udivmodsi4.c \ + umodsi3.c + +. if ${LIBC_MACHINE_CPU} != "sh3" +# On sh3 __udivsi3 is gcc "millicode" with special calling convention +# (less registers clobbered than usual). Each DSO that needs it gets +# its own hidden copy from libgcc.a. +GENERIC_SRCS+= \ + udivsi3.c +. endif +.endif + + +GENERIC_SRCS+= \ + absvdi2.c \ + addvdi3.c \ + mulodi4.c \ + mulvdi3.c \ + negvdi2.c \ + paritydi2.c \ + popcountdi2.c \ + subvdi3.c + +# These have h/w instructions which are always used. +.if ${LIBC_MACHINE_ARCH} != "alpha" && ${LIBC_MACHINE_CPU} != "powerpc64" \ + && ${LIBC_MACHINE_ARCH} != "aarch64" && ${LIBC_MACHINE_CPU} != "or1k" +GENERIC_SRCS+= \ + clzdi2.c \ + ctzdi2.c \ + ffsdi2.c +.endif + +# Don't need these on 64-bit machines. +.if empty(LIBC_MACHINE_ARCH:M*64*) && ${LIBC_MACHINE_ARCH} != "alpha" +GENERIC_SRCS+= \ + cmpdi2.c \ + ashldi3.c \ + ashrdi3.c \ + divdi3.c \ + divmoddi4.c \ + lshrdi3.c \ + moddi3.c \ + muldi3.c \ + negdi2.c \ + ucmpdi2.c \ + udivdi3.c \ + udivmoddi4.c \ + umoddi3.c +.endif + +.if ${LIBC_MACHINE_ARCH} == "powerpc" || ${LIBC_MACHINE_ARCH} == "powerpc64" GENERIC_SRCS+= \ fixtfdi.c \ fixunstfdi.c \ @@ -157,6 +225,30 @@ GENERIC_SRCS+= \ gcc_qsub.c .endif +.if ${LIBC_MACHINE_CPU} == "aarch64" +GENERIC_SRCS+= \ + clear_cache.c +.endif + +.if ${LIBC_MACHINE_CPU} == "arm" +.if !empty(LIBC_MACHINE_ARCH:Mearm*) +GENERIC_SRCS+= \ + aeabi_idivmod.S \ + aeabi_ldivmod.S \ + aeabi_uidivmod.S \ + aeabi_uldivmod.S +.endif +GENERIC_SRCS+= \ + clear_cache.c +# Not yet, overlaps with softfloat +# aeabi_dcmp.S \ +# aeabi_fcmp.S +# Not yet, requires ARMv6 +#GENERIC_SRCS+= \ +# bswapdi2.S \ +# bswapsi2.S +.endif + .if !defined(__MINIX) .for src in ${GENERIC_SRCS} . if exists(${COMPILER_RT_CPU_DIR}/${src:R}.S) || \ @@ -164,14 +256,26 @@ GENERIC_SRCS+= \ SRCS+= ${src:R}.S . else SRCS+= ${src} -COPTS.${src}+= -Wno-error=missing-prototypes +. if ${src:E} != "cc" +COPTS.${src}+= -Wno-missing-prototypes \ + -Wno-old-style-definition \ + -Wno-strict-prototypes \ + -Wno-uninitialized \ + -Wno-cast-qual +. endif . endif .endfor .else # For MINIX: do not pull in the assembly symbols, as they are not PIC ready .for src in ${GENERIC_SRCS} SRCS+= ${src} -COPTS.${src}+= -Wno-error=missing-prototypes +. if ${src:E} != "cc" +COPTS.${src}+= -Wno-missing-prototypes \ + -Wno-old-style-definition \ + -Wno-strict-prototypes \ + -Wno-uninitialized \ + -Wno-cast-qual +. endif .endfor .for src in muldc3.c diff --git a/lib/libc/dlfcn/dlfcn_elf.c b/lib/libc/dlfcn/dlfcn_elf.c index 8543d2731..890010561 100644 --- a/lib/libc/dlfcn/dlfcn_elf.c +++ b/lib/libc/dlfcn/dlfcn_elf.c @@ -191,7 +191,9 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *), * and smaller and such stores are atomic. */ dl_iterate_phdr_setup(); +#ifndef __minix membar_producer(); +#endif setup_done = true; } diff --git a/lib/libcurses/Makefile b/lib/libcurses/Makefile index c229adc76..59f050973 100644 --- a/lib/libcurses/Makefile +++ b/lib/libcurses/Makefile @@ -3,7 +3,12 @@ .include +.if defined(__MINIX) +# /usr/minix/src-clang/lib/libcurses/get_wch.c:646:15: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] +WARNS=0 +.else WARNS= 2 +.endif CPPFLAGS+=-I${.CURDIR} -I${NETBSDSRCDIR}/lib/libterminfo .if defined(DEBUG_CURSES) diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 82edaaaea..e9c32bc76 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -340,11 +340,8 @@ MLINKS+=fdim.3 fdimf.3 COPTS.compat_cabs.c+= ${${ACTIVE_CC} == "clang":? -Wno-incompatible-library-redeclaration :} COPTS.compat_cabsf.c+= ${${ACTIVE_CC} == "clang":? -Wno-incompatible-library-redeclaration :} -.include "${.CURDIR}/gen/Makefile.inc" - -.if ${HAVE_LIBGCC} == "no" .include "${.CURDIR}/compiler_rt/Makefile.inc" -.endif +.include "${.CURDIR}/gen/Makefile.inc" .include .include diff --git a/lib/librmt/Makefile b/lib/librmt/Makefile index b87178739..9addd02b0 100644 --- a/lib/librmt/Makefile +++ b/lib/librmt/Makefile @@ -9,6 +9,13 @@ LIB= rmt SRCS= rmtlib.c MAN= rmtops.3 +.if defined(__MINIX) +# rmtlib.c:451:50: error: format specifies type 'size_t' (aka 'unsigned long') \ +# but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] +WARNS=0 +CFLAGS+=-Wno-format +.endif + .if !defined(__MINIX) CPPFLAGS+= -D_REENTRANT .endif # !defined(__MINIX) diff --git a/lib/librmt/rmtlib.c b/lib/librmt/rmtlib.c index cadeab398..6a0c0ba7c 100644 --- a/lib/librmt/rmtlib.c +++ b/lib/librmt/rmtlib.c @@ -453,7 +453,7 @@ _rmt_write(int fildes, const void *buf, size_t nbyte) return -1; pstat = signal(SIGPIPE, SIG_IGN); - if ((size_t)write(WRITE(fildes), buf, nbyte) == nbyte) { + if ((size_t)write(WRITE(fildes), buf, nbyte) == (size_t) nbyte) { signal(SIGPIPE, pstat); return status(fildes); } diff --git a/lib/libutil/sockaddr_snprintf.c b/lib/libutil/sockaddr_snprintf.c index ed21020c8..d4a6ce7c2 100644 --- a/lib/libutil/sockaddr_snprintf.c +++ b/lib/libutil/sockaddr_snprintf.c @@ -226,7 +226,7 @@ sockaddr_snprintf(char * const sbuf, const size_t len, const char * const fmt, #if !defined(__minix) (void)snprintf(nbuf, sizeof(nbuf), "%d", sa->sa_len); #else - (void)snprintf(nbuf, sizeof(nbuf), "%d", len); + (void)snprintf(nbuf, sizeof(nbuf), "%zu", len); #endif /* !defined(__minix) */ ADDS(nbuf); break; diff --git a/minix/drivers/sensors/bmp085/Makefile b/minix/drivers/sensors/bmp085/Makefile index 1b2ceacc4..5e8ec32b8 100644 --- a/minix/drivers/sensors/bmp085/Makefile +++ b/minix/drivers/sensors/bmp085/Makefile @@ -7,4 +7,6 @@ LDADD+= -li2cdriver -lchardriver -lsys -ltimers CPPFLAGS+= -I${NETBSDSRCDIR} +NOCLANGERROR=yes + .include diff --git a/minix/kernel/Makefile b/minix/kernel/Makefile index eee010077..0f1de8d65 100644 --- a/minix/kernel/Makefile +++ b/minix/kernel/Makefile @@ -5,6 +5,11 @@ PROG= kernel BINDIR= /usr/sbin MAN= +.if ${MACHINE_ARCH} == "earm" && ${MKLLVM:Uno} == "yes" +# BJG - problems with optimisation of the kernel by llvm +DBG=-O0 +.endif + .include "arch/${MACHINE_ARCH}/Makefile.inc" SRCS+= clock.c cpulocals.c interrupt.c main.c proc.c system.c \ diff --git a/minix/kernel/arch/earm/Makefile.inc b/minix/kernel/arch/earm/Makefile.inc index 6f0baa6b1..18456d943 100644 --- a/minix/kernel/arch/earm/Makefile.inc +++ b/minix/kernel/arch/earm/Makefile.inc @@ -17,9 +17,10 @@ stacktrace.o: ${NETBSDSRCDIR}/minix/lib/libsys/stacktrace.c MINC_OBJS_UNPAGED= atoi.o \ printf.o subr_prf.o \ strcmp.o strcpy.o strlen.o strncmp.o \ - memcpy.o memmove.o memset.o \ - udivdi3.o umoddi3.o qdivrem.o -MINC_OBJS_UNPAGED+= __aeabi_ldiv0.o __aeabi_idiv0.o __aeabi_uldivmod.o divide.o divsi3.o udivsi3.o umodsi3.o + memcpy.o memmove.o memset.o +MINC_OBJS_UNPAGED+= divsi3.o udivsi3.o umodsi3.o \ + umoddi3.o udivmoddi4.o aeabi_uidivmod.o \ + udivmodsi4.o aeabi_uldivmod.o atoi.o: ${NETBSDSRCDIR}/minix/lib/libminc/atoi.c printf.o: ${NETBSDSRCDIR}/sys/lib/libsa/printf.c subr_prf.o: ${NETBSDSRCDIR}/sys/lib/libsa/subr_prf.c @@ -30,26 +31,18 @@ strlen.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/string/strlen.S strcpy.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/string/strcpy.S strcmp.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/string/strcmp.S -#strcat.o: ${NETBSDSRCDIR}/common/lib/libc/string/strcat.c -__aeabi_idiv0.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c -__aeabi_ldiv0.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c -__aeabi_uldivmod.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S -divide.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/gen/divide.S -divsi3.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/gen/divsi3.S -udivsi3.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/gen/udivsi3.S -umodsi3.o: ${NETBSDSRCDIR}/common/lib/libc/arch/arm/gen/umodsi3.S +divsi3.o: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/divsi3.c +udivsi3.o: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/udivsi3.c +umodsi3.o: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/umodsi3.c +umoddi3.o: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/umoddi3.c +udivmoddi4.o: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/udivmoddi4.c +udivmodsi4.o: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/arm/udivmodsi4.S +aeabi_uidivmod.o: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/arm/aeabi_uidivmod.S +aeabi_uldivmod.o: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/arm/aeabi_uldivmod.S # the following is required by pre_init.c strncmp.o: ${NETBSDSRCDIR}/common/lib/libc/string/strncmp.c -# these are required by kprintn.o: -udivdi3.o: ${NETBSDSRCDIR}/common/lib/libc/quad/udivdi3.c -umoddi3.o: ${NETBSDSRCDIR}/common/lib/libc/quad/umoddi3.c -qdivrem.o: ${NETBSDSRCDIR}/common/lib/libc/quad/qdivrem.c - -CPPFLAGS.__aeabi_idiv0.c+= -D_STANDALONE -CPPFLAGS.__aeabi_ldiv0.c+= -D_STANDALONE - # LSC: putchar and kputc have the same signature. A bit hackish. CPPFLAGS.subr_prf.c+= -Dputchar=kputc diff --git a/minix/kernel/arch/earm/phys_memset.S b/minix/kernel/arch/earm/phys_memset.S index c3200230e..b3645fb31 100644 --- a/minix/kernel/arch/earm/phys_memset.S +++ b/minix/kernel/arch/earm/phys_memset.S @@ -1,4 +1,4 @@ -/* $NetBSD: memset.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ +/* $NetBSD: memset.S,v 1.7 2013/12/02 21:21:33 joerg Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -68,6 +68,27 @@ #include +#if 0 && defined(__minix) +#if defined(__ARM_EABI__) && !defined(_BZERO) +ENTRY(__aeabi_memset) + mov r3, r1 + mov r1, r2 + mov r2, r3 + b memset +END(__aeabi_memset) +STRONG_ALIAS(__aeabi_memset4, __aeabi_memset) +STRONG_ALIAS(__aeabi_memset8, __aeabi_memset) + +ENTRY(__aeabi_memclr) + mov r2, r1 + mov r1, #0 + b memset +END(__aeabi_memclr) +STRONG_ALIAS(__aeabi_memclr4, __aeabi_memclr) +STRONG_ALIAS(__aeabi_memclr8, __aeabi_memclr) +#endif +#endif /* #if 0 && defined(__minix) */ + /* * memset: Sets a block of memory to the specified value * @@ -107,7 +128,7 @@ ENTRY(memset) #ifndef _BZERO orr r3, r3, r3, lsl #8 /* Extend value to 16-bits */ #endif -#ifdef __XSCALE__ +#ifdef _ARM_ARCH_DWORD_OK tst ip, #0x04 /* Quad-align for Xscale */ #else cmp r1, #0x10 @@ -115,7 +136,7 @@ ENTRY(memset) #ifndef _BZERO orr r3, r3, r3, lsl #16 /* Extend value to 32-bits */ #endif -#ifdef __XSCALE__ +#ifdef _ARM_ARCH_DWORD_OK subne r1, r1, #0x04 /* Quad-align if necessary */ strne r3, [ip], #0x04 cmp r1, #0x10 @@ -128,40 +149,40 @@ ENTRY(memset) /* Do 128 bytes at a time */ .Lmemset_loop128: subs r1, r1, #0x80 -#ifdef __XSCALE__ - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 +#ifdef _ARM_ARCH_DWORD_OK + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 #else - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} #endif bgt .Lmemset_loop128 #if defined(__minix) @@ -174,16 +195,16 @@ ENTRY(memset) /* Do 32 bytes at a time */ .Lmemset_loop32: subs r1, r1, #0x20 -#ifdef __XSCALE__ - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 +#ifdef _ARM_ARCH_DWORD_OK + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 #else - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} #endif bgt .Lmemset_loop32 #if defined(__minix) @@ -194,15 +215,15 @@ ENTRY(memset) adds r1, r1, #0x10 /* Partially adjust for extra sub */ /* Deal with 16 bytes or more */ -#ifdef __XSCALE__ - strged r2, [ip], #0x08 - strged r2, [ip], #0x08 +#ifdef _ARM_ARCH_DWORD_OK + strdge r2, r3, [ip], #0x08 + strdge r2, r3, [ip], #0x08 #else - stmgeia ip!, {r2-r3} - stmgeia ip!, {r2-r3} + stmiage ip!, {r2-r3} + stmiage ip!, {r2-r3} #endif #if defined(__minix) - moveq r0, #0 + moveq r0, #0 #endif RETc(eq) /* Zero length so just exit */ @@ -218,7 +239,7 @@ ENTRY(memset) #endif RETc(eq) /* Zero length so just exit */ -#ifdef __XSCALE__ +#ifdef _ARM_ARCH_DWORD_OK /* Compensate for 64-bit alignment check */ adds r1, r1, #0x04 #if defined(__minix) @@ -231,8 +252,8 @@ ENTRY(memset) #endif strb r3, [ip], #0x01 /* Set 1 byte */ - strgeb r3, [ip], #0x01 /* Set another byte */ - strgtb r3, [ip] /* and a third */ + strbge r3, [ip], #0x01 /* Set another byte */ + strbgt r3, [ip] /* and a third */ #if defined(__minix) mov r0, #0 #endif @@ -242,9 +263,9 @@ ENTRY(memset) rsb r2, r2, #0x004 strb r3, [ip], #0x01 /* Set 1 byte */ cmp r2, #0x02 - strgeb r3, [ip], #0x01 /* Set another byte */ + strbge r3, [ip], #0x01 /* Set another byte */ sub r1, r1, r2 - strgtb r3, [ip], #0x01 /* and a third */ + strbgt r3, [ip], #0x01 /* and a third */ cmp r1, #0x04 /* More than 4 bytes left? */ bge .Lmemset_wordaligned /* Yup */ @@ -256,12 +277,21 @@ ENTRY(memset) RETc(eq) /* Zero length so exit */ strb r3, [ip], #0x01 /* Set 1 byte */ cmp r1, #0x02 - strgeb r3, [ip], #0x01 /* Set another byte */ - strgtb r3, [ip] /* and a third */ + strbge r3, [ip], #0x01 /* Set another byte */ + strbgt r3, [ip] /* and a third */ #if defined(__minix) - mov r0, #0 + mov r0, #0 #endif RET /* Exit */ +#ifdef _BZERO +END(bzero) +#else +#if !defined(__minix) +END(memset) +#else +END(phys_memset) +#endif +#endif #if defined(__minix) LABEL(memset_fault) /* kernel can send us here */ diff --git a/minix/lib/libminc/Makefile b/minix/lib/libminc/Makefile index 21a859e7a..3432de78b 100644 --- a/minix/lib/libminc/Makefile +++ b/minix/lib/libminc/Makefile @@ -127,12 +127,22 @@ CPPFLAGS.sha2.c+= -D_STANDALONE CPPFLAGS.sha2.c+= -I${NETBSDSRCDIR}/sys .for f in \ - ashrdi3.o divdi3.o lshldi3.o lshrdi3.o moddi3.o \ - udivdi3.o umoddi3.o qdivrem.o -${f} ${f:C/\.o/.bc/}: ${LIBCOMMONCDIR}/quad/${f:C/\.o/.c/} + ashrdi3.o divdi3.o lshrdi3.o moddi3.o \ + udivdi3.o umoddi3.o umodsi3.o udivsi3.o \ + udivmoddi4.o divsi3.o modsi3.o divmoddi4.o \ + divmodsi4.o udivmodsi4.o #qdivrem.o lshldi3.o +${f} ${f:C/\.o/.bc/}: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/${f:C/\.o/.c/} OBJS+= ${f} CLEANFILES+= ${f} +COPTS+= -Wno-missing-prototypes \ + -Wno-old-style-definition \ + -Wno-strict-prototypes \ + -Wno-uninitialized \ + -Wno-cast-qual + + + .if ${USE_BITCODE:Uno} == "yes" OBJS+= ${f:C/\.o/.bc/} CLEANFILES+= ${f:C/\.o/.bc/} diff --git a/minix/lib/libminc/arch/earm/Makefile.libc.inc b/minix/lib/libminc/arch/earm/Makefile.libc.inc index 2fd3cac48..3d01bafbd 100644 --- a/minix/lib/libminc/arch/earm/Makefile.libc.inc +++ b/minix/lib/libminc/arch/earm/Makefile.libc.inc @@ -11,7 +11,7 @@ CLEANFILES+= ${f} .endfor .for f in \ - byte_swap_2.o byte_swap_4.o divsi3.o divide.o udivsi3.o + byte_swap_2.o byte_swap_4.o ${f}: ${LIBCOMMONCARCHDIR}/gen/${f:C/\.o/.S/} OBJS+= ${f} CLEANFILES+= ${f} @@ -29,12 +29,12 @@ CLEANFILES+= ${f} CPPFLAGS.__aeabi_idiv0.c+= -D_STANDALONE CPPFLAGS.__aeabi_ldiv0.c+= -D_STANDALONE -.for f in \ - __aeabi_ldivmod.o __aeabi_uldivmod.o -${f}: ${LIBCOMMONCARCHDIR}/quad/${f:C/\.o/.S/} -OBJS+= ${f} -CLEANFILES+= ${f} -.endfor +#.for f in \ +# __aeabi_ldivmod.o __aeabi_uldivmod.o +#${f}: ${LIBCOMMONCARCHDIR}/quad/${f:C/\.o/.S/} +#OBJS+= ${f} +#CLEANFILES+= ${f} +#.endfor .for f in \ memcmp.o memcpy.o memmove.o memset.o \ @@ -72,6 +72,13 @@ OBJS+= ${f} CLEANFILES+= ${f} .endfor +.for f in \ + aeabi_uidivmod.o aeabi_ldivmod.o aeabi_uldivmod.o aeabi_idivmod.o +${f}: ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist/lib/arm/${f:C/\.o/.S/} +OBJS+= ${f} +CLEANFILES+= ${f} +.endfor + .for f in \ fpgetround.o fpsetround.o fpgetmask.o fpsetmask.o \ fpgetsticky.o fpsetsticky.o diff --git a/minix/servers/is/dmp_pm.c b/minix/servers/is/dmp_pm.c index 1cbd8d394..596c78095 100644 --- a/minix/servers/is/dmp_pm.c +++ b/minix/servers/is/dmp_pm.c @@ -94,7 +94,8 @@ void sigaction_dmp() mp->mp_ignore.__bits[0], mp->mp_catch.__bits[0], mp->mp_sigmask.__bits[0]); printf("%08x ", mp->mp_sigpending.__bits[0]); - if (mp->mp_flags & ALARM_ON) printf("%8lu", mp->mp_timer.tmr_exp_time-uptime); + if (mp->mp_flags & ALARM_ON) printf("%8lu", + (unsigned long) (mp->mp_timer.tmr_exp_time-uptime)); else printf(" -"); printf("\n"); } diff --git a/minix/servers/is/dmp_rs.c b/minix/servers/is/dmp_rs.c index 8ca64dacd..1562590d7 100644 --- a/minix/servers/is/dmp_rs.c +++ b/minix/servers/is/dmp_rs.c @@ -42,10 +42,11 @@ void rproc_dmp() rpub = &rprocpub[i]; if (! (rp->r_flags & RS_IN_USE)) continue; if (++n > 22) break; - printf("%13s %9d %5d %6s %4d %4ld %8lu %5dx %s", + printf("%13s %9d %5d %6s %4d %4lu %8u %5dx %s", rpub->label, rpub->endpoint, rp->r_pid, s_flags_str(rp->r_flags, rpub->sys_flags), rpub->dev_nr, - rp->r_period, rp->r_alive_tm, rp->r_restarts, + (unsigned long) rp->r_period, + (unsigned int) rp->r_alive_tm, rp->r_restarts, rp->r_args ); printf("\n"); diff --git a/releasetools/arm_sdimage.sh b/releasetools/arm_sdimage.sh index 98876094a..ae771d9f3 100755 --- a/releasetools/arm_sdimage.sh +++ b/releasetools/arm_sdimage.sh @@ -28,6 +28,8 @@ fi : ${RELEASETOOLSDIR=./releasetools/} : ${FSTAB=${DESTDIR}/etc/fstab} : ${BUILDVARS=-V MKGCCCMDS=yes -V MKLLVM=no} +# These BUILDVARS are for building with LLVM: +#: ${BUILDVARS=-V MKLIBCXX=no -V MKKYUA=no -V MKATF=no -V MKLLVMCMDS=no} : ${BUILDSH=build.sh} : ${CREATE_IMAGE_ONLY=0} : ${RC=minix_x86.rc} diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 95bbf8d01..f9ef81655 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1151,7 +1151,7 @@ _MKVARS.yes= \ #MINIX-specific vars _MKVARS.yes+= \ - MKSYSDEBUG MKLIVEUPDATE MKLWIP + MKSYSDEBUG MKLIVEUPDATE MKLWIP MKLLVMCMDS .if (${MACHINE_ARCH} == "i386") _MKVARS.yes+= \ MKWATCHDOG MKACPI MKAPIC MKDEBUGREG MKINSTALLBOOT MKPCI diff --git a/sys/external/bsd/compiler_rt/dist/lib/int_lib.h b/sys/external/bsd/compiler_rt/dist/lib/int_lib.h index a87426c51..5c49d8171 100644 --- a/sys/external/bsd/compiler_rt/dist/lib/int_lib.h +++ b/sys/external/bsd/compiler_rt/dist/lib/int_lib.h @@ -43,4 +43,22 @@ /* Include internal utility function declarations. */ #include "int_util.h" +#ifdef __minix +/* missing prototypes causing build problems */ +COMPILER_RT_ABI di_int __ashrdi3(di_int a, si_int b); +COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b); +COMPILER_RT_ABI di_int __divmoddi4(di_int a, di_int b, di_int* rem); +COMPILER_RT_ABI si_int __divmodsi4(si_int a, si_int b, si_int* rem); +COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b); +COMPILER_RT_ABI si_int __modsi3(si_int a, si_int b); +COMPILER_RT_ABI di_int __lshrdi3(di_int a, si_int b); +COMPILER_RT_ABI di_int __moddi3(di_int a, di_int b); +COMPILER_RT_ABI du_int __udivdi3(du_int a, du_int b); +COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int* rem); +COMPILER_RT_ABI su_int __udivmodsi4(su_int a, su_int b, su_int* rem); +COMPILER_RT_ABI su_int __udivsi3(su_int n, su_int d); +COMPILER_RT_ABI du_int __umoddi3(du_int a, du_int b); +COMPILER_RT_ABI su_int __umodsi3(su_int a, su_int b); +#endif + #endif /* INT_LIB_H */ diff --git a/sys/external/bsd/compiler_rt/dist/lib/modsi3.c b/sys/external/bsd/compiler_rt/dist/lib/modsi3.c index d16213c49..e935cfc7b 100644 --- a/sys/external/bsd/compiler_rt/dist/lib/modsi3.c +++ b/sys/external/bsd/compiler_rt/dist/lib/modsi3.c @@ -14,7 +14,11 @@ #include "int_lib.h" +#ifdef __minix +si_int COMPILER_RT_ABI __divsi3(si_int a, si_int b); +#else su_int COMPILER_RT_ABI __divsi3(si_int a, si_int b); +#endif /* Returns: a % b */ diff --git a/sys/lib/libunwind/Makefile.inc b/sys/lib/libunwind/Makefile.inc index 1195ef6a9..22b909652 100644 --- a/sys/lib/libunwind/Makefile.inc +++ b/sys/lib/libunwind/Makefile.inc @@ -5,6 +5,10 @@ SRCS+= libunwind.cxx \ unwind_registers.S +.if defined(__MINIX) && (${MACHINE_ARCH} == "earm") +SRCS+= aeabi_unwind.c +.endif + INCS+= unwind.h .if ${HAVE_GCC:U48} == "4" diff --git a/usr.bin/tic/tic.c b/usr.bin/tic/tic.c index 675556ec2..ef9d9ca21 100644 --- a/usr.bin/tic/tic.c +++ b/usr.bin/tic/tic.c @@ -429,7 +429,11 @@ print_dump(int argc, char **argv) } if (col != 0) printf("\",\n"); +#ifdef __minix + printf("\t\t%zu\n", (size_t) len); +#else printf("\t\t%zu\n", len); +#endif printf("\t}"); if (i + 1 < argc) printf(","); -- 2.44.0