24d5bcca66b4abb7ecf4cb4edd3f2687265fb0c4
[openwrt/staging/yousong.git] / toolchain / uClibc / patches-0.9.32 / 950-detect_bx_availibility.patch
1 The "use BX" option is now a suggestion that BX be used if available.
2 Use a macro to detect if BX is available at build time. If so, and
3 the user requested it be used, then use it. Otherwise, error out.
4
5 Macro courtesy Khem RAJ:
6 http://lists.uclibc.org/pipermail/uclibc/2009-April/042301.html
7
8 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
9 Cc: Khem Raj <raj.khem@gmail.com>
10 Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
11 Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
12 ---
13 extra/Configs/Config.arm | 4 +++-
14 libc/sysdeps/linux/arm/bits/arm_asm.h | 9 ++++++++-
15 2 files changed, 11 insertions(+), 2 deletions(-)
16
17 diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
18 index 227b90c..9aa9e56 100644
19 --- a/extra/Configs/Config.arm
20 +++ b/extra/Configs/Config.arm
21 @@ -33,4 +33,6 @@ config COMPILE_IN_THUMB_MODE
22 config USE_BX
23 bool "Use BX in function return"
24 help
25 - Use BX instruction for THUMB aware architectures.
26 + Say 'y' to use BX to return from functions on your thumb-aware
27 + processor. Say 'y' if you need to use interworking. Say 'n' if not.
28 + It is safe to say 'y' even if you're not doing interworking.
29 diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h
30 index 1d87df6..921c9a3 100644
31 --- a/libc/sysdeps/linux/arm/bits/arm_asm.h
32 +++ b/libc/sysdeps/linux/arm/bits/arm_asm.h
33 @@ -24,5 +24,12 @@
34 #define THUMB1_ONLY 1
35 #endif
36
37 -#endif /* _ARM_ASM_H */
38 +#if defined(__USE_BX__)
39 +# if ( defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \
40 + || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
41 + )
42 +# error Use of BX was requested, but is not available on the target processor.
43 +# endif /* ARCH level */
44 +#endif /* __USE_BX__ */
45
46 +#endif /* _ARM_ASM_H */
47 --
48 1.7.1
49