This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] .ARM.exidx sentinel section writeTo() should use InputSectionDescriptions.
ClosedPublic

Authored by peter.smith on May 24 2017, 8:44 AM.

Details

Summary

This change converts the writing of the .ARM.exidx sentinel section to use the InputSectionDescriptions instead of OutputSection::Sections this is in preparation for the retirement of OutputSection::Sections.

To use the InputSectionDescriptions we need a way of obtaining them from the OutputSection. I've chosen to add member function to extract a vector of the InputSectionDescriptions. For this particular use case it might be better to offer a more functional Script->forEachInputSection(OutSecName, lambda) interface. However some
other use cases such as processing Thunks may need to insert directly into InputSections so I've used the interface that exposes these.

I've split this out from D33239 as it is a logical intermediate step towards converting the SHF_LINK_ORDER processing to use InputSectionDescriptions.

Diff Detail

Event Timeline

peter.smith created this revision.May 24 2017, 8:44 AM

Updated due to D33496 needing inputSectionRanges() so we don't need to add it here as well. This patch now depends on D33496.

ruiu added inline comments.May 25 2017, 4:29 PM
ELF/SyntheticSections.cpp
2190

This inputSectionRanges function doesn't seem to be defined. What am I missing?

The inputSectionRanges() was previously defined in D33496, I've removed it from that review to use Script->getCmd() instead. Sorry for the confusion.

I've now put it back here using an OutputSection* and getCmd() instead of StringRef, I've also started the search for the InputSection that precedes the Sentinel from the end as the sections are sorted in ascending order.

Updated patch to account for changes in D33496 which meant that we can guarantee that both the Sentinel and the preceding InputSection are in the same InputSectionDescription. This permits a simpler implementation here.

This revision was automatically updated to reflect the committed changes.