a0277cb086b84d8a430976ca433e0b13e809999e
[openwrt.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 --- a/extra/Configs/Config.arm
18 +++ b/extra/Configs/Config.arm
19 @@ -33,4 +33,6 @@ config COMPILE_IN_THUMB_MODE
20  config USE_BX
21         bool "Use BX in function return"
22         help
23 -         Use BX instruction for THUMB aware architectures.
24 +         Say 'y' to use BX to return from functions on your thumb-aware
25 +         processor. Say 'y' if you need to use interworking. Say 'n' if not.
26 +         It is safe to say 'y' even if you're not doing interworking.
27 --- a/libc/sysdeps/linux/arm/bits/arm_asm.h
28 +++ b/libc/sysdeps/linux/arm/bits/arm_asm.h
29 @@ -24,5 +24,12 @@
30  #define THUMB1_ONLY 1
31  #endif
32  
33 -#endif /* _ARM_ASM_H */
34 +#if defined(__USE_BX__)
35 +# if (   defined (__ARM_ARCH_2__)  || defined (__ARM_ARCH_3__) \
36 +      || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
37 +     )
38 +#  error Use of BX was requested, but is not available on the target processor.
39 +# endif /* ARCH level */
40 +#endif /* __USE_BX__ */
41  
42 +#endif /* _ARM_ASM_H */