[PATCH 8/8] ARM: detect BX availibility at build time

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Wed Jan 5 22:57:50 UTC 2011


The "use BX" option is now a suggestion that BX be used if available.
Use a macro to detect if BX is available at build time. If so, and
the user requested it be used, then use it. Otherwise, error out.

Macro courtesy Khem RAJ:
  http://lists.uclibc.org/pipermail/uclibc/2009-April/042301.html

Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at anciens.enib.fr>
Cc: Khem Raj <raj.khem at gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso at st.com>
---
 extra/Configs/Config.arm              |    7 +++++--
 libc/sysdeps/linux/arm/bits/arm_asm.h |    9 ++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
index 3003be3..13e2ce3 100644
--- a/extra/Configs/Config.arm
+++ b/extra/Configs/Config.arm
@@ -13,6 +13,9 @@ config FORCE_OPTIONS_FOR_ARCH
 	select ARCH_ANY_ENDIAN
 
 config USE_BX
-	bool "Use BX in function return"
+	bool "Use BX (if available) in functions return"
 	help
-	  Use BX instruction for THUMB aware architectures.
+	  If available on your target processor, use BX to return from functions.
+	  
+	  Say 'y' if you need to use interworking. Say 'n' if not.
+	  It is safe to say 'y' even if you're not doing interworking.
diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h
index 1d87df6..953f0d0 100644
--- a/libc/sysdeps/linux/arm/bits/arm_asm.h
+++ b/libc/sysdeps/linux/arm/bits/arm_asm.h
@@ -24,5 +24,12 @@
 #define THUMB1_ONLY 1
 #endif
 
-#endif /* _ARM_ASM_H */
+#if defined(__USE_BX__)
+# if (   defined (__ARM_ARCH_2__)  || defined (__ARM_ARCH_3__) \
+      || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
+     )
+#  error Use of BX was requested, but is not available on the target processor.
+# endif /* ARCH level */
+#endif /* __WANTS_BX__ */
 
+#endif /* _ARM_ASM_H */
-- 
1.7.1



More information about the uClibc mailing list