summaryrefslogtreecommitdiffstats
path: root/llvm/tools/gold/gold-plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/gold/gold-plugin.cpp')
-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..6c55ebcddc4 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -115,6 +115,7 @@ static ld_plugin_add_input_file add_input_file = nullptr;
static ld_plugin_set_extra_library_path set_extra_library_path = nullptr;
static ld_plugin_get_view get_view = nullptr;
static bool IsExecutable = false;
+static bool SplitSections = true;
static Optional<Reloc::Model> RelocationModel = None;
static std::string output_name = "";
static std::list<claimed_file> Modules;
@@ -324,6 +325,7 @@ ld_plugin_status onload(ld_plugin_tv *tv) {
switch (tv->tv_u.tv_val) {
case LDPO_REL: // .o
IsExecutable = false;
+ SplitSections = false;
break;
case LDPO_DYN: // .so
IsExecutable = false;
@@ -834,9 +836,9 @@ 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.
+ Conf.Options.FunctionSections = SplitSections;
+ Conf.Options.DataSections = SplitSections;
Conf.MAttrs = MAttrs;
Conf.RelocModel = RelocationModel;
OpenPOWER on IntegriCloud