summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2018-07-11 19:13:26 +0000
committerBill Wendling <isanbard@gmail.com>2018-07-11 19:13:26 +0000
commite033b3afe392677d7e9fa302da89f8714c0f7e75 (patch)
tree96ffb6ab62ecd95792f0e903cf1fc9d47b95722c /llvm/tools
parent24452316c6c5c8e1e84c7dab75c340e4d889438d (diff)
downloadbcm5719-llvm-e033b3afe392677d7e9fa302da89f8714c0f7e75.tar.gz
bcm5719-llvm-e033b3afe392677d7e9fa302da89f8714c0f7e75.zip
gold: Add ability to toggle function/data sections
Some programs (e.g. Linux) aren't able to handle function/data sections when LTO is used. Thus they need a way to disable it. That can be done with these plugin options: -plugin-opt=-function-sections=0 -plugin-opt=-data-sections=0 llvm-svn: 336838
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/gold/gold-plugin.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 25ba80d2666..e88afd1cfb0 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -834,9 +834,11 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite,
// FIXME: Check the gold version or add a new option to enable them.
Conf.Options.RelaxELFRelocations = false;
- // Enable function/data sections by default.
- Conf.Options.FunctionSections = true;
- Conf.Options.DataSections = true;
+ // Toggle function/data sections.
+ if (FunctionSections.getNumOccurrences() == 0)
+ Conf.Options.FunctionSections = true;
+ if (DataSections.getNumOccurrences() == 0)
+ Conf.Options.DataSections = true;
Conf.MAttrs = MAttrs;
Conf.RelocModel = RelocationModel;
OpenPOWER on IntegriCloud