Fix program header propagation.
Propagate program headers by walking the commands, not the
sections. This allows us to propagate program headers even from
sections that don't end up in the output.
Fixes pr30997.
llvm-svn: 286837
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 9776f62..2117e47 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -856,6 +856,8 @@
std::rotate(BestPos, NonScriptI, NonScriptI + 1);
++NonScriptI;
}
+
+ Script<ELFT>::X->adjustSectionsAfterSorting();
}
// Create output section objects and add them to OutputSections.