summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-10-09 16:03:53 +0000
committerRui Ueyama <ruiu@google.com>2015-10-09 16:03:53 +0000
commitaf311c1d01b18b2faa05891c2ffd2ee93983aa04 (patch)
tree1089f92e9da3f0d1bd3e137e97709bc4885e10f1
parentffd132878ab31f384f883a765cf1e6ab180d463b (diff)
downloadbcm5719-llvm-af311c1d01b18b2faa05891c2ffd2ee93983aa04.tar.gz
bcm5719-llvm-af311c1d01b18b2faa05891c2ffd2ee93983aa04.zip
ELF2: Call OutputSection::finalize() from createSections.
Previously, we did this in assignAddresses(), but finalization was not part of assigning addresses, so this is a better place. llvm-svn: 249842
-rw-r--r--lld/ELF/Writer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 832357462cb..c3fd6886ac1 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -485,6 +485,12 @@ template <class ELFT> void Writer<ELFT>::createSections() {
// Fill the DynStrTab early.
Out<ELFT>::Dynamic->finalize();
+
+ // Fix each section's header (e.g. sh_size, sh_link, etc.)
+ for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections) {
+ Out<ELFT>::StrTab->add(Sec->getName());
+ Sec->finalize();
+ }
}
template <class ELFT>
@@ -524,9 +530,6 @@ template <class ELFT> void Writer<ELFT>::assignAddresses() {
FileHeaderPHDR.Header.p_align = Target->getPageSize();
for (OutputSectionBase<ELFT::Is64Bits> *Sec : OutputSections) {
- Out<ELFT>::StrTab->add(Sec->getName());
- Sec->finalize();
-
if (Sec->getSize()) {
uintX_t Flags = toPHDRFlags(Sec->getFlags());
ProgramHeader<ELFT> *Last = PHDRs.back();
OpenPOWER on IntegriCloud