[PATCH] D32233: [LLD][ELF] User linkerscript InputSectionDescription for .ARM.exidx dependency order

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 09:43:28 PDT 2017


peter.smith created this revision.
Herald added subscribers: rengolin, aemerson.

InputSections with a SHF_LINK_ORDER dependency must be ordered in the same order as the InputSections that they have a dependency on. This ordering is done late in the link when the OutputSection containing a SHF_LINK_ORDER dependency is finalized. The reordering needs to handle these cases:

- No linker script SECTIONS command describing OutputSection
- Linker script that fully describes OutputSection with no orphans
- Linker script that partially describes OutputSection with orphans

At present we sort the OutputSection::Sections vector which will be fully or partially ignored if a linker script fully or partially describes the .ARM.exidx OutputSection. This is analogous to the insertion of thunks directly into OutputSection::Sections.

Building upon https://reviews.llvm.org/D32223:

This change:

- introduces a function inputSectionRanges() to obtain just the InputSectionDescriptions from an OutputSection.
- Inserts the .ARM.exidx sentinel into an InputSectionDescription
- Moves the fabricateInputSectionDescriptions before the call to OutputSection::finalize(), we need to do at least one call to Script->assignAddresses() to assign each InputSection its OutSecOff.
- Added a function to clear the state that accumulates with each call to assignAddresses() so that we can call it more than once.
- Consolidates the InputSectionDescriptions for .ARM.exidx into one as we need to sort the entire table. We can get multiple InputSectionDescriptions when something like

  .ARM.exidx { *(.ARM.exidx) } 

which will get orphans of the form .ARM.exidx.suffix.

- Sort the InputSectionDescription using the same criteria as before.
- Adds a test case that would previously fail as the later call to Script->assignAddresses() would ignore the sorting done to OutputSection::Sections().


https://reviews.llvm.org/D32233

Files:
  ELF/LinkerScript.cpp
  ELF/LinkerScript.h
  ELF/OutputSections.cpp
  ELF/SyntheticSections.cpp
  ELF/Writer.cpp
  test/ELF/arm-exidx-script.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32233.95770.patch
Type: text/x-patch
Size: 10229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170419/5329d66e/attachment.bin>


More information about the llvm-commits mailing list