llvm.org GIT mirror llvm / 0a4671b
[gold-plugin] Disable section ordering for relocatable links Not all programs want section ordering when compiled with LTO. In particular, the Linux kernel is very sensitive when it comes to linking, and doesn't boot when each function is placed in its own sections. Reviewed By: pcc Differential Revision: https://reviews.llvm.org/D48756 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336943 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 2 years ago
2 changed file(s) with 6 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
99 ; CHECK-NEXT: Binding: Global
1010 ; CHECK-NEXT: Type: Function
1111 ; CHECK-NEXT: Other: 0
12 ; CHECK-NEXT: Section: .text.foo
12 ; CHECK-NEXT: Section: .text
1313 ; CHECK-NEXT: }
1414
1515 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
114114 static ld_plugin_set_extra_library_path set_extra_library_path = nullptr;
115115 static ld_plugin_get_view get_view = nullptr;
116116 static bool IsExecutable = false;
117 static bool SplitSections = true;
117118 static Optional RelocationModel = None;
118119 static std::string output_name = "";
119120 static std::list Modules;
323324 switch (tv->tv_u.tv_val) {
324325 case LDPO_REL: // .o
325326 IsExecutable = false;
327 SplitSections = false;
326328 break;
327329 case LDPO_DYN: // .so
328330 IsExecutable = false;
833835 // FIXME: Check the gold version or add a new option to enable them.
834836 Conf.Options.RelaxELFRelocations = false;
835837
836 // Enable function/data sections by default.
837 Conf.Options.FunctionSections = true;
838 Conf.Options.DataSections = true;
838 // Toggle function/data sections.
839 Conf.Options.FunctionSections = SplitSections;
840 Conf.Options.DataSections = SplitSections;
839841
840842 Conf.MAttrs = MAttrs;
841843 Conf.RelocModel = RelocationModel;