1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-22 19:43:42 +01:00

arm: getcontext switches back to thumb mode

The ARM Thumb implementation of unw_tdep_getcontext switches to ARM
mode (".code 32"), but doesn't switch back to Thumb mode.
In gcc, this is fine (it automatically switches back to Thumb mode
at the end of an asm block), but in clang, this causes bad assembly
output (thumb instructions generated by C/C++ code later on are
interpreted as ARM mode assembly, which can't work).

Switching back to Thumb mode manually fixes clang, and is a no-op for gcc.
This commit is contained in:
Bernhard Rosenkraenzer 2013-12-27 11:01:54 -08:00 committed by Dave Watson
parent ed90c8387b
commit 1a4b357598

View file

@ -277,7 +277,8 @@ unw_tdep_context_t;
__asm__ __volatile__ ( \
".align 2\nbx pc\nnop\n.code 32\n" \
"stmia %[base], {r0-r15}\n" \
"orr %[base], pc, #1\nbx %[base]" \
"orr %[base], pc, #1\nbx %[base]\n" \
".code 16\n" \
: [base] "+r" (unw_base) : : "memory", "cc"); \
}), 0)
#endif