https://llvm.org/bugs/show_bug.cgi?id=24331
Bug ID: 24331 Summary: Wrong code for saving registers on ARM Product: libc++abi Version: 3.7 Hardware: Other OS: All Status: NEW Severity: normal Priority: P Component: All Bugs Assignee: unassignedb...@nondot.org Reporter: manuel.freiber...@gmx.at CC: llvmbugs@cs.uiuc.edu, mclow.li...@gmail.com Classification: Unclassified Hello, The function unw_getcontext() implemented in the file UnwindRegistersSave.S has a wrong instruction in line 304: stm r0!, {r0-r7} As a write-back on R0 is used here, the offsets for the instructions in line 307-309 are wrong. The code should be changed to stm r0, {r0-r7} i.e. register R0 should not be modified, similar to the code in the lines 314--317. I have tested this on a Cortex-M4. Before making the modification, backtraces with libunwind were not working because the PC register was always zero when unw_step() was called. After the modification everything was fine. /Manuel --- UnwindRegistersSave.S 2015-08-01 15:35:38.847465964 +0200 +++ UnwindRegistersSave.S_modified 2015-08-01 15:35:57.105379894 +0200 @@ -301,7 +301,7 @@ .p2align 2 DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) #if !defined(__ARM_ARCH_ISA_ARM) - stm r0!, {r0-r7} + stm r0, {r0-r7} mov r2, sp mov r3, lr str r2, [r0, #52] -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ LLVMbugs mailing list LLVMbugs@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs