diff options
author | Kostya Serebryany <kcc@google.com> | 2012-09-05 07:29:56 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2012-09-05 07:29:56 +0000 |
commit | 59a4a47a7bea7cc17877c6a3954ad9f8309ff1cb (patch) | |
tree | 4e0afbded7546e5e6526c145d51758c1a50509ae /lib/Transforms/Instrumentation/AddressSanitizer.cpp | |
parent | 4e4e6c0d732f34d4a7adbad40d60e7fc055eaed4 (diff) | |
download | external_llvm-59a4a47a7bea7cc17877c6a3954ad9f8309ff1cb.zip external_llvm-59a4a47a7bea7cc17877c6a3954ad9f8309ff1cb.tar.gz external_llvm-59a4a47a7bea7cc17877c6a3954ad9f8309ff1cb.tar.bz2 |
[asan] extend the blacklist functionality to handle global-init. Patch by Reid Watson
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/AddressSanitizer.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/AddressSanitizer.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 42f21d2..3304729 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -544,6 +544,7 @@ bool AddressSanitizer::ShouldInstrumentGlobal(GlobalVariable *G) { Type *Ty = cast<PointerType>(G->getType())->getElementType(); DEBUG(dbgs() << "GLOBAL: " << *G); + if (BL->isIn(*G)) return false; if (!Ty->isSized()) return false; if (!G->hasInitializer()) return false; // Touch only those globals that will not be defined in other modules. @@ -643,6 +644,8 @@ bool AddressSanitizer::insertGlobalRedzones(Module &M) { Type *RightRedZoneTy = ArrayType::get(IRB.getInt8Ty(), RightRedzoneSize); // Determine whether this global should be poisoned in initialization. bool GlobalHasDynamicInitializer = HasDynamicInitializer(G); + // Don't check initialization order if this global is blacklisted. + GlobalHasDynamicInitializer &= ! BL->isInInit(*G); StructType *NewTy = StructType::get(Ty, RightRedZoneTy, NULL); Constant *NewInitializer = ConstantStruct::get( |