aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-6.3/0041-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
blob: 310f7aacbaccf73d720054c8573cca5c86f0f7d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 75a42d6d0f1f9784327f74882195a5c24843d5a8 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

when -fstack-protector options are enabled we need to
link with ssp_shared on musl since it does not provide
the __stack_chk_fail_local() so essentially it provides
libssp but not libssp_nonshared something like
TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED
 where-as for glibc the needed symbols
are already present in libc_nonshared library therefore
we do not need any library helper on glibc based systems
but musl needs the libssp_noshared from gcc

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 gcc/config/linux.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index 2e683d0c430..5ff0a2cb2ff 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
     { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 },		\
     { 0, 0, 0, 0, 0, 0 }				\
   }
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+		       "|fstack-protector-strong|fstack-protector-explicit" \
+		       ":-lssp_nonshared}"
+#endif
+
 #endif
 
 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
-- 
2.13.2