summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index e42240fdd83..5ab9d64e116 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -244,8 +244,6 @@ template <class ELFT> static std::vector<DefinedCommon *> getCommonSymbols() {
// The main function of the writer.
template <class ELFT> void Writer<ELFT>::run() {
- if (Config->Discard != DiscardPolicy::All)
- copyLocalSymbols();
addReservedSymbols();
if (Target->NeedsThunks)
@@ -262,6 +260,9 @@ template <class ELFT> void Writer<ELFT>::run() {
Script<ELFT>::X->processCommands(Factory);
}
+ if (Config->Discard != DiscardPolicy::All)
+ copyLocalSymbols();
+
finalizeSections();
if (HasError)
return;
OpenPOWER on IntegriCloud