This is an archive of the discontinued LLVM Phabricator instance.

[ELF][I386] .got.plt entries for i386 should use the VA of the ifunc resolver function
ClosedPublic

Authored by peter.smith on Dec 8 2016, 10:32 AM.

Details

Summary

The i386 ld.so expects the .got.slot entry that is relocated by a R_386_IRELATIVE relocation to point directly at the ifunc resolver and not the address of the PLT entry + 6 (thus entering the lazy resolver). This is also the case for ARM and I suspect it is because these use REL relocations and can't use the addend field to store the address of the ifunc resolver. If the lazy resolver is used we get an error message stating that only R_386_JUMP_SLOT is supported.

As ARM and i386 share the same code, I've removed the ARM specific test and added a writeIgotPlt() function that by default calls writeGotPlt(). ARM and i386 override this to write the address of the ifunc resolver.

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith retitled this revision from to [ELF][I386] .got.plt entries for i386 should use the VA of the ifunc resolver function.
peter.smith updated this object.
peter.smith added reviewers: ruiu, rafael.
peter.smith added a subscriber: llvm-commits.
ruiu accepted this revision.Dec 8 2016, 10:35 AM
ruiu edited edge metadata.

LGTM. Nice!

This revision is now accepted and ready to land.Dec 8 2016, 10:35 AM
joerg added a subscriber: joerg.Dec 8 2016, 11:24 AM

Please adjust the summary before commit to mention which ld.so you mean. Just to avoid having to guess from the history later...

I've altered the commit message to say glibc ld.so. Hope that's ok. R289198

This revision was automatically updated to reflect the committed changes.