From 5a0585359d89c9a6f96298addda9a8e4c4d3d34a Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sat, 9 Feb 2013 20:38:45 +0100 Subject: [PATCH] ARM divsi3.S: raise(SIGFPE) when called for . raise(SIGFPE) for modulo-0/divide-0 operations in internal int division functions . gcc: do not link with -lgcc anywhere so these internal functions are always used from libc instead of (sometimes) masked by -lgcc . together fixes test53 on ARM Change-Id: I31ec19dfdd68b8a92695595da901874e63106f9d --- common/lib/libc/arch/arm/gen/divsi3.S | 2 +- external/gpl3/gcc/files/arm-minix.h | 4 ++++ kernel/arch/earm/pre_init.c | 1 + kernel/arch/i386/pre_init.c | 1 + share/mk/minix.bootprog.mk | 4 ++++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/lib/libc/arch/arm/gen/divsi3.S b/common/lib/libc/arch/arm/gen/divsi3.S index 04b1eac3a..c6d799c49 100644 --- a/common/lib/libc/arch/arm/gen/divsi3.S +++ b/common/lib/libc/arch/arm/gen/divsi3.S @@ -22,7 +22,7 @@ */ .L_overflow: -#if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(__minix) +#if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(_LIBMINC) mov r0, #8 /* SIGFPE */ bl PIC_SYM(_C_LABEL(raise), PLT) /* raise it */ mov r0, #0 diff --git a/external/gpl3/gcc/files/arm-minix.h b/external/gpl3/gcc/files/arm-minix.h index 398279ef5..4b27aa733 100644 --- a/external/gpl3/gcc/files/arm-minix.h +++ b/external/gpl3/gcc/files/arm-minix.h @@ -67,3 +67,7 @@ #undef TARGET_VERSION #define TARGET_VERSION fputs (" (MINIX/arm ELF EABI)", stderr); + +/* suppress -lgcc - don't include %G (-lgcc) in the libraries */ +#undef LINK_GCC_C_SEQUENCE_SPEC +#define LINK_GCC_C_SEQUENCE_SPEC "%L" diff --git a/kernel/arch/earm/pre_init.c b/kernel/arch/earm/pre_init.c index 3a4f72da9..4d9663434 100644 --- a/kernel/arch/earm/pre_init.c +++ b/kernel/arch/earm/pre_init.c @@ -284,3 +284,4 @@ kinfo_t *pre_init(u32_t magic, u32_t ebx) int send_sig(endpoint_t proc_nr, int sig_nr) { return 0; } void minix_shutdown(timer_t *t) { arch_shutdown(RBT_PANIC); } void busy_delay_ms(int x) { } +int raise(int n) { panic("raise(%d)\n", n); } diff --git a/kernel/arch/i386/pre_init.c b/kernel/arch/i386/pre_init.c index bf327adb3..03e068fc2 100644 --- a/kernel/arch/i386/pre_init.c +++ b/kernel/arch/i386/pre_init.c @@ -243,3 +243,4 @@ kinfo_t *pre_init(u32_t magic, u32_t ebx) int send_sig(endpoint_t proc_nr, int sig_nr) { return 0; } void minix_shutdown(timer_t *t) { arch_shutdown(RBT_PANIC); } void busy_delay_ms(int x) { } +int raise(int sig) { panic("raise(%d)\n", sig); } diff --git a/share/mk/minix.bootprog.mk b/share/mk/minix.bootprog.mk index 2eabe6772..effb18145 100644 --- a/share/mk/minix.bootprog.mk +++ b/share/mk/minix.bootprog.mk @@ -10,7 +10,11 @@ LDADD+= -nodefaultlibs # 2. Compiler-specific libs .if !empty(CC:M*gcc) +.if (${MACHINE_ARCH} == "earm") +LDADD+= -lsys +.else LDADD+= -lgcc -lsys -lgcc +.endif .elif !empty(CC:M*clang) LDADD+= -L/usr/pkg/compiler-rt/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic .endif -- 2.44.0