1 |
Hello, |
2 |
|
3 |
I was pleasantly surprised to see gcc 6.1 with upstream musl support |
4 |
in the overlay. |
5 |
|
6 |
It compiles very nicely without any musl patches but does not produce |
7 |
working C++ binaries (on amd64 and x86) because of undefined references |
8 |
to "__cpu_indicator_init" and "__cpu_model". |
9 |
|
10 |
I think that this is the gcc symbol-versioning incompatibility issue |
11 |
|
12 |
http://www.openwall.com/lists/musl/2015/05/10/1 |
13 |
|
14 |
Below is a patch based on |
15 |
|
16 |
http://openwall.com/lists/musl/2016/05/06/4 |
17 |
|
18 |
I have used to workaround it. It seems to work fine for me, for example |
19 |
inkscape compiles and works fine. |
20 |
|
21 |
Felix |
22 |
|
23 |
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c |
24 |
index 3d044e8..82523e1 100644 |
25 |
--- a/gcc/config/i386/i386.c |
26 |
+++ b/gcc/config/i386/i386.c |
27 |
@@ -40269,10 +40269,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget, |
28 |
{ |
29 |
case IX86_BUILTIN_CPU_INIT: |
30 |
{ |
31 |
- /* Make it call __cpu_indicator_init in libgcc. */ |
32 |
+ /* Make it call __cpu_indicator_init_local in libgcc.a. */ |
33 |
tree call_expr, fndecl, type; |
34 |
type = build_function_type_list (integer_type_node, NULL_TREE); |
35 |
- fndecl = build_fn_decl ("__cpu_indicator_init", type); |
36 |
+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type); |
37 |
call_expr = build_call_expr (fndecl, 0); |
38 |
return expand_expr (call_expr, target, mode, EXPAND_NORMAL); |
39 |
} |
40 |
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c |
41 |
index 8c2248d..6c82f15 100644 |
42 |
--- a/libgcc/config/i386/cpuinfo.c |
43 |
+++ b/libgcc/config/i386/cpuinfo.c |
44 |
@@ -485,7 +485,7 @@ __cpu_indicator_init (void) |
45 |
return 0; |
46 |
} |
47 |
|
48 |
-#if defined SHARED && defined USE_ELF_SYMVER |
49 |
-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0"); |
50 |
-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0"); |
51 |
+#ifndef SHARED |
52 |
+int __cpu_indicator_init_local (void) |
53 |
+ __attribute__ ((weak, alias ("__cpu_indicator_init"))); |
54 |
#endif |