public inbox for gentoo-musl@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-musl] gcc 6.1
@ 2016-05-11 20:21 99% Felix Janda
  0 siblings, 0 replies; 1+ results
From: Felix Janda @ 2016-05-11 20:21 UTC (permalink / raw
  To: gentoo-musl

Hello,

I was pleasantly surprised to see gcc 6.1 with upstream musl support
in the overlay.

It compiles very nicely without any musl patches but does not produce
working C++ binaries (on amd64 and x86) because of undefined references
to "__cpu_indicator_init" and "__cpu_model".

I think that this is the gcc symbol-versioning incompatibility issue

http://www.openwall.com/lists/musl/2015/05/10/1

Below is a patch based on

http://openwall.com/lists/musl/2016/05/06/4

I have used to workaround it. It seems to work fine for me, for example
inkscape compiles and works fine.

Felix

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3d044e8..82523e1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -40269,10 +40269,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


^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-05-11 20:21 99% [gentoo-musl] gcc 6.1 Felix Janda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox