aboutsummaryrefslogtreecommitdiff
path: root/tools/pnacl-llc/pnacl-llc.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eliben@chromium.org>2013-06-24 12:55:09 -0700
committerEli Bendersky <eliben@chromium.org>2013-06-24 12:55:09 -0700
commit74982fb5aaa97800530c5b4d392c1e54856ae423 (patch)
tree5621a30cb5fbd042601ac11f35ea360b434b95bb /tools/pnacl-llc/pnacl-llc.cpp
parent9bdedeb556e162cecaa79aff339150ea53aae99f (diff)
Force user to provide -mptriple to pnacl-llc.
We already always provide -mptriple to pnacl-llc, and it's nonsensical to run it without it because pexe don't contain a triple. BUG=None R=dschuff@chromium.org Review URL: https://codereview.chromium.org/17617002
Diffstat (limited to 'tools/pnacl-llc/pnacl-llc.cpp')
-rw-r--r--tools/pnacl-llc/pnacl-llc.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/tools/pnacl-llc/pnacl-llc.cpp b/tools/pnacl-llc/pnacl-llc.cpp
index 40f1a4e8db..551c8c71b2 100644
--- a/tools/pnacl-llc/pnacl-llc.cpp
+++ b/tools/pnacl-llc/pnacl-llc.cpp
@@ -131,7 +131,7 @@ OptLevel("O",
cl::init(' '));
static cl::opt<std::string>
-TargetTriple("mtriple", cl::desc("Override target triple for module"));
+UserDefinedTriple("mtriple", cl::desc("Set target triple"));
cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
cl::desc("Do not verify input module"));
@@ -338,13 +338,12 @@ static int compileModule(char **argv, LLVMContext &Context) {
createAddPNaClExternalDeclsPass());
AddPNaClExternalDeclsPass->runOnModule(*mod);
- // If we are supposed to override the target triple, do so now.
- if (!TargetTriple.empty())
- mod->setTargetTriple(Triple::normalize(TargetTriple));
- TheTriple = Triple(mod->getTargetTriple());
-
- if (TheTriple.getTriple().empty())
- TheTriple.setTriple(sys::getDefaultTargetTriple());
+ if (UserDefinedTriple.empty()) {
+ report_fatal_error("-mtriple must be set to a target triple for pnacl-llc");
+ } else {
+ mod->setTargetTriple(Triple::normalize(UserDefinedTriple));
+ TheTriple = Triple(mod->getTargetTriple());
+ }
// Get the target specific parser.
std::string Error;