[llvm] r212596 - [ASan/Win] Don't instrument COMDAT globals. Properly fixes PR20244.

Timur Iskhodzhanov timurrrr at google.com
Fri Jul 11 09:41:26 PDT 2014


Test case added in r212828!

2014-07-10 16:13 GMT+04:00 Timur Iskhodzhanov <timurrrr at google.com>:
> Good point.
> I've tried, but got blocked by this bug:
> http://llvm.org/bugs/show_bug.cgi?id=20279
>
> 2014-07-09 23:47 GMT+04:00 Reid Kleckner <rnk at google.com>:
>> This fixes compiler-rt/test/asan/TestCases/Windows/dll_cerr.cc, but I agree,
>> this should have IR-to-IR tests in LLVM proper.
>>
>>
>> On Wed, Jul 9, 2014 at 12:39 PM, Rafael EspĂ­ndola
>> <rafael.espindola at gmail.com> wrote:
>>>
>>> testcase?
>>>
>>> On 9 July 2014 04:35, Timur Iskhodzhanov <timurrrr at google.com> wrote:
>>> > Author: timurrrr
>>> > Date: Wed Jul  9 03:35:33 2014
>>> > New Revision: 212596
>>> >
>>> > URL: http://llvm.org/viewvc/llvm-project?rev=212596&view=rev
>>> > Log:
>>> > [ASan/Win] Don't instrument COMDAT globals. Properly fixes PR20244.
>>> >
>>> > Modified:
>>> >     llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
>>> >
>>> > Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
>>> > URL:
>>> > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=212596&r1=212595&r2=212596&view=diff
>>> >
>>> > ==============================================================================
>>> > --- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
>>> > (original)
>>> > +++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Wed
>>> > Jul  9 03:35:33 2014
>>> > @@ -923,11 +923,14 @@ bool AddressSanitizerModule::ShouldInstr
>>> >    if (!G->hasInitializer()) return false;
>>> >    if (GlobalWasGeneratedByAsan(G)) return false;  // Our own global.
>>> >    // 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 &&
>>> >        G->getLinkage() != GlobalVariable::PrivateLinkage &&
>>> >        G->getLinkage() != GlobalVariable::InternalLinkage)
>>> >      return false;
>>> > +  if (G->hasComdat())
>>> > +    return false;
>>> >    // Two problems with thread-locals:
>>> >    //   - 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.
>>> > @@ -946,13 +949,6 @@ bool AddressSanitizerModule::ShouldInstr
>>> >      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
>>> >
>>> >
>>> > _______________________________________________
>>> > llvm-commits mailing list
>>> > llvm-commits at cs.uiuc.edu
>>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>




More information about the llvm-commits mailing list