[PATCH] D79687: [LLD][ELF][ARM] Support /DISCARD/ of subset of .ARM.exidx sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 10 22:20:54 PDT 2020


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

If I understand it correctly,

  combineEhSections()
    .ARM.exidx.* are removed from inputSections
  script->processSectionCommands()
    /DISCARD/ is handled. computeInputSections can find the synthetic section .ARM.exidx but not individual .ARM.exidx.*
  writeResult<ELFT>()
    ...
      writeSections
        ARMExidxSyntheticSection::writeTo called on .ARM.exidx.exit.text which should have been discarded. This causes a relocation overflow

This patch tactfully introduces a mechanism to discard such synthetic sections. Looks great! One nit about an unneeded function.



================
Comment at: lld/ELF/LinkerScript.cpp:453
+std::vector<InputSectionBase *>
+LinkerScript::computeInputSections(const InputSectionDescription *cmd) {
+  return computeInputSections(cmd, inputSections);
----------------
Delete the function which is only called once.


================
Comment at: lld/ELF/LinkerScript.cpp:497
     if (auto *cmd = dyn_cast<InputSectionDescription>(base)) {
       cmd->sectionBases = computeInputSections(cmd);
       for (InputSectionBase *s : cmd->sectionBases)
----------------
`cmd->sectionBases = computeInputSections(cmd, inputSections);`



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79687/new/

https://reviews.llvm.org/D79687





More information about the llvm-commits mailing list