Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -192,9 +192,6 @@ if (ErrorCount) return; - if (!Script->Opt.HasSections && !Config->Relocatable) - fixSectionAlignments(); - // If -compressed-debug-sections is specified, we need to compress // .debug_* sections. Do it right now because it changes the size of // output sections. @@ -1385,6 +1382,9 @@ InX::Dynamic}, [](SyntheticSection *SS) { SS->finalizeContents(); }); + if (!Script->Opt.HasSections && !Config->Relocatable) + fixSectionAlignments(); + // Some architectures use small displacements for jump instructions. // It is linker's responsibility to create thunks containing long // jump instructions if jump targets are too far. Create thunks.