diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-06-13 15:50:59 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-06-13 15:50:59 -0700 |
commit | 81aece3b90250dd6dd1bd99af3f5c7b516ed4628 (patch) | |
tree | f3ac2d5ebafe0f544377465ccd9464c309fcce30 /lib/Analysis | |
parent | 9b861c2166a7a2e388466097ec73613896e7373b (diff) |
PNaCl: Strip more unwanted attributes: "align" on functions and "unnamed_addr"
Do this stripping in the StripAttributes pass. Change the pass to be
a ModulePass so that it can modify global variables.
Change the ABI verifier to check this.
Also update a comment about "nuw" and "nsw".
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3415
TEST=*.ll tests + PNaCl toolchain trybots
Review URL: https://codereview.chromium.org/16991002
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/NaCl/PNaClABIVerifyModule.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp index b68ac29a9e..baa072f390 100644 --- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp +++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp @@ -125,6 +125,13 @@ void PNaClABIVerifyModule::checkGlobalValueCommon(const GlobalValue *GV) { Reporter->addError() << GVTypeName << GV->getName() << " has addrspace attribute (disallowed)\n"; } + // The "unnamed_addr" attribute can be used to merge duplicate + // definitions, but that should be done by user-toolchain + // optimization passes, not by the PNaCl translator. + if (GV->hasUnnamedAddr()) { + Reporter->addError() << GVTypeName << GV->getName() + << " has disallowed \"unnamed_addr\" attribute\n"; + } } static bool TypeAcceptable(const Type *T, @@ -400,6 +407,13 @@ bool PNaClABIVerifyModule::runOnModule(Module &M) { Reporter->addError() << "Function " << MI->getName() << " has disallowed \"gc\" attribute\n"; } + // Knowledge of what function alignments are useful is + // architecture-specific and sandbox-specific, so PNaCl pexes + // should not be able to specify function alignment. + if (MI->getAlignment() != 0) { + Reporter->addError() << "Function " << MI->getName() << + " has disallowed \"align\" attribute\n"; + } } // Check named metadata nodes |