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
This commit is contained in:
Ben Gras 2013-02-08 13:12:45 +01:00
parent 46e7c7a920
commit f5cfab17d6
3 changed files with 8 additions and 0 deletions

View file

@ -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? */
/*

View file

@ -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.

View file

@ -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