summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools
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-25 23:47:00 +0100
commitf96da00e78999899ea7037ebc9547a87023e309a (patch)
tree3abc56b86a9e178cd4dd384acfc2ade1b6d98f74 /meta/recipes-devtools
parent2a535deb4e080f464db1ffc40dfc53235fa13874 (diff)
downloadopenembedded-core-f96da00e78999899ea7037ebc9547a87023e309a.tar.gz
openembedded-core-f96da00e78999899ea7037ebc9547a87023e309a.tar.bz2
openembedded-core-f96da00e78999899ea7037ebc9547a87023e309a.zip
gcc: Fix libgcc unresolved symbols with PIE on musl
Fixes [YOCTO #9772] Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/recipes-devtools')
-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 = "\
file://0044-gcc-final.c-fdebug-prefix-map-support-to-remap-sourc.patch \
file://0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \
file://0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
+ file://0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
${BACKPORTS} \
file://CVE-2016-4490.patch \
"
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 @@
+From 0a9ed0479203cb7e69c3745b0c259007410f39ba Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Sat, 24 Oct 2015 20:09:53 +0000
+Subject: [PATCH 47/47] libgcc_s: Use alias for __cpu_indicator_init instead of
+ symver
+
+Adapter from
+
+https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
+
+This fix was debated but hasnt been applied gcc upstream since
+they expect musl to support '@' in symbol versioning which is
+a sun/gnu versioning extention. This patch however avoids the
+need for the '@' symbols at all
+
+libgcc/Changelog:
+
+2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
+ (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
+
+ * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
+
+gcc/Changelog:
+
+2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ * config/i386/i386.c (ix86_expand_builtin): Make __builtin_cpu_init
+ call __cpu_indicator_init_local instead of __cpu_indicator_init.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Rejected
+
+ gcc/config/i386/i386.c | 4 ++--
+ libgcc/config/i386/cpuinfo.c | 6 +++---
+ libgcc/config/i386/t-linux | 2 +-
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+index 861a029..1c97d72 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -40323,10 +40323,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
+ {
+ case IX86_BUILTIN_CPU_INIT:
+ {
+- /* Make it call __cpu_indicator_init in libgcc. */
++ /* Make it call __cpu_indicator_init_local in libgcc.a. */
+ tree call_expr, fndecl, type;
+ type = build_function_type_list (integer_type_node, NULL_TREE);
+- fndecl = build_fn_decl ("__cpu_indicator_init", type);
++ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
+ call_expr = build_call_expr (fndecl, 0);
+ return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
+ }
+diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
+index 8c2248d..6c82f15 100644
+--- a/libgcc/config/i386/cpuinfo.c
++++ b/libgcc/config/i386/cpuinfo.c
+@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
+ return 0;
+ }
+
+-#if defined SHARED && defined USE_ELF_SYMVER
+-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
+-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
++#ifndef SHARED
++int __cpu_indicator_init_local (void)
++ __attribute__ ((weak, alias ("__cpu_indicator_init")));
+ #endif
+diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
+index 11bb46e..4f47f7b 100644
+--- a/libgcc/config/i386/t-linux
++++ b/libgcc/config/i386/t-linux
+@@ -3,4 +3,4 @@
+ # t-slibgcc-elf-ver and t-linux
+ SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
+
+-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER
++HOST_LIBGCC2_CFLAGS += -mlong-double-80
+--
+2.9.0
+