aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2013-07-10 09:08:19 -0700
committerDerek Schuff <dschuff@chromium.org>2013-07-10 09:08:19 -0700
commitf5dd243794b81819994b4fce6037ac652dd9f3d8 (patch)
tree47e6001fa5f415a36e5e6cafa4a4a4ce672faffd /tools
parent299c82a21a9fd010534ea59c46ae0b88c21f25b7 (diff)
Add option to pnacl-abicheck to handle pnacl bitcode
This allows running the utility on finalized/frozen pexes. R=kschimpf@google.com BUG=none Review URL: https://codereview.chromium.org/18884003
Diffstat (limited to 'tools')
-rw-r--r--tools/pnacl-abicheck/CMakeLists.txt2
-rw-r--r--tools/pnacl-abicheck/LLVMBuild.txt2
-rw-r--r--tools/pnacl-abicheck/Makefile2
-rw-r--r--tools/pnacl-abicheck/pnacl-abicheck.cpp14
4 files changed, 16 insertions, 4 deletions
diff --git a/tools/pnacl-abicheck/CMakeLists.txt b/tools/pnacl-abicheck/CMakeLists.txt
index f75731bcf4..fda6d26ac8 100644
--- a/tools/pnacl-abicheck/CMakeLists.txt
+++ b/tools/pnacl-abicheck/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(LLVM_LINK_COMPONENTS bitreader asmparser naclanalysis)
+set(LLVM_LINK_COMPONENTS bitreader naclbitreader irreader asmparser naclanalysis)
add_llvm_tool(pnacl-abicheck
pnacl-abicheck.cpp
diff --git a/tools/pnacl-abicheck/LLVMBuild.txt b/tools/pnacl-abicheck/LLVMBuild.txt
index 92311c59b6..9e45f87f0a 100644
--- a/tools/pnacl-abicheck/LLVMBuild.txt
+++ b/tools/pnacl-abicheck/LLVMBuild.txt
@@ -19,4 +19,4 @@
type = Tool
name = pnacl-abicheck
parent = Tools
-required_libraries = AsmParser BitReader NaClAnalysis
+required_libraries = AsmParser BitReader NaClBitReader IRReader NaClAnalysis
diff --git a/tools/pnacl-abicheck/Makefile b/tools/pnacl-abicheck/Makefile
index 5f10e81ce9..97e2d22399 100644
--- a/tools/pnacl-abicheck/Makefile
+++ b/tools/pnacl-abicheck/Makefile
@@ -9,7 +9,7 @@
LEVEL := ../..
TOOLNAME := pnacl-abicheck
-LINK_COMPONENTS := bitreader asmparser naclanalysis
+LINK_COMPONENTS := bitreader asmparser naclbitreader irreader naclanalysis
include $(LEVEL)/Makefile.common
diff --git a/tools/pnacl-abicheck/pnacl-abicheck.cpp b/tools/pnacl-abicheck/pnacl-abicheck.cpp
index 06b174d1b8..8b96f17954 100644
--- a/tools/pnacl-abicheck/pnacl-abicheck.cpp
+++ b/tools/pnacl-abicheck/pnacl-abicheck.cpp
@@ -13,6 +13,7 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Analysis/NaCl.h"
+#include "llvm/IRReader/IRReader.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"
@@ -29,6 +30,16 @@ InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
static cl::opt<bool>
Quiet("q", cl::desc("Do not print error messages"));
+static cl::opt<NaClFileFormat>
+InputFileFormat(
+ "bitcode-format",
+ cl::desc("Define format of input file:"),
+ cl::values(
+ clEnumValN(LLVMFormat, "llvm", "LLVM file (default)"),
+ clEnumValN(PNaClFormat, "pnacl", "PNaCl bitcode file"),
+ clEnumValEnd),
+ cl::init(LLVMFormat));
+
// Print any errors collected by the error reporter. Return true if
// there were any.
static bool CheckABIVerifyErrors(PNaClABIErrorReporter &Reporter,
@@ -49,7 +60,8 @@ int main(int argc, char **argv) {
SMDiagnostic Err;
cl::ParseCommandLineOptions(argc, argv, "PNaCl Bitcode ABI checker\n");
- OwningPtr<Module> Mod(ParseIRFile(InputFilename, Err, Context));
+ OwningPtr<Module> Mod(
+ NaClParseIRFile(InputFilename, InputFileFormat, Err, Context));
if (Mod.get() == 0) {
Err.print(argv[0], errs());
return 1;