[PATCH] D48756: [gold-plugin] Disable section ordering for relocatable links

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 13:41:19 PDT 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL336943: [gold-plugin] Disable section ordering for relocatable links (authored by void, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D48756?vs=155259&id=155263#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48756

Files:
  llvm/trunk/test/tools/gold/X86/relocatable.ll
  llvm/trunk/tools/gold/gold-plugin.cpp


Index: llvm/trunk/tools/gold/gold-plugin.cpp
===================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp
+++ llvm/trunk/tools/gold/gold-plugin.cpp
@@ -115,6 +115,7 @@
 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 @@
       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 @@
   // 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;
Index: llvm/trunk/test/tools/gold/X86/relocatable.ll
===================================================================
--- llvm/trunk/test/tools/gold/X86/relocatable.ll
+++ llvm/trunk/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"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48756.155263.patch
Type: text/x-patch
Size: 1705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180712/2a78589b/attachment.bin>


More information about the llvm-commits mailing list