[lld] lld: relocate PHDR if sectionStartMap is not empty (PR #140126)
    Fangrui Song via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu May 15 21:50:45 PDT 2025
    
    
  
================
@@ -331,7 +331,7 @@ template <class ELFT> void Writer<ELFT>::run() {
   for (OutputSection *sec : ctx.outputSections)
     sec->maybeCompress<ELFT>(ctx);
 
-  if (ctx.script->hasSectionsCommand)
+  if (ctx.script->hasSectionsCommand || !ctx.arg.sectionStartMap.empty())
----------------
MaskRay wrote:
I don't think we should call allocateHeaders for the additional condition.
The user might specify --section-start to increase the address of a section. It should not change ELF header/program headers behavior.
https://github.com/llvm/llvm-project/pull/140126
    
    
More information about the llvm-commits
mailing list