diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-05-28 11:49:59 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-05-28 11:49:59 -0700 |
commit | 7b1d0b48c95f7b9861b890c650f039d5cc636e89 (patch) | |
tree | 124702ea552a93292a8e43ace8364a77a4886e51 /lib/Analysis | |
parent | ffc13bcb40d4257202295fc0ffe25b38bdf64263 (diff) |
PNaCl ABI checker: Disallow inline assembly
Reject module-level assembly and inline assembly within functions.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=2345
TEST=*.ll tests + trybots + GCC torture tests
Review URL: https://codereview.chromium.org/16123005
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp | 4 | ||||
-rw-r--r-- | lib/Analysis/NaCl/PNaClABIVerifyModule.cpp | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp b/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp index 2c9a6a17b9..2082c85d01 100644 --- a/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp +++ b/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp @@ -161,6 +161,10 @@ bool PNaClABIVerifyFunctions::runOnFunction(Function &F) { case Instruction::Select: break; case Instruction::Call: + if (cast<CallInst>(BBI)->isInlineAsm()) { + Reporter->addError() << "Function " << F.getName() << + " contains disallowed inline assembly\n"; + } // Pointers to varargs function types are not yet // disallowed, but we do disallow defining or calling // functions of varargs types. diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp index eacb4031b3..2b29c196f1 100644 --- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp +++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp @@ -242,6 +242,11 @@ bool PNaClABIVerifyModule::isWhitelistedMetadata(const NamedMDNode *MD) { } bool PNaClABIVerifyModule::runOnModule(Module &M) { + if (!M.getModuleInlineAsm().empty()) { + Reporter->addError() << + "Module contains disallowed top-level inline assembly\n"; + } + for (Module::const_global_iterator MI = M.global_begin(), ME = M.global_end(); MI != ME; ++MI) { // Check types of global variables and their initializers |