0f81020b97
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 46313
101 lines
4.2 KiB
Diff
101 lines
4.2 KiB
Diff
--- a/gcc/config.gcc
|
|
+++ b/gcc/config.gcc
|
|
@@ -2344,6 +2344,10 @@ powerpc*-*-linux*)
|
|
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
|
|
--- a/gcc/config/rs6000/linux64.h
|
|
+++ b/gcc/config/rs6000/linux64.h
|
|
@@ -371,17 +371,21 @@ extern int dot_symbols;
|
|
#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%{msoft-float:-sf}.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)
|
|
--- a/gcc/config/rs6000/secureplt.h
|
|
+++ b/gcc/config/rs6000/secureplt.h
|
|
@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3.
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
|
|
+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
|
|
--- a/gcc/config/rs6000/sysv4.h
|
|
+++ b/gcc/config/rs6000/sysv4.h
|
|
@@ -537,6 +537,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
|
|
#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 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
|
|
|
|
/* 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 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
|
|
|
|
#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%{msoft-float:-sf}.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 @@ ncrtn.o%s"
|
|
{ "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 }, \
|