diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-06-17 16:24:42 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-06-17 16:24:42 -0700 |
commit | 139165f35e841945b94685bdd91243f5b14d0a7a (patch) | |
tree | a3ebc050a54bee854a0e8170bc2abc8fc3511873 /tools/pnacl-llc | |
parent | b1f3b6883c3b106c76088ae4d09e31c765a7667a (diff) |
PNaCl: Turn on ABI verifier by default in sandboxed translator
Change pnacl-llc.cpp to enable the verifier. This causes two problems
which we fix:
* The ABI check for declared-but-not-defined functions fails in
streaming mode. Fixing this would involve changing the bitcode
reader. For now, disable this check when in streaming mode. Add a
flag to PNaClABIVerifyModule.
* ARM's GlobalMerge pass modifies functions' global variable
references to use ConstantExprs that the ABI checker rejects.
Address this by disabling GlobalMerge for now.
GlobalMerge does not provide much benefit at the moment anyway,
because, with the FlattenGlobals pass applied, GlobalMerge doesn't
merge variables with alignment >1.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3465
TEST=PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/17190002
Diffstat (limited to 'tools/pnacl-llc')
-rw-r--r-- | tools/pnacl-llc/pnacl-llc.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/pnacl-llc/pnacl-llc.cpp b/tools/pnacl-llc/pnacl-llc.cpp index 84f216914a..a2a6f3ec05 100644 --- a/tools/pnacl-llc/pnacl-llc.cpp +++ b/tools/pnacl-llc/pnacl-llc.cpp @@ -258,6 +258,12 @@ int llc_main(int argc, char **argv) { // Register the target printer for --version. cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion); + // Enable the PNaCl ABI verifier by default in sandboxed mode. +#if defined(__native_client__) + PNaClABIVerify = true; + PNaClABIVerifyFatalErrors = true; +#endif + cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n"); // Compile the module TimeCompilations times to give better compile time @@ -329,7 +335,8 @@ static int compileModule(char **argv, LLVMContext &Context) { // @LOCALMOD-BEGIN if (PNaClABIVerify) { // Verify the module (but not the functions yet) - ModulePass *VerifyPass = createPNaClABIVerifyModulePass(&ABIErrorReporter); + ModulePass *VerifyPass = createPNaClABIVerifyModulePass(&ABIErrorReporter, + LazyBitcode); VerifyPass->runOnModule(*mod); CheckABIVerifyErrors(ABIErrorReporter, "Module"); } |