Add "-mcpu=" option to llvm-rtdyld
authorPetar Jovanovic <petar.jovanovic@imgtec.com>
Tue, 23 Jun 2015 22:52:19 +0000 (22:52 +0000)
committerPetar Jovanovic <petar.jovanovic@imgtec.com>
Tue, 23 Jun 2015 22:52:19 +0000 (22:52 +0000)
This patch adds the -mcpu= option to llvm-rtdyld. With this option, one
can test relocations for different types of CPUs (e.g. Mips64r6).

Patch by Vladimir Radosavljevic.

Differential Revision: http://reviews.llvm.org/D10503

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240477 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-rtdyld/llvm-rtdyld.cpp

index 5bc18d3bfbec695119616753e0a7f1fc08a9e7fa..addea5884726ed499c1bad80388716d4bf983162 100644 (file)
@@ -82,6 +82,12 @@ Dylibs("dylib",
 static cl::opt<std::string>
 TripleName("triple", cl::desc("Target triple for disassembler"));
 
+static cl::opt<std::string>
+MCPU("mcpu",
+     cl::desc("Target a specific cpu type (-mcpu=help for details)"),
+     cl::value_desc("cpu-name"),
+     cl::init(""));
+
 static cl::list<std::string>
 CheckFiles("check",
            cl::desc("File containing RuntimeDyld verifier checks."),
@@ -539,7 +545,7 @@ static int linkAndVerify() {
   TripleName = TheTriple.getTriple();
 
   std::unique_ptr<MCSubtargetInfo> STI(
-    TheTarget->createMCSubtargetInfo(TripleName, "", ""));
+    TheTarget->createMCSubtargetInfo(TripleName, MCPU, ""));
   assert(STI && "Unable to create subtarget info!");
 
   std::unique_ptr<MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TripleName));