Finalize content of synthetic sections prior to Thunk Creation
This change moves the calls to finalizeContent() for each synthetic section
before createThunks(). This will allow us to assign addresses prior to
calling createThunks(). As addition of thunks may add to the static
symbol table and may affect the size of the mips got section we introduce a
couple of additional member functions to update these values.
Differential revision: https://reviews.llvm.org/D29983
llvm-svn: 297277
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 8ef1d4d..c8039e6 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -895,7 +895,7 @@
// FIXME: All Thunks are assumed to be in range of the relocation. Range
// extension Thunks are not yet supported.
template <class ELFT>
-void createThunks(ArrayRef<OutputSection *> OutputSections) {
+bool createThunks(ArrayRef<OutputSection *> OutputSections) {
// Track Symbols that already have a Thunk
DenseMap<SymbolBody *, Thunk<ELFT> *> ThunkedSymbols;
// Track InputSections that have a ThunkSection placed in front
@@ -977,6 +977,7 @@
// Merge all created synthetic ThunkSections back into OutputSection
for (auto &KV : ThunkSections)
mergeThunks<ELFT>(KV.first, KV.second);
+ return !ThunkSections.empty();
}
template void scanRelocations<ELF32LE>(InputSectionBase &);
@@ -984,9 +985,9 @@
template void scanRelocations<ELF64LE>(InputSectionBase &);
template void scanRelocations<ELF64BE>(InputSectionBase &);
-template void createThunks<ELF32LE>(ArrayRef<OutputSection *>);
-template void createThunks<ELF32BE>(ArrayRef<OutputSection *>);
-template void createThunks<ELF64LE>(ArrayRef<OutputSection *>);
-template void createThunks<ELF64BE>(ArrayRef<OutputSection *>);
+template bool createThunks<ELF32LE>(ArrayRef<OutputSection *>);
+template bool createThunks<ELF32BE>(ArrayRef<OutputSection *>);
+template bool createThunks<ELF64LE>(ArrayRef<OutputSection *>);
+template bool createThunks<ELF64BE>(ArrayRef<OutputSection *>);
}
}