summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch198
1 files changed, 198 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch b/meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch
new file mode 100644
index 0000000000..3dadb9504f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.2/0045-musl-dynamic-linker.patch
@@ -0,0 +1,198 @@
1# HG changeset patch
2# Parent 6738fd6f6fcc2a72f2ba527bda3325642af26885
3Support for arm-linux-musl.
4
5Upstream-Status: backport [partial]
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8
9Index: gcc-5.1.0/gcc/config/arm/linux-eabi.h
10===================================================================
11--- gcc-5.1.0.orig/gcc/config/arm/linux-eabi.h
12+++ gcc-5.1.0/gcc/config/arm/linux-eabi.h
13@@ -81,6 +81,23 @@
14 #undef TARGET_FIX_V4BX_SPEC
15 #define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
16
17+/* For ARM musl currently supports four dynamic linkers:
18+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
19+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
20+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
21+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
22+ musl does not support the legacy OABI mode.
23+ All the dynamic linkers live in /lib.
24+ We default to soft-float, EL. */
25+#undef MUSL_DYNAMIC_LINKER
26+#if TARGET_BIG_ENDIAN_DEFAULT
27+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
28+#else
29+#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
30+#endif
31+#define MUSL_DYNAMIC_LINKER \
32+ SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
33+
34 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
35 use the GNU/Linux version, not the generic BPABI version. */
36 #undef LINK_SPEC
37Index: gcc-5.1.0/libitm/config/arm/hwcap.cc
38===================================================================
39--- gcc-5.1.0.orig/libitm/config/arm/hwcap.cc
40+++ gcc-5.1.0/libitm/config/arm/hwcap.cc
41@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
42
43 #ifdef __linux__
44 #include <unistd.h>
45+#ifdef __GLIBC__
46 #include <sys/fcntl.h>
47+#else
48+#include <fcntl.h>
49+#endif
50 #include <elf.h>
51
52 static void __attribute__((constructor))
53Index: gcc-5.1.0/gcc/config/i386/linux.h
54===================================================================
55--- gcc-5.1.0.orig/gcc/config/i386/linux.h
56+++ gcc-5.1.0/gcc/config/i386/linux.h
57@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
58
59 #define GNU_USER_LINK_EMULATION "elf_i386"
60 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
61+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1"
62Index: gcc-5.1.0/gcc/config/i386/linux64.h
63===================================================================
64--- gcc-5.1.0.orig/gcc/config/i386/linux64.h
65+++ gcc-5.1.0/gcc/config/i386/linux64.h
66@@ -30,3 +30,8 @@ see the files COPYING3 and COPYING.RUNTI
67 #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
68 #define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
69 #define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
70+
71+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1"
72+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1"
73+#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
74+
75Index: gcc-5.1.0/gcc/config/mips/linux.h
76===================================================================
77--- gcc-5.1.0.orig/gcc/config/mips/linux.h
78+++ gcc-5.1.0/gcc/config/mips/linux.h
79@@ -21,6 +21,10 @@ along with GCC; see the file COPYING3.
80 #define GNU_USER_LINK_EMULATION64 "elf64%{EB:b}%{EL:l}tsmip"
81 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
82
83+#define MUSL_DYNAMIC_LINKERN32 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
84+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
85+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-mips.so.1"
86+
87 #define GLIBC_DYNAMIC_LINKER32 \
88 "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
89 #define GLIBC_DYNAMIC_LINKER64 \
90@@ -40,4 +44,4 @@ along with GCC; see the file COPYING3.
91 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
92 #define GNU_USER_DYNAMIC_LINKERN32 \
93 CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
94- BIONIC_DYNAMIC_LINKERN32)
95+ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
96Index: gcc-5.1.0/gcc/config/rs6000/linux64.h
97===================================================================
98--- gcc-5.1.0.orig/gcc/config/rs6000/linux64.h
99+++ gcc-5.1.0/gcc/config/rs6000/linux64.h
100@@ -365,17 +365,22 @@ extern int dot_symbols;
101 #endif
102 #define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
103 #define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
104+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-powerpc.so.1"
105+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-powerpc64.so.1"
106+
107 #if DEFAULT_LIBC == LIBC_UCLIBC
108-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
109+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
110 #elif DEFAULT_LIBC == LIBC_GLIBC
111-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
112+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
113+#elif DEFAULT_LIBC == LIBC_MUSL
114+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
115 #else
116 #error "Unsupported DEFAULT_LIBC"
117 #endif
118 #define GNU_USER_DYNAMIC_LINKER32 \
119- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
120+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
121 #define GNU_USER_DYNAMIC_LINKER64 \
122- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
123+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
124
125 #undef DEFAULT_ASM_ENDIAN
126 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
127Index: gcc-5.1.0/gcc/config/rs6000/sysv4.h
128===================================================================
129--- gcc-5.1.0.orig/gcc/config/rs6000/sysv4.h
130+++ gcc-5.1.0/gcc/config/rs6000/sysv4.h
131@@ -769,15 +769,19 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
132
133 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
134 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
135+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
136+
137 #if DEFAULT_LIBC == LIBC_UCLIBC
138-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
139+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
140+#elif DEFAULT_LIBC == LIBC_MUSL
141+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
142 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
143-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
144+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
145 #else
146 #error "Unsupported DEFAULT_LIBC"
147 #endif
148 #define GNU_USER_DYNAMIC_LINKER \
149- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
150+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
151
152 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
153 %{rdynamic:-export-dynamic} \
154Index: gcc-5.1.0/libitm/config/linux/x86/tls.h
155===================================================================
156--- gcc-5.1.0.orig/libitm/config/linux/x86/tls.h
157+++ gcc-5.1.0/libitm/config/linux/x86/tls.h
158@@ -25,16 +25,19 @@
159 #ifndef LIBITM_X86_TLS_H
160 #define LIBITM_X86_TLS_H 1
161
162-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
163+#if defined(__GLIBC_PREREQ)
164+#if __GLIBC_PREREQ(2, 10)
165 /* Use slots in the TCB head rather than __thread lookups.
166 GLIBC has reserved words 10 through 13 for TM. */
167 #define HAVE_ARCH_GTM_THREAD 1
168 #define HAVE_ARCH_GTM_THREAD_DISP 1
169 #endif
170+#endif
171
172 #include "config/generic/tls.h"
173
174-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
175+#if defined(__GLIBC_PREREQ)
176+#if __GLIBC_PREREQ(2, 10)
177 namespace GTM HIDDEN {
178
179 #ifdef __x86_64__
180@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
181
182 } // namespace GTM
183 #endif /* >= GLIBC 2.10 */
184+#endif
185
186 #endif // LIBITM_X86_TLS_H
187Index: gcc-5.1.0/gcc/config/aarch64/aarch64-linux.h
188===================================================================
189--- gcc-5.1.0.orig/gcc/config/aarch64/aarch64-linux.h
190+++ gcc-5.1.0/gcc/config/aarch64/aarch64-linux.h
191@@ -22,6 +22,7 @@
192 #define GCC_AARCH64_LINUX_H
193
194 #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
195+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64.so.1"
196
197 #undef ASAN_CC1_SPEC
198 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"