[ASan/Win] Don't instrument private COMDAT globals until PR20244 is properly fixed
authorTimur Iskhodzhanov <timurrrr@google.com>
Tue, 8 Jul 2014 13:18:58 +0000 (13:18 +0000)
committerTimur Iskhodzhanov <timurrrr@google.com>
Tue, 8 Jul 2014 13:18:58 +0000 (13:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212530 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/AddressSanitizer.cpp

index 65f769cf16e61fac622b75b151ac0d0a9b6ca854..8f9355cb8311ae59b40c1aa3224b28b78b0d302a 100644 (file)
@@ -946,6 +946,13 @@ bool AddressSanitizerModule::ShouldInstrumentGlobal(GlobalVariable *G) {
     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()) {
     StringRef Section(G->getSection());
     // Ignore the globals from the __OBJC section. The ObjC runtime assumes