aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/gold/gold-plugin.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index 71e5b72a40c..8ffa5877ba6 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -833,8 +833,10 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite,
Conf.Options.RelaxELFRelocations = false;
// Toggle function/data sections.
- Conf.Options.FunctionSections = SplitSections;
- Conf.Options.DataSections = SplitSections;
+ if (FunctionSections.getNumOccurrences() == 0)
+ Conf.Options.FunctionSections = SplitSections;
+ if (DataSections.getNumOccurrences() == 0)
+ Conf.Options.DataSections = SplitSections;
Conf.MAttrs = MAttrs;
Conf.RelocModel = RelocationModel;