r335546 - Add an option to support debug fission on implicit ThinLTO.
Yunlian Jiang via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 25 16:05:28 PDT 2018
Author: yunlian
Date: Mon Jun 25 16:05:27 2018
New Revision: 335546
URL: http://llvm.org/viewvc/llvm-project?rev=335546&view=rev
Log:
Add an option to support debug fission on implicit ThinLTO.
Summary:
This adds an option -gsplit-dwarf=<arg>. LLVM can create .dwo files in the given directory
during the implicit ThinLTO link stage.
Reviewers: tejohnson, dblaikie, pcc
Reviewed By: pcc
Subscribers: steven_wu, aprantl, JDevlieghere, yunlian, probinson, mehdi_amini, inglorion, cfe-commits
Differential Revision: https://reviews.llvm.org/D44788
Added:
cfe/trunk/test/Driver/lto-dwo.c
Modified:
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
Modified: cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp?rev=335546&r1=335545&r2=335546&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp Mon Jun 25 16:05:27 2018
@@ -416,6 +416,12 @@ void tools::AddGoldPlugin(const ToolChai
CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt));
}
+ if (Args.hasArg(options::OPT_gsplit_dwarf)) {
+ CmdArgs.push_back(
+ Args.MakeArgString(Twine("-plugin-opt=dwo_dir=") +
+ Output.getFilename() + "_dwo"));
+ }
+
if (IsThinLTO)
CmdArgs.push_back("-plugin-opt=thinlto");
Added: cfe/trunk/test/Driver/lto-dwo.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/lto-dwo.c?rev=335546&view=auto
==============================================================================
--- cfe/trunk/test/Driver/lto-dwo.c (added)
+++ cfe/trunk/test/Driver/lto-dwo.c Mon Jun 25 16:05:27 2018
@@ -0,0 +1,6 @@
+// Confirm that -gsplit-dwarf=DIR is passed to linker
+
+// RUN: %clang -target x86_64-unknown-linux -### %s -flto=thin -gsplit-dwarf -o a.out 2> %t
+// RUN: FileCheck -check-prefix=CHECK-LINK-DWO-DIR-DEFAULT < %t %s
+//
+// CHECK-LINK-DWO-DIR-DEFAULT: "-plugin-opt=dwo_dir=a.out_dwo"
More information about the cfe-commits
mailing list