maximilian attems
2012-Jun-28 16:59 UTC
[klibc] Bug#634890: klibc issues on armhf (not Debian/armel)
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? thank you. -- maks
Steve McIntyre
2012-Jun-29 17:13 UTC
[klibc] Bug#634890: klibc issues on armhf (not Debian/armel)
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
Reasonably Related Threads
- fwd: fix up ARM assembly to use 'bx lr' in place of 'mov pc, lr'.
- [klibc:master] arm/setjmp.S: fix longjmp
- [PATCH] fix ARM longjmp with zero 'val'.
- klibc issues on armhf (not Debian/armel)
- [klibc 00/31] klibc as a historyless patchset (updated and reorganized)