# HG changeset patch # Parent 7626e1f2b51fb2ee53358cab627ef4d3206cd75a Support for powerpc-linux-musl. diff -r 7626e1f2b51f gcc/config.gcc --- a/gcc/config.gcc Thu Jan 29 13:41:55 2015 -0500 +++ b/gcc/config.gcc Thu Jan 29 13:41:57 2015 -0500 @@ -2138,6 +2138,10 @@ powerpc*-*-linux*paired*) tm_file="${tm_file} rs6000/750cl.h" ;; esac + case ${target} in + *-linux*-musl*) + enable_secureplt=yes ;; + esac if test x${enable_secureplt} = xyes; then tm_file="rs6000/secureplt.h ${tm_file}" fi diff -r 7626e1f2b51f gcc/config/rs6000/linux64.h --- a/gcc/config/rs6000/linux64.h Thu Jan 29 13:41:55 2015 -0500 +++ b/gcc/config/rs6000/linux64.h Thu Jan 29 13:41:57 2015 -0500 @@ -374,17 +374,21 @@ #endif #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" +#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1" +#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1" #if DEFAULT_LIBC == LIBC_UCLIBC -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" #elif DEFAULT_LIBC == LIBC_GLIBC -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" +#elif DEFAULT_LIBC == LIBC_MUSL +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" #else #error "Unsupported DEFAULT_LIBC" #endif #define GNU_USER_DYNAMIC_LINKER32 \ - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) #define GNU_USER_DYNAMIC_LINKER64 \ - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64) + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) #undef DEFAULT_ASM_ENDIAN #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) diff -r 7626e1f2b51f gcc/config/rs6000/secureplt.h --- a/gcc/config/rs6000/secureplt.h Thu Jan 29 13:41:55 2015 -0500 +++ b/gcc/config/rs6000/secureplt.h Thu Jan 29 13:41:57 2015 -0500 @@ -18,3 +18,4 @@ . */ #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt" +#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt" diff -r 7626e1f2b51f gcc/config/rs6000/sysv4.h --- a/gcc/config/rs6000/sysv4.h Thu Jan 29 13:41:55 2015 -0500 +++ b/gcc/config/rs6000/sysv4.h Thu Jan 29 13:41:57 2015 -0500 @@ -537,6 +537,9 @@ #ifndef CC1_SECURE_PLT_DEFAULT_SPEC #define CC1_SECURE_PLT_DEFAULT_SPEC "" #endif +#ifndef LINK_SECURE_PLT_DEFAULT_SPEC +#define LINK_SECURE_PLT_DEFAULT_SPEC "" +#endif /* Pass -G xxx to the compiler. */ #define CC1_SPEC "%{G*} %(cc1_cpu)" \ @@ -585,7 +588,8 @@ /* Override the default target of the linker. */ #define LINK_TARGET_SPEC \ - ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") + ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \ + "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}" /* Any specific OS flags. */ #define LINK_OS_SPEC "\ @@ -763,15 +767,18 @@ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1" #if DEFAULT_LIBC == LIBC_UCLIBC -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" +#elif DEFAULT_LIBC == LIBC_MUSL +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC -#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" +#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" #else #error "Unsupported DEFAULT_LIBC" #endif #define GNU_USER_DYNAMIC_LINKER \ - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) + CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ %{rdynamic:-export-dynamic} \ @@ -894,6 +901,7 @@ { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ + { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \ { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \