summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-07-19 17:46:56 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-26 08:56:29 +0100
commit57bb38d26383696d30e5c1e25826eceb11688282 (patch)
tree63304eee6f92352b2d842a9e0f4bd42451300bc6 /meta/recipes-devtools/gcc
parent13ee352a1ffef8aa4c92fb7ba414dcd41c9ab499 (diff)
downloadpoky-57bb38d26383696d30e5c1e25826eceb11688282.tar.gz
gcc: Fix libgcc unresolved symbols with PIE on musl
Fixes [YOCTO #9772] (From OE-Core rev: f96da00e78999899ea7037ebc9547a87023e309a) 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/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-6.1.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc-6.1/0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch85
2 files changed, 86 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-6.1.inc b/meta/recipes-devtools/gcc/gcc-6.1.inc
index afeeff4c51..0426028d79 100644
--- a/meta/recipes-devtools/gcc/gcc-6.1.inc
+++ b/meta/recipes-devtools/gcc/gcc-6.1.inc
@@ -78,6 +78,7 @@ SRC_URI = "\
78 file://0044-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch \ 78 file://0044-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch \
79 file://0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \ 79 file://0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \
80 file://0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \ 80 file://0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
81 file://0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
81 ${BACKPORTS} \ 82 ${BACKPORTS} \
82 file://CVE-2016-4490.patch \ 83 file://CVE-2016-4490.patch \
83" 84"
diff --git a/meta/recipes-devtools/gcc/gcc-6.1/0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta/recipes-devtools/gcc/gcc-6.1/0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
new file mode 100644
index 0000000000..ed6cd6905c
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-6.1/0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
@@ -0,0 +1,85 @@
1From 0a9ed0479203cb7e69c3745b0c259007410f39ba Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH 47/47] libgcc_s: Use alias for __cpu_indicator_init instead of
5 symver
6
7Adapter from
8
9https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
10
11This fix was debated but hasnt been applied gcc upstream since
12they expect musl to support '@' in symbol versioning which is
13a sun/gnu versioning extention. This patch however avoids the
14need for the '@' symbols at all
15
16libgcc/Changelog:
17
182015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
19
20 * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
21 (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
22
23 * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
24
25gcc/Changelog:
26
272015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
28
29 * config/i386/i386.c (ix86_expand_builtin): Make __builtin_cpu_init
30 call __cpu_indicator_init_local instead of __cpu_indicator_init.
31
32Signed-off-by: Khem Raj <raj.khem@gmail.com>
33---
34Upstream-Status: Rejected
35
36 gcc/config/i386/i386.c | 4 ++--
37 libgcc/config/i386/cpuinfo.c | 6 +++---
38 libgcc/config/i386/t-linux | 2 +-
39 3 files changed, 6 insertions(+), 6 deletions(-)
40
41diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
42index 861a029..1c97d72 100644
43--- a/gcc/config/i386/i386.c
44+++ b/gcc/config/i386/i386.c
45@@ -40323,10 +40323,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
46 {
47 case IX86_BUILTIN_CPU_INIT:
48 {
49- /* Make it call __cpu_indicator_init in libgcc. */
50+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
51 tree call_expr, fndecl, type;
52 type = build_function_type_list (integer_type_node, NULL_TREE);
53- fndecl = build_fn_decl ("__cpu_indicator_init", type);
54+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
55 call_expr = build_call_expr (fndecl, 0);
56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
57 }
58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
59index 8c2248d..6c82f15 100644
60--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c
62@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
63 return 0;
64 }
65
66-#if defined SHARED && defined USE_ELF_SYMVER
67-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
68-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
69+#ifndef SHARED
70+int __cpu_indicator_init_local (void)
71+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
72 #endif
73diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
74index 11bb46e..4f47f7b 100644
75--- a/libgcc/config/i386/t-linux
76+++ b/libgcc/config/i386/t-linux
77@@ -3,4 +3,4 @@
78 # t-slibgcc-elf-ver and t-linux
79 SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
80
81-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER
82+HOST_LIBGCC2_CFLAGS += -mlong-double-80
83--
842.9.0
85