[klibc] Bug#634890: klibc issues on armhf (not Debian/armel)

Steve McIntyre steve at einval.com
Fri Jun 29 10:13:34 PDT 2012


On Thu, Jun 28, 2012 at 06:59:34PM +0200, maximilian attems wrote:
>On Tue, 19 Jun 2012, Steve McIntyre wrote:
>
>> 
>> More debugging results:
>> 
>>  * If I replace -Os with -O0 to disable optimisation, the crash goes
>>    away too. Suggests (maybe) a compiler bug here...
>
>nasty. :|
> 
>>  * There's a real bug in the ARM assembly version of longjmp in
>>    usr/klibc/arch/arm/setjmp.S: it will always pass back its first
>>    argument as a return value, even if it's 0 (see the man page for
>>    more details). Oddly, the Thumb implementation in the same file
>>    *is* correct!
>
>care to cook up a patch, please?

Sure, no problem:

--- klibc-2.0.old/usr/klibc/arch/arm/setjmp.S   2012-05-29 21:41:34.000000000 +0000
+++ klibc-2.0/usr/klibc/arch/arm/setjmp.S       2012-06-29 16:53:25.000000000 +0000
@@ -41,7 +41,9 @@
 longjmp:
        ldmia   r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr}
        mov     r0, r1
-       BX(lr)
+       bne     1f
+       mov     r0, #1
+1:     BX(lr)
        .size longjmp,.-longjmp
 
 #else /* __thumb__ */


-- 
Steve McIntyre, Cambridge, UK.                                steve at einval.com
You lock the door
And throw away the key
There's someone in my head but it's not me 



More information about the klibc mailing list