f39ff5246897c94eb2aed13f5b44843aae091704
[oweals/openwrt.git] / toolchain / gcc / patches / 4.8-linaro / 201-musl_arm.patch
1 --- a/gcc/config/arm/linux-eabi.h
2 +++ b/gcc/config/arm/linux-eabi.h
3 @@ -77,6 +77,23 @@
4      %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
5      %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
6  
7 +/* For ARM musl currently supports four dynamic linkers:
8 +   - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
9 +   - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
10 +   - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
11 +   - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
12 +   musl does not support the legacy OABI mode.
13 +   All the dynamic linkers live in /lib.
14 +   We default to soft-float, EL. */
15 +#undef  MUSL_DYNAMIC_LINKER
16 +#if TARGET_BIG_ENDIAN_DEFAULT
17 +#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
18 +#else
19 +#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
20 +#endif
21 +#define MUSL_DYNAMIC_LINKER \
22 +  "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
23 +
24  /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
25     use the GNU/Linux version, not the generic BPABI version.  */
26  #undef  LINK_SPEC
27 --- a/libitm/config/arm/hwcap.cc
28 +++ b/libitm/config/arm/hwcap.cc
29 @@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
30  
31  #ifdef __linux__
32  #include <unistd.h>
33 +#ifdef __GLIBC__
34  #include <sys/fcntl.h>
35 +#else
36 +#include <fcntl.h>
37 +#endif
38  #include <elf.h>
39  
40  static void __attribute__((constructor))