mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-06 21:27:23 +00:00
[ASan/Win] Don't instrument COMDAT globals. Properly fixes PR20244.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212596 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -923,11 +923,14 @@ bool AddressSanitizerModule::ShouldInstrumentGlobal(GlobalVariable *G) {
|
|||||||
if (!G->hasInitializer()) return false;
|
if (!G->hasInitializer()) return false;
|
||||||
if (GlobalWasGeneratedByAsan(G)) return false; // Our own global.
|
if (GlobalWasGeneratedByAsan(G)) return false; // Our own global.
|
||||||
// Touch only those globals that will not be defined in other modules.
|
// Touch only those globals that will not be defined in other modules.
|
||||||
// Don't handle ODR type linkages since other modules may be built w/o asan.
|
// Don't handle ODR linkage types and COMDATs since other modules may be built
|
||||||
|
// without ASan.
|
||||||
if (G->getLinkage() != GlobalVariable::ExternalLinkage &&
|
if (G->getLinkage() != GlobalVariable::ExternalLinkage &&
|
||||||
G->getLinkage() != GlobalVariable::PrivateLinkage &&
|
G->getLinkage() != GlobalVariable::PrivateLinkage &&
|
||||||
G->getLinkage() != GlobalVariable::InternalLinkage)
|
G->getLinkage() != GlobalVariable::InternalLinkage)
|
||||||
return false;
|
return false;
|
||||||
|
if (G->hasComdat())
|
||||||
|
return false;
|
||||||
// Two problems with thread-locals:
|
// Two problems with thread-locals:
|
||||||
// - The address of the main thread's copy can't be computed at link-time.
|
// - The address of the main thread's copy can't be computed at link-time.
|
||||||
// - Need to poison all copies, not just the main thread's one.
|
// - Need to poison all copies, not just the main thread's one.
|
||||||
@@ -946,13 +949,6 @@ bool AddressSanitizerModule::ShouldInstrumentGlobal(GlobalVariable *G) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't instrument private COMDAT globals on Windows until PR20244 (linkage
|
|
||||||
// of vftables with RTTI) is properly fixed.
|
|
||||||
llvm::Triple TargetTriple(G->getParent()->getTargetTriple());
|
|
||||||
if (G->hasComdat() && G->getLinkage() == GlobalVariable::PrivateLinkage &&
|
|
||||||
TargetTriple.isWindowsMSVCEnvironment())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (G->hasSection()) {
|
if (G->hasSection()) {
|
||||||
StringRef Section(G->getSection());
|
StringRef Section(G->getSection());
|
||||||
// Ignore the globals from the __OBJC section. The ObjC runtime assumes
|
// Ignore the globals from the __OBJC section. The ObjC runtime assumes
|
||||||
|
Reference in New Issue
Block a user