[lld] r289045 - [ELF] ifunc implementation using synthetic sections

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 17:50:19 PST 2016


Peter Smith <peter.smith at linaro.org> writes:

> Not without risking breaking existing programs unfortunately. Glibc
> processes the .rel.dyn before the .rel.plt so an ifunc resolver in
> .rel.dyn cannot directly call any function that needs a .got.plt entry
> set up. This can be worked around by calling via a function pointer as
> the relocation will be in .rel.dyn and resolved before the ifunc
> resolver. I found this out the hard way when building some tests on
> ARM.
>
> There are also some more (undocumented) restrictions on architectures
> that use .rel.dyn for all irelative resolvers
> https://bugzilla.redhat.com/show_bug.cgi?id=1312462

Gosh, that is horrible beyond belief.

It is clear that a sane implementation should have the ifunc relocations
apart and use the lazy resolution system for them, even if doing the
resolution early. There are few ifunc symbols and setting up a lazy plt
structure for each should not add a significant cost.

If the desire was to support just simple cases, I wish we had something
like
https://docs.oracle.com/cd/E26502_01/html/E26507/appendixc-1.html
instead.

In any case, in lld we should just make sure we keep the ifuncs
together and don't make things even more painful, so I agree with you.

Cheers,
Rafael


More information about the llvm-commits mailing list