[PATCH] D42687: [ELF] - Support -plugin-opt=-debugger-tune=xxx option.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 06:16:39 PST 2018
grimar created this revision.
grimar added reviewers: ruiu, espindola.
Herald added a subscriber: emaste.
This is part of PR36035, currently LLD is unable to recongize
following LTO option:
-plugin-opt=-debugger-tune=XXX, where XXX is one of: gdb, lldb, sce.
It is incompatible with gold LTO plugin.
Patch teaches LLD about the option.
https://reviews.llvm.org/D42687
Files:
ELF/Config.h
ELF/Driver.cpp
ELF/LTO.cpp
test/ELF/lto/debugger-tune.s
Index: test/ELF/lto/debugger-tune.s
===================================================================
--- test/ELF/lto/debugger-tune.s
+++ test/ELF/lto/debugger-tune.s
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: ld.lld %t -plugin-opt=-debugger-tune=gdb -o /dev/null
+# RUN: ld.lld %t -plugin-opt=-debugger-tune=lldb -o /dev/null
+# RUN: ld.lld %t -plugin-opt=-debugger-tune=sce -o /dev/null
+
+# RUN: not ld.lld %t -plugin-opt=-debugger-tune=xxx -o /dev/null 2>&1 | \
+# RUN: FileCheck %s --check-prefix=ERR
+# ERR: error: --plugin-opt=-debugger-tune=xxx: unknown tune 'xxx'
Index: ELF/LTO.cpp
===================================================================
--- ELF/LTO.cpp
+++ ELF/LTO.cpp
@@ -77,6 +77,8 @@
Conf.Options.FunctionSections = true;
Conf.Options.DataSections = true;
+ Conf.Options.DebuggerTuning = Config->LTODebuggerTune;
+
if (Config->Relocatable)
Conf.RelocModel = None;
else if (Config->Pic)
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -589,6 +589,18 @@
return V;
}
+static DebuggerKind parseLTODebuggerTune(StringRef S, opt::Arg *Arg) {
+ if (S == "gdb")
+ return DebuggerKind::GDB;
+ if (S == "lldb")
+ return DebuggerKind::LLDB;
+ if (S == "sce")
+ return DebuggerKind::SCE;
+ error(Arg->getSpelling() + "=" + Arg->getValue() + ": unknown tune '" + S +
+ "'");
+ return DebuggerKind::Default;
+}
+
// Initializes Config members by the command line options.
void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->AllowMultipleDefinition =
@@ -697,6 +709,8 @@
Config->LTOPartitions = parseInt(S.substr(15), Arg);
else if (S.startswith("jobs="))
Config->ThinLTOJobs = parseInt(S.substr(5), Arg);
+ else if (S.startswith("-debugger-tune="))
+ Config->LTODebuggerTune = parseLTODebuggerTune(S.substr(15), Arg);
else if (!S.startswith("/") && !S.startswith("-fresolution=") &&
!S.startswith("-pass-through=") && !S.startswith("mcpu=") &&
!S.startswith("thinlto") && S != "-function-sections" &&
Index: ELF/Config.h
===================================================================
--- ELF/Config.h
+++ ELF/Config.h
@@ -17,6 +17,7 @@
#include "llvm/Support/CachePruning.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Endian.h"
+#include "llvm/Target/TargetOptions.h"
#include <vector>
@@ -180,6 +181,7 @@
unsigned LTOO;
unsigned Optimize;
unsigned ThinLTOJobs;
+ llvm::DebuggerKind LTODebuggerTune = llvm::DebuggerKind::Default;
// The following config options do not directly correspond to any
// particualr command line options.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42687.131959.patch
Type: text/x-patch
Size: 2772 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180130/5f4f4ad2/attachment-0001.bin>
More information about the llvm-commits
mailing list