[PATCH] D93749: [llvm-dwp] Add a command line option to set the target triple

Philip Pfaffe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 00:45:08 PST 2020


pfaffe created this revision.
Herald added subscribers: pengfei, sunfish, dschuff.
pfaffe requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

The llvm-dwp tool hard-codes the target triple to x86. Instead, add a command
line option for overriding the default triple to support alternative targets
such as WebAssembly as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93749

Files:
  llvm/tools/llvm-dwp/llvm-dwp.cpp


Index: llvm/tools/llvm-dwp/llvm-dwp.cpp
===================================================================
--- llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -64,6 +64,10 @@
                                            cl::value_desc("filename"),
                                            cl::cat(DwpCategory));
 
+static cl::opt<std::string>
+    TargetTriple("triple", cl::desc("Override target triple for module"),
+                 cl::init("x86_64-linux-gnu"));
+
 static void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
                                    MCSection *StrOffsetSection,
                                    StringRef CurStrSection,
@@ -709,7 +713,7 @@
   std::string ErrorStr;
   StringRef Context = "dwarf streamer init";
 
-  Triple TheTriple("x86_64-linux-gnu");
+  Triple TheTriple(TargetTriple);
 
   // Get the target.
   const Target *TheTarget =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93749.313499.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201223/b7060430/attachment.bin>


More information about the llvm-commits mailing list