From: Ben Gras Date: Fri, 8 Feb 2013 12:12:45 +0000 (+0100) Subject: ldivmod, uldivmod: fix qdivrem calls X-Git-Tag: v3.2.1~22 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=f5cfab17d6413e078dce9ac989b064b527446211;p=minix.git ldivmod, uldivmod: fix qdivrem calls . ldivmod, uldivmod were passing the modulo argument pointer in R4, which is bogus, as qdivrem expects it on the stack as per the EABI, causing essentially 'random' memory to be trampled by qdivrem. fix by pushing R4 before the call. . also add these functions to -minc so -lminc clients can be linked without -lgcc Change-Id: I90b0b28b51a188c93da5de6afb108224749ea794 --- diff --git a/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S b/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S index 47de1650a..041ce8558 100644 --- a/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S +++ b/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S @@ -66,7 +66,9 @@ ENTRY(__aeabi_ldivmod) */ sub sp, sp, #8 mov r4, sp /* pointer to remainder */ + push {r4} bl PLT_SYM(__qdivrem) + add sp, sp, #4 /* forget pointer to remainder */ teq NEG, #0 /* any signs to flip? */ /* diff --git a/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S b/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S index bb352157f..12351d133 100644 --- a/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S +++ b/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S @@ -41,7 +41,9 @@ ENTRY(__aeabi_uldivmod) push {r4,lr} sub sp, sp, #8 mov r4, sp + push {r4} bl PLT_SYM(__qdivrem) + add sp, sp, #4 /* * The remainder is already on the stack just waiting to be popped * into r2/r3. diff --git a/lib/libminc/Makefile b/lib/libminc/Makefile index e9be11aae..442b848be 100644 --- a/lib/libminc/Makefile +++ b/lib/libminc/Makefile @@ -131,6 +131,10 @@ CPPFLAGS.strtol.c+= -I${LIBCSRCDIR}/../../common/lib/libc/stdlib SRCS+= ${i} .endfor +.if (${MACHINE_ARCH} == "earm") +SRCS += __aeabi_ldivmod.S __aeabi_uldivmod.S +.endif + # Import from locale .for i in _def_time.c .PATH.c: ${LIBCSRCDIR}/locale