1 Add support for musl on ppc32
3 Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
5 diff -Nur gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h gcc-5.4.0/gcc/config/rs6000/sysv4.h
6 --- gcc-5.4.0.orig/gcc/config/rs6000/sysv4.h 2015-09-24 15:46:45.000000000 +0200
7 +++ gcc-5.4.0/gcc/config/rs6000/sysv4.h 2016-11-27 13:12:33.226953738 +0100
9 #ifndef CC1_SECURE_PLT_DEFAULT_SPEC
10 #define CC1_SECURE_PLT_DEFAULT_SPEC ""
12 +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
13 +#define LINK_SECURE_PLT_DEFAULT_SPEC ""
16 /* Pass -G xxx to the compiler. */
20 #define LINK_START_LINUX_SPEC ""
22 +#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
24 #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
25 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
26 +#define MUSL_DYNAMIC_LINKER \
27 + "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
28 #if DEFAULT_LIBC == LIBC_UCLIBC
29 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
30 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
31 +#elif DEFAULT_LIBC == LIBC_MUSL
32 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
33 #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
34 -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
35 +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
37 #error "Unsupported DEFAULT_LIBC"
39 #define GNU_USER_DYNAMIC_LINKER \
40 - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
41 + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
43 #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
44 %{rdynamic:-export-dynamic} \
46 { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
47 { "link_os_default", LINK_OS_DEFAULT_SPEC }, \
48 { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
49 + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
50 { "cpp_os_ads", CPP_OS_ADS_SPEC }, \
51 { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
52 { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
53 diff -Nur gcc-5.4.0.orig/gcc/config/rs6000/sysv4le.h gcc-5.4.0/gcc/config/rs6000/sysv4le.h
54 --- gcc-5.4.0.orig/gcc/config/rs6000/sysv4le.h 2015-09-24 15:46:45.000000000 +0200
55 +++ gcc-5.4.0/gcc/config/rs6000/sysv4le.h 2016-11-27 13:12:33.226953738 +0100
57 /* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default. */
58 #define LINUX64_DEFAULT_ABI_ELFv2
60 +#undef MUSL_DYNAMIC_LINKER_E
61 +#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","le")
62 diff -Nur gcc-5.4.0.orig/gcc/config.gcc gcc-5.4.0/gcc/config.gcc
63 --- gcc-5.4.0.orig/gcc/config.gcc 2015-09-10 16:17:53.000000000 +0200
64 +++ gcc-5.4.0/gcc/config.gcc 2016-11-27 13:14:17.149638148 +0100
65 @@ -2413,6 +2413,10 @@
66 powerpc*-*-linux*paired*)
67 tm_file="${tm_file} rs6000/750cl.h" ;;
70 + powerpc*-*-linux*-musl*)
71 + enable_secureplt=yes ;;
73 if test x${enable_secureplt} = xyes; then
74 tm_file="rs6000/secureplt.h ${tm_file}"