Index: test/tools/gold/X86/relocatable.ll =================================================================== --- test/tools/gold/X86/relocatable.ll +++ test/tools/gold/X86/relocatable.ll @@ -10,7 +10,7 @@ ; CHECK-NEXT: Binding: Global ; CHECK-NEXT: Type: Function ; CHECK-NEXT: Other: 0 -; CHECK-NEXT: Section: .text.foo +; CHECK-NEXT: Section: .text ; CHECK-NEXT: } target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" Index: tools/gold/gold-plugin.cpp =================================================================== --- tools/gold/gold-plugin.cpp +++ tools/gold/gold-plugin.cpp @@ -115,6 +115,8 @@ 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 FuncSplitSections = true; +static bool DataSplitSections = true; static Optional RelocationModel = None; static std::string output_name = ""; static std::list Modules; @@ -324,6 +326,8 @@ switch (tv->tv_u.tv_val) { case LDPO_REL: // .o IsExecutable = false; + FuncSplitSections = false; + DataSplitSections = false; break; case LDPO_DYN: // .so IsExecutable = false; @@ -834,9 +838,9 @@ // 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 = FuncSplitSections; + Conf.Options.DataSections = DataSplitSections; Conf.MAttrs = MAttrs; Conf.RelocModel = RelocationModel;