summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2017-07-05 10:34:44 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-14 07:54:05 -0700
commit5ed61141e10b13bb9731c0d6398d3f30d6f7a65d (patch)
tree7c090f0ce896ffe5bcfacd49c93a1177ef4ee680
parenta678744d32fecd002838a328c1f59145c9d5ad06 (diff)
downloadpoky-5ed61141e10b13bb9731c0d6398d3f30d6f7a65d.tar.gz
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 Cherry-picked from oe-core master 9d39168a6acfa1f289a4448271c0bf9caaea10ec (From OE-Core rev: 9d265f398a97dccb19811b048b1f4a2dd9d3fdd5) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-6.3/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch55
1 files changed, 50 insertions, 5 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-6.3/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta/recipes-devtools/gcc/gcc-6.3/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
index 310f7aacba..29b7ce72d2 100644
--- a/meta/recipes-devtools/gcc/gcc-6.3/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
+++ b/meta/recipes-devtools/gcc/gcc-6.3/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
@@ -1,4 +1,4 @@
1From 75a42d6d0f1f9784327f74882195a5c24843d5a8 Mon Sep 17 00:00:00 2001 1From 210f6b3b82084cc756e02b8bc12f909a43b14ee8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Jun 2017 18:10:54 -0700 3Date: Tue, 27 Jun 2017 18:10:54 -0700
4Subject: [PATCH 40/49] Add ssp_nonshared to link commandline for musl targets 4Subject: [PATCH 40/49] Add ssp_nonshared to link commandline for musl targets
@@ -17,18 +17,21 @@ Upstream-Status: Pending
17 17
18Signed-off-by: Khem Raj <raj.khem@gmail.com> 18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19--- 19---
20 gcc/config/linux.h | 6 ++++++ 20 gcc/config/linux.h | 7 +++++++
21 1 file changed, 6 insertions(+) 21 gcc/config/rs6000/linux.h | 10 ++++++++++
22 gcc/config/rs6000/linux64.h | 10 ++++++++++
23 3 files changed, 27 insertions(+)
22 24
23diff --git a/gcc/config/linux.h b/gcc/config/linux.h 25diff --git a/gcc/config/linux.h b/gcc/config/linux.h
24index 2e683d0c430..5ff0a2cb2ff 100644 26index 2e683d0c430..1b4df798671 100644
25--- a/gcc/config/linux.h 27--- a/gcc/config/linux.h
26+++ b/gcc/config/linux.h 28+++ b/gcc/config/linux.h
27@@ -182,6 +182,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 29@@ -182,6 +182,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
28 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ 30 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
29 { 0, 0, 0, 0, 0, 0 } \ 31 { 0, 0, 0, 0, 0, 0 } \
30 } 32 }
31+#ifdef TARGET_LIBC_PROVIDES_SSP 33+#ifdef TARGET_LIBC_PROVIDES_SSP
34+#undef LINK_SSP_SPEC
32+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ 35+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
33+ "|fstack-protector-strong|fstack-protector-explicit" \ 36+ "|fstack-protector-strong|fstack-protector-explicit" \
34+ ":-lssp_nonshared}" 37+ ":-lssp_nonshared}"
@@ -37,6 +40,48 @@ index 2e683d0c430..5ff0a2cb2ff 100644
37 #endif 40 #endif
38 41
39 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ 42 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
43diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
44index 684afd6c190..22cfa391b89 100644
45--- a/gcc/config/rs6000/linux.h
46+++ b/gcc/config/rs6000/linux.h
47@@ -91,6 +91,16 @@
48 " -m elf32ppclinux")
49 #endif
50
51+/* link libssp_nonshared.a with musl */
52+#if DEFAULT_LIBC == LIBC_MUSL
53+#ifdef TARGET_LIBC_PROVIDES_SSP
54+#undef LINK_SSP_SPEC
55+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
56+ "|fstack-protector-strong|fstack-protector-explicit" \
57+ ":-lssp_nonshared}"
58+#endif
59+#endif
60+
61 #undef LINK_OS_LINUX_SPEC
62 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
63 %{rdynamic:-export-dynamic} \
64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
65index 3b00ec0fcf0..8371f8d7b6b 100644
66--- a/gcc/config/rs6000/linux64.h
67+++ b/gcc/config/rs6000/linux64.h
68@@ -465,6 +465,16 @@ extern int dot_symbols;
69 " -m elf64ppc")
70 #endif
71
72+/* link libssp_nonshared.a with musl */
73+#if DEFAULT_LIBC == LIBC_MUSL
74+#ifdef TARGET_LIBC_PROVIDES_SSP
75+#undef LINK_SSP_SPEC
76+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
77+ "|fstack-protector-strong|fstack-protector-explicit" \
78+ ":-lssp_nonshared}"
79+#endif
80+#endif
81+
82 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
83 %{rdynamic:-export-dynamic} \
84 -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
40-- 85--
412.13.2 862.13.2
42 87