summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-07-04 21:05:26 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-07-04 21:05:26 +0000
commit9b3f657d21d74effb4860b6c7067d79cf3641959 (patch)
tree5862ced17417c067c63fe745a159806b2c330a71
parent5e1fa83bf2ab6969a784434096b7fe7f8d6608c6 (diff)
downloadbcm5719-llvm-9b3f657d21d74effb4860b6c7067d79cf3641959.tar.gz
bcm5719-llvm-9b3f657d21d74effb4860b6c7067d79cf3641959.zip
Move clearOutputSections earlier. NFC.
This is finally getting to the point where output sections are constructed. createOrphanCommands and fabricateDefaultCommands are moved out so they can be merged with existing code in followup commits. llvm-svn: 307107
-rw-r--r--lld/ELF/Writer.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index f790ccfca56..bc5f7676b99 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -152,10 +152,6 @@ template <class ELFT> static void combineEhFrameSections() {
}
template <class ELFT> void Writer<ELFT>::clearOutputSections() {
- if (Script->Opt.HasSections)
- Script->createOrphanCommands();
- else
- Script->fabricateDefaultCommands();
// Clear the OutputSections to make sure it is not used anymore. Any
// code from this point on should be using the linker script
// commands.
@@ -185,6 +181,7 @@ template <class ELFT> void Writer<ELFT>::run() {
// Linker scripts may have left some input sections unassigned.
// Assign such sections using the default rule.
Script->addOrphanSections(Factory);
+ Script->createOrphanCommands();
} else {
// If linker script does not contain SECTIONS commands, create
// output sections by default rules. We still need to give the
@@ -192,13 +189,13 @@ template <class ELFT> void Writer<ELFT>::run() {
// non-SECTIONS commands such as ASSERT.
createSections();
Script->processCommands(Factory);
+ Script->fabricateDefaultCommands();
}
+ clearOutputSections();
if (Config->Discard != DiscardPolicy::All)
copyLocalSymbols();
- clearOutputSections();
-
if (Config->CopyRelocs)
addSectionSymbols();
OpenPOWER on IntegriCloud