autodetect ARM variant/ABI setup based on the compiler settings
[openwrt/staging/chunkeey.git] / toolchain / uClibc / patches-0.9.32 / 960-remove_eabi_oabi_selection.patch
1 Rely on the compiler to be properly setup for the default ABI.
2
3 When installing-headers, there are two cases:
4 - NPTL: no issue, a cross-compiler is already expected
5 - LinuxThreads: no issue, EABI/OABI has no impact on installed headers.
6
7 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
8 Cc: Khem Raj <raj.khem@gmail.com>
9 Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
10 Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
11 ---
12 extra/Configs/Config.arm | 11 -----------
13 libc/sysdeps/linux/arm/Makefile.arch | 9 +++++++--
14 libc/sysdeps/linux/arm/bits/huge_val.h | 4 ++--
15 3 files changed, 9 insertions(+), 15 deletions(-)
16
17 diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
18 index 9aa9e56..85f2515 100644
19 --- a/extra/Configs/Config.arm
20 +++ b/extra/Configs/Config.arm
21 @@ -12,17 +12,6 @@ config FORCE_OPTIONS_FOR_ARCH
22 default y
23 select ARCH_ANY_ENDIAN
24
25 -config CONFIG_ARM_EABI
26 - bool "Build for EABI"
27 - help
28 - If you say 'y' here, functions and constants required by the
29 - ARM EABI will be built into the library. You should say 'y'
30 - if your compiler uses the ARM EABI, in which case you will also
31 - need a kernel supporting the EABI system call interface.
32 -
33 - If you say 'n' here, then the library will be built for the
34 - old Linux ABI.
35 -
36 config COMPILE_IN_THUMB_MODE
37 bool "Build using Thumb mode"
38 select USE_BX
39 diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch
40 index b53c539..14279e0 100644
41 --- a/libc/sysdeps/linux/arm/Makefile.arch
42 +++ b/libc/sysdeps/linux/arm/Makefile.arch
43 @@ -24,7 +24,12 @@ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
44 CSRC += posix_fadvise.c posix_fadvise64.c
45 endif
46
47 -ifeq ($(CONFIG_ARM_EABI),y)
48 +# Is our compiler set up for EABI ?
49 +IS_EABI:=$(shell $(CC) $(CFLAGS) -x c - -E -dM </dev/null 2>/dev/null \
50 + |sed -r -e '/^\#[[:space:]]*define[[:space:]]+__ARM_EABI__([[:space:]]+1)?$$/!d; s/.+/y/;' \
51 + )
52 +
53 +ifeq ($(IS_EABI),y)
54 CSRC += aeabi_assert.c aeabi_atexit.c aeabi_errno_addr.c \
55 aeabi_localeconv.c aeabi_memclr.c aeabi_memcpy.c \
56 aeabi_memmove.c aeabi_memset.c find_exidx.c
57 @@ -37,7 +42,7 @@ else
58 CSRC += syscall.c
59 endif
60
61 -ifeq ($(CONFIG_ARM_EABI),y)
62 +ifeq ($(IS_EABI),y)
63 libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \
64 $(ARCH_OUT)/aeabi_sighandlers.o
65 libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \
66 diff --git a/libc/sysdeps/linux/arm/bits/huge_val.h b/libc/sysdeps/linux/arm/bits/huge_val.h
67 index a215f3c..745e0bb 100644
68 --- a/libc/sysdeps/linux/arm/bits/huge_val.h
69 +++ b/libc/sysdeps/linux/arm/bits/huge_val.h
70 @@ -32,7 +32,7 @@
71 # define HUGE_VAL (__extension__ 0x1.0p2047)
72 #elif defined __GNUC__
73
74 -#ifndef __CONFIG_ARM_EABI__
75 +#ifndef __ARM_EABI__
76 # define HUGE_VAL \
77 (__extension__ \
78 ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
79 @@ -50,7 +50,7 @@
80
81 typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
82
83 -#ifndef __CONFIG_ARM_EABI__
84 +#ifndef __ARM_EABI__
85 # if __BYTE_ORDER == __BIG_ENDIAN
86 # define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
87 # endif
88 --
89 1.7.1
90