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 | 2fa38f8ce07466e8a80716ee575c38066dab1f80 (patch) | |
| tree | d4c6a4f718e71e4b6cdf7f60d7f6434d4fec8468 /llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | |
| parent | 81f06df699ae30113fcdf6f84c4876f8aac45d89 (diff) | |
| download | bcm5719-llvm-2fa38f8ce07466e8a80716ee575c38066dab1f80.tar.gz bcm5719-llvm-2fa38f8ce07466e8a80716ee575c38066dab1f80.zip | |
[asan] extend the blacklist functionality to handle global-init. Patch by Reid Watson
llvm-svn: 163199
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 42f21d2983a..33047293658 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/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( |

