This is an archive of the discontinued LLVM Phabricator instance.

Parse resolations only once
ClosedPublic

Authored by rafael on Nov 9 2016, 2:39 PM.

Details

Reviewers
ruiu
Summary

Relocations are the last thing that we wore storing a raw section pointer to and parsing on demand.

With this patch we parse it only once and store a pointer to the actual data.

The patch also changes where we store it. It is now in InputSectionBase. Not all sections have relocations, but most do and this simplifies the logic. It also means that we now only support one relocation section per section. Given that that constraint is maintained even with -r with gold bfd and lld, I think it is OK.

Diff Detail

Event Timeline

rafael updated this revision to Diff 77396.Nov 9 2016, 2:39 PM
rafael retitled this revision from to Parse resolations only once.
rafael updated this object.
rafael added a reviewer: ruiu.
rafael added a subscriber: llvm-commits.
ruiu accepted this revision.Nov 9 2016, 2:52 PM
ruiu edited edge metadata.

LGTM

ELF/ICF.cpp
122–124
return hash_combine(S->Flags, S->getSize(), S->NumRelocations);
ELF/InputFiles.cpp
394–396

You can do this check earlier, after if (!Target) return nullptr. Then you can directly assign to Target->FirstRelocation etc.

This revision is now accepted and ready to land.Nov 9 2016, 2:52 PM