[lld] r312636 - [ELF] Move fixSectionAlignments() before first call to assignAddresses()
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 6 07:02:14 PDT 2017
Author: psmith
Date: Wed Sep 6 07:02:14 2017
New Revision: 312636
URL: http://llvm.org/viewvc/llvm-project?rev=312636&view=rev
Log:
[ELF] Move fixSectionAlignments() before first call to assignAddresses()
The fixSectionAlignments() function may alter the alignment of some
OutputSections, this is likely to alter the addresses calculated earlier
in assignAddresses(). By moving the call to fixSectionAlignments() we
make sure that assignAddresses() is consistent with the early calculation
used for RangeThunks and the final call just before writing the image.
Differential Revision: https://reviews.llvm.org/D36739
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=312636&r1=312635&r2=312636&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Sep 6 07:02:14 2017
@@ -192,9 +192,6 @@ template <class ELFT> void Writer<ELFT>:
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 @@ template <class ELFT> void Writer<ELFT>:
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.
More information about the llvm-commits
mailing list