[PATCH] D64880: ELF: Allow forward references to linked sections.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 06:36:56 PDT 2019


ruiu accepted this revision.
ruiu added a comment.

LGTM



================
Comment at: lld/ELF/InputFiles.cpp:656
+  }
+
+  for (size_t i = 0, e = objSections.size(); i < e; i++) {
----------------
peter.smith wrote:
> A possible optimization would be to remember the index of the first SHF_LINK_ORDER section in the previous loop. Then start the second iteration from there. If there were no SHF_LINK_ORDER sections which I would expect to be rare outside of Arm then we would skip the second loop entirely. I wouldn't expect this to be significant though so it may be better to keep it simple.
I thought that too, but since the section table is an efficient data structure (a vector) and its size is not very large, so I don't think we'll see a difference by caching something in the first loop.


================
Comment at: lld/ELF/InputFiles.cpp:664
     // have a SHF_LINK_ORDER dependency, this is identified by the sh_link.
     if (sec.sh_flags & SHF_LINK_ORDER) {
       InputSectionBase *linkSec = nullptr;
----------------
Flip the condition to continue early.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64880





More information about the llvm-commits mailing list