[asan] don't instrument linker-initialized globals even with external linkage in -asan-initialization-order mode

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168367 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kostya Serebryany
2012-11-20 13:11:32 +00:00
parent ca23d43084
commit 407790604b
2 changed files with 26 additions and 6 deletions

View File

@@ -364,11 +364,9 @@ void AddressSanitizer::instrumentMop(Instruction *I) {
if (!ClInitializers)
return;
// If a global variable does not have dynamic initialization we don't
// have to instrument it. However, if a global has external linkage, we
// assume it has dynamic initialization, as it may have an initializer
// in a different TU.
if (G->getLinkage() != GlobalVariable::ExternalLinkage &&
!DynamicallyInitializedGlobals.Contains(G))
// have to instrument it. However, if a global does not have initailizer
// at all, we assume it has dynamic initializer (in other TU).
if (G->hasInitializer() && !DynamicallyInitializedGlobals.Contains(G))
return;
}
}