diff options
author | Mark Seaborn <mseaborn@chromium.org> | 2013-06-04 14:48:37 -0700 |
---|---|---|
committer | Mark Seaborn <mseaborn@chromium.org> | 2013-06-04 14:48:37 -0700 |
commit | a4dba98995121b623698f1b8951da71e17ec634d (patch) | |
tree | d7389ff9993f7d25fa7ba3b9a755886a1da3a57d /lib/Analysis | |
parent | 012feeb588d28e5604f0ab9f9d9555e63fd68648 (diff) |
PNaCl ABI checker: Reject the "addrspace" attribute
It doesn't appear to be possible to set the address space on a
Function, but we can still put the check in checkGlobalValueCommon()
in case this changes in the future.
BUG=https://code.google.com/p/nativeclient/issues/detail?id=3343
TEST=*.ll tests
Review URL: https://codereview.chromium.org/15993019
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp | 2 | ||||
-rw-r--r-- | lib/Analysis/NaCl/PNaClABIVerifyModule.cpp | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp b/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp index edb0e5fad2..43eef2f6c0 100644 --- a/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp +++ b/lib/Analysis/NaCl/PNaClABIVerifyFunctions.cpp @@ -82,6 +82,8 @@ bool PNaClABIVerifyFunctions::IsWhitelistedMetadata(unsigned MDKind) { // * a function pointer (with valid argument and return types). static bool isValidPointerType(Type *Ty) { if (PointerType *PtrTy = dyn_cast<PointerType>(Ty)) { + if (PtrTy->getAddressSpace() != 0) + return false; if (PNaClABITypeChecker::isValidScalarType(PtrTy->getElementType())) return true; if (FunctionType *FTy = dyn_cast<FunctionType>(PtrTy->getElementType())) diff --git a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp index cbe7eb833f..364614f9a2 100644 --- a/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp +++ b/lib/Analysis/NaCl/PNaClABIVerifyModule.cpp @@ -121,6 +121,10 @@ void PNaClABIVerifyModule::checkGlobalValueCommon(const GlobalValue *GV) { Reporter->addError() << GVTypeName << GV->getName() << " has disallowed \"section\" attribute\n"; } + if (GV->getType()->getAddressSpace() != 0) { + Reporter->addError() << GVTypeName << GV->getName() + << " has addrspace attribute (disallowed)\n"; + } } static bool TypeAcceptable(const Type *T, |