diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-06-13 22:36:20 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-06-13 22:36:20 +0000 |
| commit | cdf813bbd1172d7c229b523ea7b4c0c4de449292 (patch) | |
| tree | 55093ba96e39299964adc14dd772c5d1f0200d1f | |
| parent | 9340b1d9666a6e1915ba47c740e3ca5516aa3c9e (diff) | |
| download | bcm5719-llvm-cdf813bbd1172d7c229b523ea7b4c0c4de449292.tar.gz bcm5719-llvm-cdf813bbd1172d7c229b523ea7b4c0c4de449292.zip | |
Move clearOutputSections earlier. NFC.
llvm-svn: 305333
| -rw-r--r-- | lld/ELF/Writer.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index d41baec45f7..1112ad23d96 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1151,6 +1151,12 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { removeUnusedSyntheticSections(OutputSections); sortSections(); + if (!Script->Opt.HasSections) + Script->fabricateDefaultCommands(); + for (BaseCommand *Base : Script->Opt.Commands) + if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base)) + OutputSectionCommands.push_back(Cmd); + clearOutputSections(); // This is a bit of a hack. A value of 0 means undef, so we set it // to 1 t make __ehdr_start defined. The section number is not @@ -1158,18 +1164,12 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { Out::ElfHeader->SectionIndex = 1; unsigned I = 1; - for (OutputSection *Sec : OutputSections) { + for (OutputSectionCommand *Cmd : OutputSectionCommands) { + OutputSection *Sec = Cmd->Sec; Sec->SectionIndex = I++; Sec->ShName = InX::ShStrTab->addString(Sec->Name); } - if (!Script->Opt.HasSections) - Script->fabricateDefaultCommands(); - for (BaseCommand *Base : Script->Opt.Commands) - if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base)) - OutputSectionCommands.push_back(Cmd); - clearOutputSections(); - // Binary and relocatable output does not have PHDRS. // The headers have to be created before finalize as that can influence the // image base and the dynamic section on mips includes the image base. |

