Gentoo Archives: gentoo-musl

From: "Anthony G. Basile" <basile@××××××××××××××.edu>
To: gentoo-musl@l.g.o
Subject: Re: [gentoo-musl] gcc 6.1
Date: Sun, 15 May 2016 00:49:40
Message-Id: 5737C61E.5020807@opensource.dyc.edu
In Reply to: [gentoo-musl] gcc 6.1 by Felix Janda
1 On 5/11/16 4:21 PM, Felix Janda wrote:
2 > Hello,
3 >
4 > I was pleasantly surprised to see gcc 6.1 with upstream musl support
5 > in the overlay.
6 >
7 > It compiles very nicely without any musl patches but does not produce
8 > working C++ binaries (on amd64 and x86) because of undefined references
9 > to "__cpu_indicator_init" and "__cpu_model".
10 >
11 > I think that this is the gcc symbol-versioning incompatibility issue
12 >
13 > http://www.openwall.com/lists/musl/2015/05/10/1
14 >
15 > Below is a patch based on
16 >
17 > http://openwall.com/lists/musl/2016/05/06/4
18 >
19 > I have used to workaround it. It seems to work fine for me, for example
20 > inkscape compiles and works fine.
21 >
22 > Felix
23 >
24 > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
25 > index 3d044e8..82523e1 100644
26 > --- a/gcc/config/i386/i386.c
27 > +++ b/gcc/config/i386/i386.c
28 > @@ -40269,10 +40269,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
29 > {
30 > case IX86_BUILTIN_CPU_INIT:
31 > {
32 > - /* Make it call __cpu_indicator_init in libgcc. */
33 > + /* Make it call __cpu_indicator_init_local in libgcc.a. */
34 > tree call_expr, fndecl, type;
35 > type = build_function_type_list (integer_type_node, NULL_TREE);
36 > - fndecl = build_fn_decl ("__cpu_indicator_init", type);
37 > + fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
38 > call_expr = build_call_expr (fndecl, 0);
39 > return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
40 > }
41 > diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
42 > index 8c2248d..6c82f15 100644
43 > --- a/libgcc/config/i386/cpuinfo.c
44 > +++ b/libgcc/config/i386/cpuinfo.c
45 > @@ -485,7 +485,7 @@ __cpu_indicator_init (void)
46 > return 0;
47 > }
48 >
49 > -#if defined SHARED && defined USE_ELF_SYMVER
50 > -__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
51 > -__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
52 > +#ifndef SHARED
53 > +int __cpu_indicator_init_local (void)
54 > + __attribute__ ((weak, alias ("__cpu_indicator_init")));
55 > #endif
56 >
57
58 can you produce a patch against the overlay
59
60 --
61 Anthony G. Basile, Ph. D.
62 Chair of Information Technology
63 D'Youville College
64 Buffalo, NY 14201
65 (716) 829-8197

Replies

Subject Author
Re: [gentoo-musl] gcc 6.1 Felix Janda <felix.janda@××××××.de>