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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336838
91177308-0d34-0410-b5e6-
96231b3b80d8
// 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;