forked from OSchip/llvm-project
[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 llvm-svn: 312636
This commit is contained in:
parent
523827145b
commit
3ef89b0fc7
|
@ -192,9 +192,6 @@ template <class ELFT> void Writer<ELFT>::run() {
|
|||
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>::finalizeSections() {
|
|||
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.
|
||||
|
|
Loading…
Reference in New Issue