From c0f10cf06725bd0de37f3ced7954a653bf9f1049 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 14 May 2015 18:51:27 -0400 Subject: [PATCH] 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. --- arch/arm/reloc.h | 5 +++++ 1 file changed, 5 insertions(+) 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