gcc: Fix libssh_nonshared linker specs for ppc/musl

The change to link libssp_nonshared.a only for musl was to move
spec file changes to config/linux.h under a conditional when
DEFAULT_LIBC == LIBC_MUSL which worked fine for all but ppc
since gcc for ppc provided its own linux.h overrides which are
used. This patch duplicates the change in those headers too

(From OE-Core rev: 9d39168a6acfa1f289a4448271c0bf9caaea10ec)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj
2017-07-05 10:34:44 -07:00
committed by Richard Purdie
parent 2a44efbe83
commit c08247e3c7

View File

@@ -1,4 +1,4 @@
From 75a42d6d0f1f9784327f74882195a5c24843d5a8 Mon Sep 17 00:00:00 2001
From 210f6b3b82084cc756e02b8bc12f909a43b14ee8 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 27 Jun 2017 18:10:54 -0700
Subject: [PATCH 40/49] Add ssp_nonshared to link commandline for musl targets
@@ -17,18 +17,21 @@ Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/linux.h | 6 ++++++
1 file changed, 6 insertions(+)
gcc/config/linux.h | 7 +++++++
gcc/config/rs6000/linux.h | 10 ++++++++++
gcc/config/rs6000/linux64.h | 10 ++++++++++
3 files changed, 27 insertions(+)
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index 2e683d0c430..5ff0a2cb2ff 100644
index 2e683d0c430..1b4df798671 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -182,6 +182,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
@@ -182,6 +182,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
{ GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
}
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#undef LINK_SSP_SPEC
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
@@ -37,6 +40,48 @@ index 2e683d0c430..5ff0a2cb2ff 100644
#endif
#if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
index 684afd6c190..22cfa391b89 100644
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -91,6 +91,16 @@
" -m elf32ppclinux")
#endif
+/* link libssp_nonshared.a with musl */
+#if DEFAULT_LIBC == LIBC_MUSL
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#undef LINK_SSP_SPEC
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
+#endif
+#endif
+
#undef LINK_OS_LINUX_SPEC
#define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 3b00ec0fcf0..8371f8d7b6b 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -465,6 +465,16 @@ extern int dot_symbols;
" -m elf64ppc")
#endif
+/* link libssp_nonshared.a with musl */
+#if DEFAULT_LIBC == LIBC_MUSL
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#undef LINK_SSP_SPEC
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
+#endif
+#endif
+
#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
--
2.13.2