PATCH] PR target/65612: Multiversioning doesn't work with DSO nor PIE
Szabolcs Nagy
nsz@port70.net
Sat May 9 18:57:00 GMT 2015
* H.J. Lu <hjl.tools@gmail.com> [2015-05-09 10:41:41 -0700]:
> On Sat, May 9, 2015 at 7:31 AM, Szabolcs Nagy <nsz@port70.net> wrote:
> >
> > 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.
>
(sorry, i missed the other discussion about the same issue)
i still think a solution that avoids depending on symbol
versioning in the dynamic linker would be preferable.
(versioning is a sun/gnu elf extension as far as i understand,
eg. not supported by posix dlsym).
i think it might be enough to add __cpu_indicator_init_local
as an alias to __cpu_indicator_init in libgcc.a and then use
the *_local symbol from the ifunc resolver, that way no new
dependency is added to libgcc_s.so handling.
(adding versioning support to musl is problematic with the
current code, a simpler workaround for musl is to provide its
own weak definition of __cpu_indicator_init, but that's ugly.)
More information about the Gcc-patches
mailing list