[PATCH] D158073: [llvm-jitlink] Add target override option to cli
Eymen Ünay via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 07:49:04 PDT 2023
Eymay updated this revision to Diff 551511.
Eymay added a comment.
reword comment and reformat code
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158073/new/
https://reviews.llvm.org/D158073
Files:
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Index: llvm/tools/llvm-jitlink/llvm-jitlink.cpp
===================================================================
--- llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -103,6 +103,11 @@
cl::desc("Add system library paths to library search paths"),
cl::init(false), cl::cat(JITLinkCategory));
+static cl::opt<std::string>
+ TripleName("triple",
+ cl::desc("Override the detected target triple for disassembler"),
+ cl::cat(JITLinkCategory));
+
static cl::opt<bool> NoExec("noexec", cl::desc("Do not execute loaded code"),
cl::init(false), cl::cat(JITLinkCategory));
@@ -1997,7 +2002,17 @@
std::unique_ptr<JITLinkTimers> Timers =
ShowTimes ? std::make_unique<JITLinkTimers>() : nullptr;
+ // Infer the target and override TT if triple is given by user
auto [TT, Features] = getFirstFileTripleAndFeatures();
+ if (TripleName != "") {
+ TT = Triple(Triple::normalize(TripleName));
+ std::string ErrorStr;
+ if (!TargetRegistry::lookupTarget("", TT, ErrorStr))
+ ExitOnErr(make_error<StringError>("Error accessing target '" +
+ TripleName + "': " + ErrorStr,
+ inconvertibleErrorCode()));
+ }
+
ExitOnErr(sanitizeArguments(TT, argv[0]));
auto S = ExitOnErr(Session::Create(std::move(TT), std::move(Features)));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158073.551511.patch
Type: text/x-patch
Size: 1444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230818/5761463e/attachment.bin>
More information about the llvm-commits
mailing list