This is an archive of the discontinued LLVM Phabricator instance.

[ELF2] Make sure symbol-less relocations make it to the target's handler
ClosedPublic

Authored by hfinkel on Oct 8 2015, 10:13 AM.

Details

Reviewers
ruiu
rafael
Summary

Some relocations don't actually require a symbol. For example, PPC64 as a TOC relocation (R_PPC64_TOC) which just bases its value on the location of the TOC base, and so there does not seem to be any corresponding symbol. Make sure the target's handler can see such relocations.

Diff Detail

Event Timeline

hfinkel updated this revision to Diff 36872.Oct 8 2015, 10:13 AM
hfinkel retitled this revision from to [ELF2] Make sure symbol-less relocations make it to the target's handler.
hfinkel updated this object.
hfinkel added reviewers: ruiu, rafael.
hfinkel added a project: lld.
hfinkel added a subscriber: llvm-commits.
ruiu accepted this revision.Oct 8 2015, 10:55 AM
ruiu edited edge metadata.

LGTM with nits

ELF/InputSection.cpp
39
uintX_t SymVA = 0;
46–53
// getRelocationSymbol may return a null for some relocations such as R_PPC64_TOC.
if (const Elf_Sym *Sym = File.getObj().getRelocationSymbol(&RI, SymTab))
  SymVA = getLocalSymVA(Sym, File);
This revision is now accepted and ready to land.Oct 8 2015, 10:55 AM
hfinkel closed this revision.Oct 12 2015, 2:07 PM

The code change here has been rendered unnecessary by r250095; the test-case fixup was committed in r250104.