This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH] PR target/65612: Multiversioning doesn't work with DSO nor PIE
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Szabolcs Nagy <nsz at port70 dot net>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Uros Bizjak <ubizjak at gmail dot com>, Mike Stump <mikestump at comcast dot net>, Jack Howarth <howarth dot at dot gcc at gmail dot com>, Ian Lance Taylor <ian at airs dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Iain Sandoe <iain at codesourcery dot com>, Rainer Orth <ro at cebitec dot uni-bielefeld dot de>, Rich Felker <dalias at libc dot org>
- Date: Sat, 9 May 2015 10:41:41 -0700
- Subject: Re: PATCH] PR target/65612: Multiversioning doesn't work with DSO nor PIE
- Authentication-results: sourceware.org; auth=none
- References: <CAJMcOU9hcqopdDfpYbP5d=JLVVLUMnvqZWPQt14kH3T6DgVB8w at mail dot gmail dot com> <CAMe9rOpj-nx=eYzLD9gjy4tVuUbbii8nx0pzM8ynWEvK+WLPLA at mail dot gmail dot com> <B1F30D20-7B2F-477E-87AB-82BAA7039767 at comcast dot net> <CAFULd4aTcfyDVpMQVyZ2Po=BCG5ZQxV1Qq5TD5xsZ3LeGNwOFw at mail dot gmail dot com> <CAMe9rOpim6FhVk=ts3Zd4jfNU+oAXmtpy2aWy+ZP7qJ75E9H8g at mail dot gmail dot com> <CAFULd4bDmOcJ4bm8GpGvNL6-TCZYpZuC79RHGw_+BKD08ZF73A at mail dot gmail dot com> <20150417113731 dot GL1725 at tucnak dot redhat dot com> <CAMe9rOpGbB=UuSg3s437FaedD_mugzYKffdrJJfZEHVQQEBODQ at mail dot gmail dot com> <20150417115950 dot GM1725 at tucnak dot redhat dot com> <CAMe9rOp_Eck1MEOV6btcHLOsd5u0=dtEQDq3iy0QY0RvXwuVDQ at mail dot gmail dot com> <20150509143104 dot GA26462 at port70 dot net>
On Sat, May 9, 2015 at 7:31 AM, Szabolcs Nagy <nsz@port70.net> wrote:
> * H.J. Lu <hjl.tools@gmail.com> [2015-04-17 05:36:30 -0700]:
>> On Fri, Apr 17, 2015 at 4:59 AM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > On Fri, Apr 17, 2015 at 04:48:48AM -0700, H.J. Lu wrote:
>> >> > I don't like it. Nonshared libgcc is libgcc.a, period. No sense in
>> >> > creating yet another library for that.
>> >> > So, IMHO beyond making the __cpu* entrypoints compat symbols only (@ instead
>> >> > of @@ symbol versions) the right fix is simply tweak init_gcc_spec, so that
>> >> > static_name is always linked in, in the switch combinations that it isn't
>> >> > right now of course after shared_name rather than before that.
>> >> > I thought we've fixed that years ago...
>> >> >
>
> I think the patch committed for this is suboptimal.
> (it breaks with musl libc on x86 if libgcc_s is linked into a binary)
>
> the patch:
> http://gcc.gnu.org/ml/gcc-patches/2015-04/msg00878.html
> original thread:
> http://gcc.gnu.org/ml/gcc-patches/2015-03/msg01520.html
>
> The symbol versioning hack for __cpu_model and __cpu_indicator_init
> makes them invisible to the musl dynamic linker so their relocation
> fails with 'symbol not found' error.
> (affects anything linked with -lgcc_s)
There are
4: 0000000000002b70 806 FUNC GLOBAL DEFAULT 12
__cpu_indicator_init@GCC_4.8.0
38: 00000000002153d0 16 OBJECT GLOBAL DEFAULT 25 __cpu_model@GCC_4.8.0
and
000000000215000 0000000400000001 R_X86_64_64
0000000000002b70 __cpu_indicator_init@GCC_4.8.0 + 0
0000000000215220 0000002600000006 R_X86_64_GLOB_DAT
00000000002153d0 __cpu_model@GCC_4.8.0 + 0
in libgcc_s.so.1. Musl ld.so must be fixed to handle it.
--
H.J.