Skip to content

Commit

Permalink
LTO via the gold plugin needs to be told about debugger tuning.
Browse files Browse the repository at this point in the history
Differential Revision: http://reviews.llvm.org/D16094

llvm-svn: 258712
  • Loading branch information
Paul Robinson committed Jan 25, 2016
1 parent e71c99c commit 4391d09
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions clang/lib/Driver/Tools.cpp
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions clang/test/Driver/lto.c
Original file line number Diff line number Diff line change
@@ -49,3 +49,12 @@
// 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

0 comments on commit 4391d09

Please sign in to comment.