summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/arm/bsd-_setjmp.S
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-03-26 13:40:36 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2008-03-26 13:40:36 +0000
commitefce79f09ae6daa77cd322df0d532beec3f445f5 (patch)
treeae936850c5671b8bea0abf0d33bf2196f7abc796 /libc/sysdeps/linux/arm/bsd-_setjmp.S
parent17e961d9c708ab202760ce830f8efe73e91bb129 (diff)
Paul Brook writes:
The attached patch adds support for compiling arm uClibc as pure Thumb code. This is needed because some recent ARM codes do not implement traditional ARM mode. Specifically: * Cortex-M1 - An extremely minimal FPGA based core that only implements Thumb-1 (aka ARMv6-M). * Cortex-M3 - A Thumb-2 only ARMv7-M core. Most of uClibc already builds in Thumb mode, all that is left are a handful of assembly bits. Tested on arm-uclinuxeabi.
Diffstat (limited to 'libc/sysdeps/linux/arm/bsd-_setjmp.S')
-rw-r--r--libc/sysdeps/linux/arm/bsd-_setjmp.S28
1 files changed, 27 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/arm/bsd-_setjmp.S b/libc/sysdeps/linux/arm/bsd-_setjmp.S
index f70073266..a05570df7 100644
--- a/libc/sysdeps/linux/arm/bsd-_setjmp.S
+++ b/libc/sysdeps/linux/arm/bsd-_setjmp.S
@@ -17,13 +17,38 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+#include <bits/arm_asm.h>
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
We cannot do it in C because it must be a tail-call, so frame-unwinding
in setjmp doesn't clobber the state restored by longjmp. */
.global _setjmp
.type _setjmp,%function
.align 2
+#if defined(THUMB1_ONLY)
+.thumb_func
+_setjmp:
+ mov r1, #0
+#ifdef __PIC__
+ ldr r3, .L_GOT
+ adr r2, .L_GOT
+ add r3, r2, r3
+
+ ldr r2, .L_GOT+4 /* __sigsetjmp */
+ ldr r2, [r2, r3]
+ bx r2
+
+ .align 2
+.L_GOT:
+ .word _GLOBAL_OFFSET_TABLE_-.L_GOT
+ .word __sigsetjmp(GOT)
+#else
+ ldr r2, =__sigsetjmp
+ bx r2
+.pool
+#endif
+#else
_setjmp:
mov r1, #0
#ifdef __PIC__
@@ -31,5 +56,6 @@ _setjmp:
#else
b __sigsetjmp
#endif
+#endif
.size _setjmp,.-_setjmp