[PATCH] D44788: Add an option to support debug fission on implicit ThinLTO.

Yunlian Jiang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 22 09:43:51 PDT 2018


yunlian created this revision.
yunlian added reviewers: tejohnson, dblaikie, pcc.
Herald added subscribers: cfe-commits, inglorion, mehdi_amini.

This adds an option -gthinlto-dwo-dir=<arg>. LLVM can create .dwo files in the given directory
during the implicit ThinLTO link stage.


Repository:
  rC Clang

https://reviews.llvm.org/D44788

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/CommonArgs.cpp


Index: lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -415,6 +415,16 @@
   if (IsThinLTO)
     CmdArgs.push_back("-plugin-opt=thinlto");
 
+  if (Arg *A = Args.getLastArg(options::OPT_gthinlto_dwo_dir_EQ)) {
+    const char *Objcopy =
+        Args.MakeArgString(ToolChain.GetProgramPath(CLANG_DEFAULT_OBJCOPY));
+    CmdArgs.push_back(
+        Args.MakeArgString(Twine("-plugin-opt=objcopy=") + Objcopy));
+    StringRef DWO_Dir = A->getValue();
+    CmdArgs.push_back(
+        Args.MakeArgString(Twine("-plugin-opt=dwo_dir=") + DWO_Dir));
+  }
+
   if (unsigned Parallelism = getLTOParallelism(Args, D))
     CmdArgs.push_back(
         Args.MakeArgString("-plugin-opt=jobs=" + Twine(Parallelism)));
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1700,6 +1700,7 @@
 def gcolumn_info : Flag<["-"], "gcolumn-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
 def gno_column_info : Flag<["-"], "gno-column-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
 def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
+def gthinlto_dwo_dir_EQ : Joined<["-"], "gthinlto-dwo-dir=">, Group<g_flags_Group>;
 def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>, Flags<[CC1Option]>;
 def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
 def gmodules : Flag <["-"], "gmodules">, Group<gN_Group>,
Index: docs/ClangCommandLineReference.rst
===================================================================
--- docs/ClangCommandLineReference.rst
+++ docs/ClangCommandLineReference.rst
@@ -2587,6 +2587,8 @@
 
 .. option:: -gstrict-dwarf, -gno-strict-dwarf
 
+.. option:: -gthinlto-dwo-dir=<arg>
+
 .. option:: -gz
 
 DWARF debug sections compression type


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44788.139458.patch
Type: text/x-patch
Size: 1979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180322/1cdd999c/attachment.bin>


More information about the cfe-commits mailing list