[lld] [LLD] Implement --enable-non-contiguous-regions (PR #90007)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 11:23:21 PDT 2024


================
@@ -505,12 +510,33 @@ LinkerScript::computeInputSections(const InputSectionDescription *cmd,
     size_t sizeBeforeCurrPat = ret.size();
 
     for (size_t i = 0, e = sections.size(); i != e; ++i) {
-      // Skip if the section is dead or has been matched by a previous input
-      // section description or a previous pattern.
+      // Skip if the section is dead or has been matched by a previous pattern
+      // in this input section description.
       InputSectionBase *sec = sections[i];
-      if (!sec->isLive() || sec->parent || seen.contains(i))
+      if (!sec->isLive() || seen.contains(i))
         continue;
 
+      if (sec->parent) {
----------------
MaskRay wrote:

If this is moved before `ret.push_back(sec);`, we can save one `if (sec->parent)` check and group enableNonContiguousRegions code together.

https://github.com/llvm/llvm-project/pull/90007


More information about the llvm-commits mailing list