Delivered-To: raj.khem@gmail.com
Received: by 10.90.86.4 with SMTP id j4cs313307agb;
        Sat, 8 Jan 2011 16:45:20 -0800 (PST)
Received: by 10.227.141.78 with SMTP id l14mr16920947wbu.128.1294533919168;
        Sat, 08 Jan 2011 16:45:19 -0800 (PST)
Return-Path: <yann.morin.1998@anciens.enib.fr>
Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123])
        by mx.google.com with ESMTP id w30si33755908wbd.17.2011.01.08.16.45.18;
        Sat, 08 Jan 2011 16:45:19 -0800 (PST)
Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123;
Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr
Received: from roazhon.bzh.lan ([90.32.245.227])
	by mwinf5d24 with ME
	id tClC1f0024v5z3u03ClHDo; Sun, 09 Jan 2011 01:45:18 +0100
From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
To: uclibc@uclibc.org
Cc: Khem Raj <raj.khem@gmail.com>,
	Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
	Carmelo AMOROSO <carmelo.amoroso@st.com>
Subject: [PATCH 6/7] ARM: detect BX availibility at build time
Date: Sun,  9 Jan 2011 01:45:09 +0100
Message-Id: <1294533910-19305-7-git-send-email-yann.morin.1998@anciens.enib.fr>
X-Mailer: git-send-email 1.7.1
In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>

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@anciens.enib.fr>
Cc: Khem Raj <raj.khem@gmail.com>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
---
 extra/Configs/Config.arm              |    4 +++-
 libc/sysdeps/linux/arm/bits/arm_asm.h |    9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
index 227b90c..9aa9e56 100644
--- a/extra/Configs/Config.arm
+++ b/extra/Configs/Config.arm
@@ -33,4 +33,6 @@ config COMPILE_IN_THUMB_MODE
 config USE_BX
 	bool "Use BX in function return"
 	help
-	  Use BX instruction for THUMB aware architectures.
+	  Say 'y' to use BX to return from functions on your thumb-aware
+	  processor. 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..921c9a3 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 /* __USE_BX__ */
 
+#endif /* _ARM_ASM_H */
-- 
1.7.1

