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.
This commit is contained in:
Rich Felker 2015-05-14 18:51:27 -04:00
parent 83340c7a58
commit c0f10cf067
1 changed files with 5 additions and 0 deletions

View File

@ -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