[llvm] r348389 - [gold-plugin] allow function/data sections to be toggleable

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 5 09:46:24 PST 2018


Author: nickdesaulniers
Date: Wed Dec  5 09:46:24 2018
New Revision: 348389

URL: http://llvm.org/viewvc/llvm-project?rev=348389&view=rev
Log:
[gold-plugin] allow function/data sections to be toggleable

Summary:
r336838 allowed these to be toggleable.
r336858 reverted r336838.
r336943 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 r336943.

Without toggling r336943 off, arm64 linux kernels linked with gold-plugin
see significant boot time regressions, but with r336943 outright reverted
x86_64 linux kernels linked with gold-plugin fail to boot.

Reviewers: pcc, void

Reviewed By: pcc

Subscribers: javed.absar, kristof.beyls, llvm-commits, srhines

Differential Revision: https://reviews.llvm.org/D55291

Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=348389&r1=348388&r2=348389&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Dec  5 09:46:24 2018
@@ -833,8 +833,10 @@ static std::unique_ptr<LTO> createLTO(In
   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;




More information about the llvm-commits mailing list