From feb9f08cfe8ddd1fd4fb62265e17ee35147ab268 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sun, 20 Mar 2016 17:58:35 +0100 Subject: arm: simplify handling of Thumb related options Currently, the Thumb support on ARM has three related Config.in options, which are not trivial for users to understand, and are in fact not needed: - The USE_BX option is not needed: knowing whether BX is available or not is easy. If you have an ARM > v4 or ARMv4T, then BX is available, otherwise it's not. This is the logic used in glibc. - The USE_LDREXSTREX option is not needed: whenever Thumb2 is available, ldrex/strex are available, so we can simply rely on __thumb2__ to determine whether ldrex/strex should be used, without requiring a Config.in option. - Once USE_BX and USE_LDREXSTREX are removed, the only thing left that COMPILE_IN_THUMB does is to set -mthumb. This makes the option unnecessary, as on ARM at least, the user is already supposed to pass -march= or other compiler options tuning the library for a specific ARM variant. There is no reason to do otherwise for Thumb, which allows to get rid of the COMPILE_IN_THUMB option. Signed-off-by: Thomas Petazzoni --- libc/sysdeps/linux/arm/bits/arm_bx.h | 10 ++++------ libc/sysdeps/linux/arm/clone.S | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'libc/sysdeps') diff --git a/libc/sysdeps/linux/arm/bits/arm_bx.h b/libc/sysdeps/linux/arm/bits/arm_bx.h index 2c290896d..1c775b681 100644 --- a/libc/sysdeps/linux/arm/bits/arm_bx.h +++ b/libc/sysdeps/linux/arm/bits/arm_bx.h @@ -23,13 +23,11 @@ #error Please include features.h first #endif /* features.h not yet included */ -#if defined(__USE_BX__) -# if (__ARM_ARCH <= 4 && !defined __ARM_ARCH_4T__) -# error Use of BX was requested, but is not available on the target processor. -# endif /* ARCH level */ -#endif /* __USE_BX__ */ +#if __ARM_ARCH > 4 || defined (__ARM_ARCH_4T__) +# define ARCH_HAS_BX +#endif -#if defined(__USE_BX__) && (__ARM_ARCH > 4 || (__ARM_ARCH == 4 && defined __ARM_ARCH_4T__)) +#if defined(ARCH_HAS_BX) # define BX(reg) bx reg # define BXC(cond, reg) bx##cond reg #else diff --git a/libc/sysdeps/linux/arm/clone.S b/libc/sysdeps/linux/arm/clone.S index b4c7d8a02..fd7590dd0 100644 --- a/libc/sysdeps/linux/arm/clone.S +++ b/libc/sysdeps/linux/arm/clone.S @@ -69,7 +69,7 @@ __clone: @ pick the function arg and call address off the stack and execute ldr r0, [sp, #4] -#if defined(__USE_BX__) +#if defined(ARCH_HAS_BX) ldr r1, [sp] bl 2f @ blx r1 #else -- cgit v1.2.3