[lld] [LLD][ELF] Fix SHF_MERGE misalignment when spilled (PR #119289)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 09:34:12 PST 2024


================
@@ -253,8 +253,22 @@ void OutputSection::finalizeInputSections() {
     for (InputSection *s : isd->sections)
       commitSection(s);
   }
-  for (auto *ms : mergeSections)
+  for (auto *ms : mergeSections) {
+    // Merging may have increased the alignment of a spillable section. Update
+    // the alignment of potential spill sections and their containing output
+    // sections.
+    if (!script->potentialSpillLists.empty()) {
----------------
MaskRay wrote:

The `empty()` test is redundant

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


More information about the llvm-commits mailing list