diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-06-05 23:43:49 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-06-05 23:43:49 +0000 |
commit | a6fef0e5dbf938f8442e5adcd6b8c1b35db56d62 (patch) | |
tree | d1200d294086b145b5fa4130c34c5867e0574959 | |
parent | f2b3b467e5f5e98e41e309434eefbd643bc908a4 (diff) | |
download | bcm5719-llvm-a6fef0e5dbf938f8442e5adcd6b8c1b35db56d62.tar.gz bcm5719-llvm-a6fef0e5dbf938f8442e5adcd6b8c1b35db56d62.zip |
Move clearOutputSections earlier.
This moves clearOutputSections and OutputSectionCommands creation as
early as possible without changing other code.
llvm-svn: 304751
-rw-r--r-- | lld/ELF/Writer.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index dd95c9ac917..9ffe6e984af 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -258,13 +258,7 @@ template <class ELFT> void Writer<ELFT>::run() { if (ErrorCount) return; - for (BaseCommand *Base : Script->Opt.Commands) - if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base)) - OutputSectionCommands.push_back(Cmd); - - clearOutputSections(); - - if (!Script->Opt.HasSections &&!Config->Relocatable) + if (!Script->Opt.HasSections && !Config->Relocatable) fixSectionAlignments(); // If -compressed-debug-sections is specified, we need to compress @@ -1267,6 +1261,9 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { Script->fabricateDefaultCommands(); else Script->synchronize(); + for (BaseCommand *Base : Script->Opt.Commands) + if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base)) + OutputSectionCommands.push_back(Cmd); // Fill other section headers. The dynamic table is finalized // at the end because some tags like RELSZ depend on result @@ -1277,6 +1274,8 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { // createThunks may have added local symbols to the static symbol table applySynthetic({InX::SymTab, InX::ShStrTab, InX::StrTab}, [](SyntheticSection *SS) { SS->postThunkContents(); }); + + clearOutputSections(); } template <class ELFT> void Writer<ELFT>::addPredefinedSections() { |