diff options
| author | Mark Seaborn <mseaborn@chromium.org> | 2013-04-10 09:37:34 -0700 |
|---|---|---|
| committer | Mark Seaborn <mseaborn@chromium.org> | 2013-04-10 09:37:34 -0700 |
| commit | 76cd6aea1dd6e7a446f1e21ac05bc822a50d48ac (patch) | |
| tree | 6c471fcadfa73d4b4a4ef463200bf1d186d1adb4 /lib/Analysis/NaCl/PNaClABIVerifyModule.cpp | |
| parent | 7ff3c9d24918270e4a001c712e2e153d7e27da5e (diff) | |
PNaCl ABI checker: Disallow "section", "thread_local" and "gc" attributes
* Disallow "section" on functions and global variables.
* Disallow "thread_local" on global variables.
* Disallow "gc" on functions.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=2837
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3126
TEST=test/NaCl/PNaClABI/global-attributes.ll + PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/14063007
Diffstat (limited to 'lib/Analysis/NaCl/PNaClABIVerifyModule.cpp')
| -rw-r--r-- | lib/Analysis/NaCl/PNaClABIVerifyModule.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp index 23699860b0..d98868f53c 100644 --- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp +++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp @@ -112,6 +112,15 @@ bool PNaClABIVerifyModule::runOnModule(Module &M) { " has disallowed linkage type: " << linkageName(MI->getLinkage()) << "\n"; } + + if (MI->hasSection()) { + Reporter->addError() << "Variable " << MI->getName() << + " has disallowed \"section\" attribute\n"; + } + if (MI->isThreadLocal()) { + Reporter->addError() << "Variable " << MI->getName() << + " has disallowed \"thread_local\" attribute\n"; + } } // No aliases allowed for now. for (Module::alias_iterator MI = M.alias_begin(), @@ -136,6 +145,15 @@ bool PNaClABIVerifyModule::runOnModule(Module &M) { PNaClABITypeChecker::getTypeName(PT) << "\n"; } } + + if (MI->hasSection()) { + Reporter->addError() << "Function " << MI->getName() << + " has disallowed \"section\" attribute\n"; + } + if (MI->hasGC()) { + Reporter->addError() << "Function " << MI->getName() << + " has disallowed \"gc\" attribute\n"; + } } // Check named metadata nodes |
