This is an archive of the discontinued LLVM Phabricator instance.

[LLD][ELF] Make SHF_LINK_ORDER section ordering use InputSectionDescriptions
AbandonedPublic

Authored by peter.smith on May 16 2017, 7:28 AM.

Details

Reviewers
ruiu
rafael
Summary

This change moves the SHF_LINK_ORDER processing forward and makes it run on InputSectionDescriptions::Sections rather than OutputSections.

  • The .ARM.exidx sentinel section is added as an InputSection if there is at least one .ARM.exidx section present. It will be added to the linker script with the other .ARM.exidx sections.
  • The sorting of the SHF_LINK_ORDER sections and writing of the sentinel section contents now accounts for the section not always guaranteed last.
  • The sorting of the SHF_LINK_ORDER is moved to LinkerScript
  • The fabricated linker script commands are moved as far forward as possible

This is a step towards removing the need for the late LinkerScript::synchronize() function. It cannot be removed completely until Thunks are inserted directly into InputSectionDescriptions.

The current implementation of fabricateDefaultCommands() is moved up as far it can be with its current implementation. To move it further up we would need to split out the parts that rely on the program headers.

Diff Detail

Event Timeline

peter.smith created this revision.May 16 2017, 7:28 AM
rafael edited edge metadata.May 19 2017, 3:55 PM

The sorting does have to be made at the linker script level, but why do you have to change when it is made? Can the call to Script->sortLinkOrder be just before

for (OutputSection *Sec : OutputSections)
  Sec->finalize<ELFT>();
peter.smith abandoned this revision.Jun 22 2017, 7:54 AM

This is no longer needed, it was implemented in D33500 and D33496.