[PATCH] D55291: [gold-plugin] allow function/data sections to be toggleable

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 12:53:38 PST 2018


nickdesaulniers created this revision.
nickdesaulniers added reviewers: pcc, void.
Herald added a subscriber: llvm-commits.

r336943 allowed these to be toggleable.
r336858 reverted r336943.
r336838 made the generation of these sections conditional on LDPO_REL.

This commit brings back the toggle-ability.  You can specify:
-plugin-opt=-function-sections
-plugin-opt=-data-sections
For your linker flags to disable the changes made in r336838.


Repository:
  rL LLVM

https://reviews.llvm.org/D55291

Files:
  tools/gold/gold-plugin.cpp


Index: tools/gold/gold-plugin.cpp
===================================================================
--- tools/gold/gold-plugin.cpp
+++ tools/gold/gold-plugin.cpp
@@ -833,8 +833,10 @@
   Conf.Options.RelaxELFRelocations = false;
 
   // Toggle function/data sections.
-  Conf.Options.FunctionSections = SplitSections;
-  Conf.Options.DataSections = SplitSections;
+  if (FunctionSections.getNumOccurrences() == 0)
+    Conf.Options.FunctionSections = SplitSections;
+  if (DataSections.getNumOccurrences() == 0)
+    Conf.Options.DataSections = SplitSections;
 
   Conf.MAttrs = MAttrs;
   Conf.RelocModel = RelocationModel;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55291.176697.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181204/df634122/attachment.bin>


More information about the llvm-commits mailing list