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