diff options
author | Khem Raj <raj.khem@gmail.com> | 2017-06-27 19:11:44 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-08 13:34:45 +0100 |
commit | dc3b3a8df3297367e9386dd3ac098b64f7f46d06 (patch) | |
tree | 554209a5ed207ee22c1506313e2f820fa84d52d4 /meta/recipes-devtools/gcc/gcc-7.1/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch | |
parent | fb3be142ce224ba972e3217cf6938373c6f081b5 (diff) | |
download | poky-dc3b3a8df3297367e9386dd3ac098b64f7f46d06.tar.gz |
gcc: Link libssp_nonshared.a only on musl targets
glibc already provides the content for libssp_nonshared
in libc_nonshared.a therefore we dont need to make it
universal.
This also fixed build issues on glibc when linking statically
and using -fstack-protector
Fixed errors like
/mnt/a/oe/build/tmp/work/i586-bec-linux/aufs-util/3.14+gitAUTOINC+bdfcc0dcfc-r0/recipe-sysroot/usr/lib/../lib/libc.a(stack_chk_fail.o): In function `__stack_chk_fail': /usr/src/debug/glibc/2.26-r0/git/debug/stack_chk_fail.c:27: multiple definition of `__stack_chk_fail_local' /mnt/a/oe/build/tmp/work/i586-bec-linux/aufs-util/3.14+gitAUTOINC+bdfcc0dcfc-r0/recipe-sysroot/usr/lib/../lib/libssp_nonshared.a(libssp_nonshared_la-ssp-local.o):/usr/src/debug/gcc-runtime/7.1.0-r0/gcc-7.1.0/build.i586-bec-linux.i586-bec-linux/i586-bec-linux/libssp/../../../../../../../../work-shared/gcc-7.1.0-r0/gcc-7.1.0/libssp/ssp-local.c:47: first defined here collect2: error: ld returned 1 exit status
(From OE-Core rev: d71eba26850838b2878efea3f8c392a2eb2ebbfb)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-7.1/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-7.1/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-7.1/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta/recipes-devtools/gcc/gcc-7.1/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch new file mode 100644 index 0000000000..310f7aacba --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-7.1/0040-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | From 75a42d6d0f1f9784327f74882195a5c24843d5a8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 27 Jun 2017 18:10:54 -0700 | ||
4 | Subject: [PATCH 40/49] Add ssp_nonshared to link commandline for musl targets | ||
5 | |||
6 | when -fstack-protector options are enabled we need to | ||
7 | link with ssp_shared on musl since it does not provide | ||
8 | the __stack_chk_fail_local() so essentially it provides | ||
9 | libssp but not libssp_nonshared something like | ||
10 | TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED | ||
11 | where-as for glibc the needed symbols | ||
12 | are already present in libc_nonshared library therefore | ||
13 | we do not need any library helper on glibc based systems | ||
14 | but musl needs the libssp_noshared from gcc | ||
15 | |||
16 | Upstream-Status: Pending | ||
17 | |||
18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
19 | --- | ||
20 | gcc/config/linux.h | 6 ++++++ | ||
21 | 1 file changed, 6 insertions(+) | ||
22 | |||
23 | diff --git a/gcc/config/linux.h b/gcc/config/linux.h | ||
24 | index 2e683d0c430..5ff0a2cb2ff 100644 | ||
25 | --- a/gcc/config/linux.h | ||
26 | +++ b/gcc/config/linux.h | ||
27 | @@ -182,6 +182,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | ||
28 | { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ | ||
29 | { 0, 0, 0, 0, 0, 0 } \ | ||
30 | } | ||
31 | +#ifdef TARGET_LIBC_PROVIDES_SSP | ||
32 | +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ | ||
33 | + "|fstack-protector-strong|fstack-protector-explicit" \ | ||
34 | + ":-lssp_nonshared}" | ||
35 | +#endif | ||
36 | + | ||
37 | #endif | ||
38 | |||
39 | #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ | ||
40 | -- | ||
41 | 2.13.2 | ||
42 | |||