summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Rosenkraenzer <bero@lindev.ch>2013-12-27 11:01:54 -0800
committerDave Watson <davejwatson@fb.com>2017-08-15 10:34:19 -0700
commit1a4b357598ccb718b38739701f99b1cc4fccbf21 (patch)
tree7ad172b466acf64a29a3c0e18535e57a0fbc7b51
parented90c8387b0c6ea2df69a90391e55c5f8c6eff29 (diff)
downloadlibunwind-1a4b357598ccb718b38739701f99b1cc4fccbf21.tar.gz
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.
-rw-r--r--include/libunwind-arm.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/libunwind-arm.h b/include/libunwind-arm.h
index 1c856faf..6709b7ab 100644
--- a/include/libunwind-arm.h
+++ b/include/libunwind-arm.h
@@ -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