[PATCH] D48756: Add option for section ordering

Bill Wendling via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 1 02:10:33 PDT 2018


void updated this revision to Diff 153647.
void added a comment.

I changed it so that the original behavior is not changed. You need to specify `disable-section-ordering` as a plugin option.


Repository:
  rL LLVM

https://reviews.llvm.org/D48756

Files:
  tools/gold/gold-plugin.cpp


Index: tools/gold/gold-plugin.cpp
===================================================================
--- tools/gold/gold-plugin.cpp
+++ tools/gold/gold-plugin.cpp
@@ -203,6 +203,8 @@
   static std::string dwo_dir;
   /// Statistics output filename.
   static std::string stats_file;
+  // Disable section ordering.
+  static bool disable_section_ordering;
 
   // Optimization remarks filename and hotness options
   static std::string OptRemarksFilename;
@@ -278,6 +280,8 @@
       OptRemarksWithHotness = true;
     } else if (opt.startswith("stats-file=")) {
       stats_file = opt.substr(strlen("stats-file="));
+    } else if (opt == "disable-section-ordering") {
+      disable_section_ordering = true;
     } else {
       // Save this option to pass to the code generator.
       // ParseCommandLineOptions() expects argv[0] to be program name. Lazily
@@ -834,9 +838,8 @@
   // 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;
+  Conf.Options.FunctionSections = !options::disable_section_ordering;
+  Conf.Options.DataSections = !options::disable_section_ordering;
 
   Conf.MAttrs = MAttrs;
   Conf.RelocModel = RelocationModel;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48756.153647.patch
Type: text/x-patch
Size: 1330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180701/dbe03cb4/attachment.bin>


More information about the llvm-commits mailing list