diff --git a/libc/arch-arm/bionic/setjmp.S b/libc/arch-arm/bionic/setjmp.S index a119529ee..464f7d8de 100644 --- a/libc/arch-arm/bionic/setjmp.S +++ b/libc/arch-arm/bionic/setjmp.S @@ -151,7 +151,10 @@ ENTRY(sigsetjmp) // Save core registers. add r1, r0, #(_JB_CORE_BASE * 4) m_mangle_registers r2 - stmia r1, {r4-r14} + + // ARM deprecates using sp in the register list for stmia. + stmia r1, {r4-r12, lr} + str sp, [r1, #(10 * 4)] m_unmangle_registers r2 // Save floating-point registers. @@ -204,7 +207,10 @@ ENTRY(siglongjmp) ldr r3, [r0, #(_JB_SIGFLAG * 4)] bic r3, r3, #1 add r2, r0, #(_JB_CORE_BASE * 4) - ldmia r2, {r4-r14} + + // ARM deprecates using sp in the register list for ldmia. + ldmia r2, {r4-r12, lr} + ldr sp, [r2, #(10 * 4)] m_unmangle_registers r3 // Save the return value/address and check the setjmp cookie.