diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-02-02 10:32:49 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-07 17:29:59 +0000 |
commit | 8d57d1d8def66510d1a330f18761509ce014e148 (patch) | |
tree | 90ac13ab9f7d159ff42eb5758454e439512b8c72 /meta | |
parent | eb134c6ee6cab23ca01b699d3ca08b7ffd021cb2 (diff) | |
download | poky-8d57d1d8def66510d1a330f18761509ce014e148.tar.gz |
gcc: Fix build on musl with -fstack-protector
When enabling the secutity flags on musl based targets the builds fail
due to libssp(gcc-runtime) build asking to link with libssp and
libssp_nonshared.a when configuring libssp itself. This does not work
with musl since it does provide ssp implementation but not like glibc
where these libraries are separate to libc
Fix the nios2 patch with upstream status while at it and generate the
patch after applying to my tree
(From OE-Core rev: 77fb841f2e747dc7fb5e9234d870a7a32a74d09b)
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>
Diffstat (limited to 'meta')
4 files changed, 59 insertions, 12 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-5.3.inc b/meta/recipes-devtools/gcc/gcc-5.3.inc index 80999c1111..e12bfad1e3 100644 --- a/meta/recipes-devtools/gcc/gcc-5.3.inc +++ b/meta/recipes-devtools/gcc/gcc-5.3.inc | |||
@@ -76,7 +76,8 @@ SRC_URI = "\ | |||
76 | file://0044-Adding-mmusl-as-a-musl-libc-specifier-and-the-necess.patch \ | 76 | file://0044-Adding-mmusl-as-a-musl-libc-specifier-and-the-necess.patch \ |
77 | file://0045-Support-for-arm-linux-musl.patch \ | 77 | file://0045-Support-for-arm-linux-musl.patch \ |
78 | file://0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch \ | 78 | file://0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch \ |
79 | file://0047-Fix-nios2-musl-build.patch \ | 79 | file://0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch \ |
80 | file://0048-ssp_nonshared.patch \ | ||
80 | " | 81 | " |
81 | 82 | ||
82 | BACKPORTS = "" | 83 | BACKPORTS = "" |
diff --git a/meta/recipes-devtools/gcc/gcc-5.3/0047-Fix-nios2-musl-build.patch b/meta/recipes-devtools/gcc/gcc-5.3/0047-Fix-nios2-musl-build.patch deleted file mode 100644 index 44cea8485f..0000000000 --- a/meta/recipes-devtools/gcc/gcc-5.3/0047-Fix-nios2-musl-build.patch +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | diff -Naru gcc-5.3.0.orig/gcc/config/nios2/linux.h gcc-5.3.0/gcc/config/nios2/linux.h | ||
2 | --- gcc-5.3.0.orig/gcc/config/nios2/linux.h 2015-05-28 16:08:37.000000000 +0200 | ||
3 | +++ gcc-5.3.0/gcc/config/nios2/linux.h 2016-01-04 02:42:46.878844806 +0100 | ||
4 | @@ -30,6 +30,7 @@ | ||
5 | #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" | ||
6 | |||
7 | #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1" | ||
8 | +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1" | ||
9 | |||
10 | #undef LINK_SPEC | ||
11 | #define LINK_SPEC LINK_SPEC_ENDIAN \ | ||
diff --git a/meta/recipes-devtools/gcc/gcc-5.3/0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch b/meta/recipes-devtools/gcc/gcc-5.3/0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch new file mode 100644 index 0000000000..a1cfb9c7a0 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-5.3/0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From f5ca07132b9292d2045ca7204e9cbfde2e59d0bf Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 2 Feb 2016 10:26:10 -0800 | ||
4 | Subject: [PATCH 47/48] nios2: Define MUSL_DYNAMIC_LINKER | ||
5 | |||
6 | Signed-off-by: Marek Vasut <marex@denx.de> | ||
7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
8 | --- | ||
9 | Upstream-Status: Pending | ||
10 | |||
11 | gcc/config/nios2/linux.h | 1 + | ||
12 | 1 file changed, 1 insertion(+) | ||
13 | |||
14 | diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h | ||
15 | index f43f655..5587ab3 100644 | ||
16 | --- a/gcc/config/nios2/linux.h | ||
17 | +++ b/gcc/config/nios2/linux.h | ||
18 | @@ -30,6 +30,7 @@ | ||
19 | #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" | ||
20 | |||
21 | #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1" | ||
22 | +#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1" | ||
23 | |||
24 | #undef LINK_SPEC | ||
25 | #define LINK_SPEC LINK_SPEC_ENDIAN \ | ||
26 | -- | ||
27 | 2.7.0 | ||
28 | |||
diff --git a/meta/recipes-devtools/gcc/gcc-5.3/0048-ssp_nonshared.patch b/meta/recipes-devtools/gcc/gcc-5.3/0048-ssp_nonshared.patch new file mode 100644 index 0000000000..5ddd40a4aa --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-5.3/0048-ssp_nonshared.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From 3cb6013cf287ed9b1247ea37541e64b9810a121d Mon Sep 17 00:00:00 2001 | ||
2 | From: Szabolcs Nagy <nsz@port70.net> | ||
3 | Date: Sat, 7 Nov 2015 14:58:40 +0000 | ||
4 | Subject: [PATCH 48/48] ssp_nonshared | ||
5 | |||
6 | --- | ||
7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
8 | Upstream-Status: Pending | ||
9 | |||
10 | gcc/gcc.c | 3 ++- | ||
11 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/gcc/gcc.c b/gcc/gcc.c | ||
14 | index 8f53aea..3ddc658 100644 | ||
15 | --- a/gcc/gcc.c | ||
16 | +++ b/gcc/gcc.c | ||
17 | @@ -732,7 +732,8 @@ proper position among the other output files. */ | ||
18 | #ifndef LINK_SSP_SPEC | ||
19 | #ifdef TARGET_LIBC_PROVIDES_SSP | ||
20 | #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ | ||
21 | - "|fstack-protector-strong|fstack-protector-explicit:}" | ||
22 | + "|fstack-protector-strong|fstack-protector-explicit" \ | ||
23 | + ":-lssp_nonshared}" | ||
24 | #else | ||
25 | #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ | ||
26 | "|fstack-protector-strong|fstack-protector-explicit" \ | ||
27 | -- | ||
28 | 2.7.0 | ||
29 | |||