[lld] [ELF] Reject SHF_LINK_ORDER on a non-regular section (PR #219816)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 03:41:37 PDT 2026


================
@@ -951,9 +951,17 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
       continue;
     }
 
+    // dependentSections can only hold InputSections.
+    StringRef name = check(obj.getSectionName(sec, shstrtab));
+    auto *isec = dyn_cast_or_null<InputSection>(this->sections[i]);
+    if (!isec || (sec.sh_flags & SHF_MERGE) || name == ".eh_frame") {
----------------
smithp35 wrote:

Before doing the string comparision with .eh_frame can we check to see if we're doing a relocatable link first?
```
if (!isec || (sec.sh_flags & SHF_MERGE) || (ctx.arg.relocatable && name == ".eh_frame"))
```


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


More information about the llvm-commits mailing list