<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Tue, Jul 9, 2013 at 10:22 PM, Bill Wendling <span dir="ltr"><<a href="mailto:isanbard@gmail.com" target="_blank">isanbard@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Okay. I need more information. I can't seem to run 'check-asan' on my machine:<br>

<br>
[bitters:llvm.obj] make check-asan<br>
make: *** No rule to make target `check-asan'.  Stop.<br></blockquote><div><br></div><div style>"check-asan" works in CMake build only.</div><div style>This should work if you have LLVM checkout with Clang at tools/clang, compiler-rt at projects/compiler-rt,</div>
<div style>and configure it as, e.g.</div><div style><span class="">$ </span><span class="" style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px">cmake </span><span class="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;color:rgb(102,102,0)">-</span><span class="" style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px">DCMAKE_BUILD_TYPE</span><span class="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;color:rgb(102,102,0)">=</span><span class="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;color:rgb(102,0,102)">Release</span><span class="" style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px"> </span><span class="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;color:rgb(102,102,0)">/</span><span class="" style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px">path</span><span class="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;color:rgb(102,102,0)">/</span><span class="" style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px">to</span><span class="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;color:rgb(102,102,0)">/</span><span class="" style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px">llvm</span><span class="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px;color:rgb(102,102,0)">/</span><span class="" style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px">checkout</span></div>
<div style><span class="" style="color:rgb(0,0,0);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono','Lucida Console',monospace;font-size:12px">$ make check-asan</span></div><div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
So how does one do that?<br>
<br>
Also, what version of Mac OS X and ld are you using?<br></blockquote><div><br></div><div style>We see the problem on Mac 10.8</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<span class=""><font color="#888888"><br>
-bw<br>
</font></span><div class=""><div class="h5"><br>
On Jul 9, 2013, at 3:02 AM, Alexander Potapenko <<a href="mailto:glider@google.com">glider@google.com</a>> wrote:<br>
<br>
> Reverted in r185923.<br>
><br>
> On Tue, Jul 9, 2013 at 1:28 PM, Alexander Potapenko <<a href="mailto:glider@google.com">glider@google.com</a>> wrote:<br>
>> Hi Bill,<br>
>><br>
>> This patch has totally broken `make check-asan` on Mac.<br>
>> ld reports numerous warnings like this:<br>
>> ld: warning: direct access in __GLOBAL__I_a to global weak symbol<br>
>> ___asan_mapping_scale means the weak symbol cannot be overridden at<br>
>> runtime. This was likely caused by different translation units being<br>
>> compiled with different visibility settings.<br>
>> ld: warning: direct access in __ZL15TestLargeMallocm to global weak<br>
>> symbol __ZTSN7testing8internal15TestFactoryImplI36AddressSanitizer_HugeMallocTest_TestEE<br>
>> means the weak symbol cannot be overridden at runtime. This was likely<br>
>> caused by different translation units being compiled with different<br>
>> visibility settings.<br>
>><br>
>> , after that a huge number of tests die with incorrect ASan reports.<br>
>><br>
>> Reverting your patch locally fixes the problem on my machine.<br>
>><br>
>> On Tue, Jul 9, 2013 at 1:34 AM, Bill Wendling <<a href="mailto:isanbard@gmail.com">isanbard@gmail.com</a>> wrote:<br>
>>> Author: void<br>
>>> Date: Mon Jul  8 16:34:52 2013<br>
>>> New Revision: 185872<br>
>>><br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=185872&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=185872&view=rev</a><br>
>>> Log:<br>
>>> Stop emitting weak symbols into the "coal" sections.<br>
>>><br>
>>> The Mach-O linker has been able to support the weak-def bit on any symbol for<br>
>>> quite a while now. The compiler however continued to place these symbols into a<br>
>>> "coal" section, which required the linker to map them back to the base section<br>
>>> name.<br>
>>><br>
>>> Replace the sections like this:<br>
>>><br>
>>>  __TEXT/__textcoal_nt   instead use  __TEXT/__text<br>
>>>  __TEXT/__const_coal    instead use  __TEXT/__const<br>
>>>  __DATA/__datacoal_nt   instead use  __DATA/__data<br>
>>><br>
>>> <rdar://problem/14265330><br>
>>><br>
>>> Added:<br>
>>>    llvm/trunk/test/CodeGen/X86/no-coal-sections.ll<br>
>>> Modified:<br>
>>>    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp<br>
>>>    llvm/trunk/test/CodeGen/X86/global-sections.ll<br>
>>><br>
>>> Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=185872&r1=185871&r2=185872&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=185872&r1=185871&r2=185872&view=diff</a><br>

>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)<br>
>>> +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Mon Jul  8 16:34:52 2013<br>
>>> @@ -524,14 +524,14 @@ const MCSection *TargetLoweringObjectFil<br>
>>> SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,<br>
>>>                        Mangler *Mang, const TargetMachine &TM) const {<br>
>>>   if (Kind.isText())<br>
>>> -    return GV->isWeakForLinker() ? TextCoalSection : TextSection;<br>
>>> -<br>
>>> -  // If this is weak/linkonce, put this in a coalescable section, either in text<br>
>>> -  // or data depending on if it is writable.<br>
>>> +    return TextSection;<br>
>>> +<br>
>>> +  // If this is weak/linkonce, put this in a read only or data section depending<br>
>>> +  // on whether or not it's writable.<br>
>>>   if (GV->isWeakForLinker()) {<br>
>>>     if (Kind.isReadOnly())<br>
>>> -      return ConstTextCoalSection;<br>
>>> -    return DataCoalSection;<br>
>>> +      return ReadOnlySection;<br>
>>> +    return DataSection;<br>
>>>   }<br>
>>><br>
>>>   // FIXME: Alignment check should be handled by section classifier.<br>
>>><br>
>>> Modified: llvm/trunk/test/CodeGen/X86/global-sections.ll<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=185872&r1=185871&r2=185872&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/global-sections.ll?rev=185872&r1=185871&r2=185872&view=diff</a><br>

>>> ==============================================================================<br>
>>> --- llvm/trunk/test/CodeGen/X86/global-sections.ll (original)<br>
>>> +++ llvm/trunk/test/CodeGen/X86/global-sections.ll Mon Jul  8 16:34:52 2013<br>
>>> @@ -20,7 +20,7 @@<br>
>>><br>
>>> ; TODO: linux drops this into .rodata, we drop it into ".gnu.linkonce.r.G2"<br>
>>><br>
>>> -; DARWIN: .section __TEXT,__const_coal,coalesced<br>
>>> +; DARWIN: .section __TEXT,__const<br>
>>> ; DARWIN: _G2:<br>
>>> ; DARWIN:    .long 42<br>
>>><br>
>>> @@ -70,7 +70,6 @@<br>
>>> ; LINUX: .weak foo_20_bar<br>
>>> ; LINUX: foo_20_bar:<br>
>>><br>
>>> -; DARWIN: .section             __DATA,__datacoal_nt,coalesced<br>
>>> ; DARWIN: .globl       "_foo bar"<br>
>>> ; DARWIN:      .weak_definition "_foo bar"<br>
>>> ; DARWIN: "_foo bar":<br>
>>> @@ -85,7 +84,7 @@<br>
>>> ; LINUX:   .byte       1<br>
>>> ; LINUX:   .size       G6, 1<br>
>>><br>
>>> -; DARWIN:  .section __TEXT,__const_coal,coalesced<br>
>>> +; DARWIN:  .section __TEXT,__const<br>
>>> ; DARWIN:  .globl _G6<br>
>>> ; DARWIN:  .weak_definition _G6<br>
>>> ; DARWIN:_G6:<br>
>>> @@ -131,7 +130,7 @@<br>
>>> @G10 = weak global [100 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=0]<br>
>>><br>
>>><br>
>>> -; DARWIN:      .section        __DATA,__datacoal_nt,coalesced<br>
>>> +; DARWIN:      .section        __DATA,__data<br>
>>> ; DARWIN: .globl _G10<br>
>>> ; DARWIN:      .weak_definition _G10<br>
>>> ; DARWIN:      .align  5<br>
>>><br>
>>> Added: llvm/trunk/test/CodeGen/X86/no-coal-sections.ll<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/no-coal-sections.ll?rev=185872&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/no-coal-sections.ll?rev=185872&view=auto</a><br>

>>> ==============================================================================<br>
>>> --- llvm/trunk/test/CodeGen/X86/no-coal-sections.ll (added)<br>
>>> +++ llvm/trunk/test/CodeGen/X86/no-coal-sections.ll Mon Jul  8 16:34:52 2013<br>
>>> @@ -0,0 +1,74 @@<br>
>>> +; RUN: llc < %s -mtriple x86_64-apple-macosx10 | FileCheck %s<br>
>>> +; <rdar://problem/14265330><br>
>>> +<br>
>>> +; CHECK:     .section __TEXT,__text<br>
>>> +; CHECK-NOT: .section __TEXT,__textcoal_nt<br>
>>> +; CHECK:     .globl __ZN6TrickyIiLi0EEC1Ev<br>
>>> +<br>
>>> +; CHECK:     .section __DATA,__data<br>
>>> +; CHECK-NOT: .section __DATA,__datacoal_nt<br>
>>> +; CHECK:     .globl __ZTV6TrickyIiLi0EE<br>
>>> +<br>
>>> +; CHECK:     .section __TEXT,__const<br>
>>> +; CHECK-NOT: .section __TEXT,__const_coal<br>
>>> +; CHECK:     .globl __ZTS6TrickyIiLi0EE<br>
>>> +<br>
>>> +; CHECK:     .section __DATA,__data<br>
>>> +; CHECK-NOT: .section __DATA,__datacoal_nt<br>
>>> +; CHECK:     .globl __ZTI6TrickyIiLi0EE<br>
>>> +<br>
>>> +%class.Tricky = type { i32 (...)**, %union.anon }<br>
>>> +%union.anon = type { i32 }<br>
>>> +<br>
>>> +@_ZTV6TrickyIiLi0EE = linkonce_odr unnamed_addr constant [4 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI6TrickyIiLi0EE to i8*), i8* bitcast (void (%class.Tricky*)* @_ZN6TrickyIiLi0EED1Ev to i8*), i8* bitcast (void (%class.Tricky*)* @_ZN6TrickyIiLi0EED0Ev to i8*)]<br>

>>> +@_ZTVN10__cxxabiv117__class_type_infoE = external global i8*<br>
>>> +@_ZTS6TrickyIiLi0EE = linkonce_odr constant [15 x i8] c"6TrickyIiLi0EE\00"<br>
>>> +@_ZTI6TrickyIiLi0EE = linkonce_odr unnamed_addr constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([15 x i8]* @_ZTS6TrickyIiLi0EE, i32 0, i32 0) }<br>

>>> +<br>
>>> +; Function Attrs: nounwind ssp uwtable<br>
>>> +define i32 @main() {<br>
>>> +entry:<br>
>>> +  %ok = alloca %class.Tricky, align 8<br>
>>> +  call void @_ZN6TrickyIiLi0EEC1Ev(%class.Tricky* %ok)<br>
>>> +  ret i32 0<br>
>>> +}<br>
>>> +<br>
>>> +; Function Attrs: inlinehint nounwind ssp uwtable<br>
>>> +define linkonce_odr void @_ZN6TrickyIiLi0EEC1Ev(%class.Tricky* nocapture %this) unnamed_addr align 2 {<br>
>>> +entry:<br>
>>> +  tail call void @_ZN6TrickyIiLi0EEC2Ev(%class.Tricky* %this)<br>
>>> +  ret void<br>
>>> +}<br>
>>> +<br>
>>> +; Function Attrs: nounwind readnone ssp uwtable<br>
>>> +define linkonce_odr void @_ZN6TrickyIiLi0EED1Ev(%class.Tricky* nocapture %this) unnamed_addr align 2 {<br>
>>> +entry:<br>
>>> +  ret void<br>
>>> +}<br>
>>> +<br>
>>> +; Function Attrs: nounwind readnone ssp uwtable<br>
>>> +define linkonce_odr void @_ZN6TrickyIiLi0EED2Ev(%class.Tricky* nocapture %this) unnamed_addr align 2 {<br>
>>> +entry:<br>
>>> +  ret void<br>
>>> +}<br>
>>> +<br>
>>> +; Function Attrs: inlinehint nounwind ssp uwtable<br>
>>> +define linkonce_odr void @_ZN6TrickyIiLi0EEC2Ev(%class.Tricky* nocapture %this) unnamed_addr align 2 {<br>
>>> +entry:<br>
>>> +  %0 = getelementptr inbounds %class.Tricky* %this, i64 0, i32 0<br>
>>> +  store i32 (...)** bitcast (i8** getelementptr inbounds ([4 x i8*]* @_ZTV6TrickyIiLi0EE, i64 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8<br>
>>> +  ret void<br>
>>> +}<br>
>>> +<br>
>>> +; Function Attrs: nounwind ssp uwtable<br>
>>> +define linkonce_odr void @_ZN6TrickyIiLi0EED0Ev(%class.Tricky* %this) unnamed_addr align 2 {<br>
>>> +invoke.cont:<br>
>>> +  %0 = bitcast %class.Tricky* %this to i8*<br>
>>> +  tail call void @_ZdlPv(i8* %0)<br>
>>> +  ret void<br>
>>> +}<br>
>>> +<br>
>>> +declare i32 @__gxx_personality_v0(...)<br>
>>> +<br>
>>> +; Function Attrs: nounwind<br>
>>> +declare void @_ZdlPv(i8*)<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> llvm-commits mailing list<br>
>>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
>><br>
>> --<br>
>> Alexander Potapenko<br>
>> Software Engineer<br>
>> Google Moscow<br>
><br>
><br>
><br>
> --<br>
> Alexander Potapenko<br>
> Software Engineer<br>
> Google Moscow<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div></div>