aboutsummaryrefslogtreecommitdiff
path: root/lib/builtins/assembly.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/builtins/assembly.h')
-rw-r--r--lib/builtins/assembly.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/builtins/assembly.h b/lib/builtins/assembly.h
index 8bb0ddc106bd..c28970534cc4 100644
--- a/lib/builtins/assembly.h
+++ b/lib/builtins/assembly.h
@@ -73,6 +73,15 @@
#define JMPc(r, c) mov##c pc, r
#endif
+// pop {pc} can't switch Thumb mode on ARMv4T
+#if __ARM_ARCH >= 5
+#define POP_PC() pop {pc}
+#else
+#define POP_PC() \
+ pop {ip}; \
+ JMP(ip)
+#endif
+
#if __ARM_ARCH_ISA_THUMB == 2
#define IT(cond) it cond
#define ITT(cond) itt cond