about summary refs log tree commit diff
path: root/arch/arm
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-05-14 18:51:27 -0400
committerRich Felker <dalias@aerifal.cx>2015-05-14 18:51:27 -0400
commitc0f10cf06725bd0de37f3ced7954a653bf9f1049 (patch)
tree0b7afac048a473bb59e30cf1b9b8b8e700a3a1a5 /arch/arm
parent83340c7a580e91b22f58321b7cf6d976af61084c (diff)
downloadmusl-c0f10cf06725bd0de37f3ced7954a653bf9f1049.tar.gz
musl-c0f10cf06725bd0de37f3ced7954a653bf9f1049.tar.xz
musl-c0f10cf06725bd0de37f3ced7954a653bf9f1049.zip
make arm reloc.h CRTJMP macro compatible with thumb
compilers targeting armv7 may be configured to produce thumb2 code
instead of arm code by default, and in the future we may wish to
support targets where only the thumb instruction set is available.

the instructions this patch omits in thumb mode are needed only for
non-thumb versions of armv4 or earlier, which are not supported by any
current compilers/toolchains and thus rather pointless to have. at
some point these compatibility return sequences may be removed from
all asm source files, and in that case it would make sense to remove
them here too and remove the ifdef.
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/reloc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/reloc.h b/arch/arm/reloc.h
index dec0031e..e1ef3506 100644
--- a/arch/arm/reloc.h
+++ b/arch/arm/reloc.h
@@ -28,5 +28,10 @@
 #define REL_TPOFF       R_ARM_TLS_TPOFF32
 //#define REL_TLSDESC     R_ARM_TLS_DESC
 
+#ifdef __thumb__
+#define CRTJMP(pc,sp) __asm__ __volatile__( \
+	"mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
+#else
 #define CRTJMP(pc,sp) __asm__ __volatile__( \
 	"mov sp,%1 ; tst %0,#1 ; moveq pc,%0 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
+#endif