diff options
author | Paul Robinson <paul_robinson@playstation.sony.com> | 2016-01-25 19:46:40 +0000 |
---|---|---|
committer | Paul Robinson <paul_robinson@playstation.sony.com> | 2016-01-25 19:46:40 +0000 |
commit | 4391d09d608938749b1555264cbed14ac924df9e (patch) | |
tree | ecb7778b25257c0bc87d35118a4168f70c91772e | |
parent | e71c99c7e23f48d5cefb15078f528475d94547a9 (diff) | |
download | bcm5719-llvm-4391d09d608938749b1555264cbed14ac924df9e.tar.gz bcm5719-llvm-4391d09d608938749b1555264cbed14ac924df9e.zip |
LTO via the gold plugin needs to be told about debugger tuning.
Differential Revision: http://reviews.llvm.org/D16094
llvm-svn: 258712
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 11 | ||||
-rw-r--r-- | clang/test/Driver/lto.c | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 574bf5cd77d..2bbcb275a4b 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -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 diff --git a/clang/test/Driver/lto.c b/clang/test/Driver/lto.c index 3f66274ee6f..d2f68f571af 100644 --- a/clang/test/Driver/lto.c +++ b/clang/test/Driver/lto.c @@ -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 |