]> granicus.if.org Git - clang/commitdiff
LTO via the gold plugin needs to be told about debugger tuning.
authorPaul Robinson <paul_robinson@playstation.sony.com>
Mon, 25 Jan 2016 19:46:40 +0000 (19:46 +0000)
committerPaul Robinson <paul_robinson@playstation.sony.com>
Mon, 25 Jan 2016 19:46:40 +0000 (19:46 +0000)
Differential Revision: http://reviews.llvm.org/D16094

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258712 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/lto.c

index 574bf5cd77d14047b606ba09f00e3255c7e39573..2bbcb275a4b894a928e1ec5e8e30c7ff9270a814 100644 (file)
@@ -1817,6 +1817,17 @@ static void AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
 
   if (IsThinLTO)
     CmdArgs.push_back("-plugin-opt=thinlto");
+
+  // If an explicit debugger tuning argument appeared, pass it along.
+  if (Arg *A = Args.getLastArg(options::OPT_gTune_Group,
+                               options::OPT_ggdbN_Group)) {
+    if (A->getOption().matches(options::OPT_glldb))
+      CmdArgs.push_back("-plugin-opt=-debugger-tune=lldb");
+    else if (A->getOption().matches(options::OPT_gsce))
+      CmdArgs.push_back("-plugin-opt=-debugger-tune=sce");
+    else
+      CmdArgs.push_back("-plugin-opt=-debugger-tune=gdb");
+  }
 }
 
 /// This is a helper function for validating the optional refinement step
index 3f66274ee6fc862ea064566298835a8d2acca59b..d2f68f571afd27cbc9e63a61e56cbe3a4d0523fc 100644 (file)
 // RUN: FileCheck -check-prefix=CHECK-LINK-NOLTO-ACTION < %t %s
 //
 // CHECK-LINK-NOLTO-ACTION-NOT: "-plugin" "{{.*}}/LLVMgold.so"
+
+// -flto passes along an explicit debugger tuning argument.
+// RUN: %clang -target x86_64-unknown-linux -### %s -flto -glldb 2> %t
+// RUN: FileCheck -check-prefix=CHECK-TUNING-LLDB < %t %s
+// RUN: %clang -target x86_64-unknown-linux -### %s -flto -g 2> %t
+// RUN: FileCheck -check-prefix=CHECK-NO-TUNING < %t %s
+//
+// CHECK-TUNING-LLDB:   "-plugin-opt=-debugger-tune=lldb"
+// CHECK-NO-TUNING-NOT: "-plugin-opt=-debugger-tune