PATCH: Make STT_GNU_IFUNC symbol dynamic

H.J. Lu hjl.tools@gmail.com
Sun May 24 02:38:00 GMT 2009


On Sat, May 23, 2009 at 2:44 PM, Ulrich Drepper <drepper@redhat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> H.J. Lu wrote:
>> Which tool will generate the new relocation? Will it be internal to linker.
>
> The code the compiler generates contains ordinary calls.  The assembler
> will have to refrain from optimizing calls to static IFUNC functions.

Assembler will always generate PLT relocation for @PLT. I don't think
we need to change the assembler.

> But the real logic is entirely internal to the static linker.  For every
> local IFUNC symbol create a PLT slot.  This slot has no global symbol
> attached and the relocation should be R_*_IRELATIVE (my proposed name).
>  This relocation works like a R_*_RELATIVE relocation but it uses the
> return value as for SHT_GNU_IFUNC symbols.  The reason we need such a
> relocation is that we have no symbol at runtime.  We cannot use a normal
> PLT slot relocation since this would perform a global name lookup, which
> is wrong.  The R_*_IRELATIVE relocation is also more efficient.
>
>

I took a look. It isn't hard to implement. Should it be R_*_IJUMP_SLOT
since it will be processed closer to R_*_JUMP_SLOT than R_*_RELATIVE?
My linker only patch for x86-64 is ready for test. I just need to
verify it works
with glibc on x86-64.

-- 
H.J.



More information about the Libc-alpha mailing list