This is an archive of the discontinued LLVM Phabricator instance.

ELF: Do not create relative relocations for undefined symbols.
ClosedPublic

Authored by pcc on Apr 12 2016, 6:24 PM.

Details

Summary

We need to ensure that the address of an undefined weak symbol evaluates to
zero. We were getting this right for non-PIC executables (where the symbol
can be evaluated directly) and for DSOs (where we emit a symbolic relocation
for these symbols, as they are preemptible). But we weren't getting it right
for PIEs. Probably the simplest way to ensure that these symbols evaluate
to zero is by not creating a relocation in .got for them.

Diff Detail

Event Timeline

pcc updated this revision to Diff 53506.Apr 12 2016, 6:24 PM
pcc retitled this revision from to ELF: Do not create relative relocations for undefined symbols..
pcc updated this object.
pcc added reviewers: ruiu, rafael.
pcc added a subscriber: llvm-commits.
rafael accepted this revision.Apr 12 2016, 7:14 PM
rafael edited edge metadata.

LGTM

test/ELF/pie-weak.s
5

please also check the content of .text by disassembling it.

This revision is now accepted and ready to land.Apr 12 2016, 7:14 PM
This revision was automatically updated to reflect the committed changes.
ruiu edited edge metadata.Apr 13 2016, 9:16 AM

LGTM