<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt"><div>I wonder why the following line doesn't help then:</div><div><br></div><div>+      // The Ubsan runtime library requires C++ and CoreFoundation.</div>
<div>+      AddCXXStdlibLibArgs(Args, CmdArgs);</div><br><div class="gmail_quote">On Thu, Nov 15, 2012 at 6:05 PM, Alexander Potapenko <span dir="ltr"><<a href="mailto:glider@google.com" target="_blank">glider@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-lstdc++ should also work on Mac.<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Nov 15, 2012 at 4:52 PM, Alexey Samsonov <<a href="mailto:samsonov@google.com">samsonov@google.com</a>> wrote:<br>
> +glider@<br>
><br>
> Your Darwin-related patches also look good to me. I don't know much about<br>
> Mac world, but I've observed<br>
> similar errors on Linux when I tried to add virtual method calls to ASan<br>
> runtime. To fix this on Linux<br>
> you need to explicitly add "-lstdc++" to linker flags if -fsanitize=address<br>
> is present. I don't know<br>
> what is the analogue of -lstdc++ on Mac.<br>
><br>
> On Thu, Nov 15, 2012 at 4:42 PM, Alexey Samsonov <<a href="mailto:samsonov@google.com">samsonov@google.com</a>><br>
> wrote:<br>
>><br>
>> Hi Jean-Daniel!<br>
>><br>
>> I've applied parts of your patches relevant to Linux+make build support in<br>
>> r168038, r168039.<br>
>><br>
>> On Thu, Nov 15, 2012 at 12:34 AM, Jean-Daniel Dupas<br>
>> <<a href="mailto:devlists@shadowlab.org">devlists@shadowlab.org</a>> wrote:<br>
>>><br>
>>><br>
>>> Le 14 nov. 2012 à 21:11, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> a écrit :<br>
>>><br>
>>> On Wed, Nov 14, 2012 at 7:40 AM, Sean McBride <<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>><br>
>>> wrote:<br>
>>><br>
>>> On Tue, 13 Nov 2012 16:17:39 -0800, Richard Smith said:<br>
>>><br>
>>> Thanks for the prod, I've checked in some pending patches to add OS X<br>
>>> support, in r167888, r167889, and r167890. If you could build<br>
>>> clang_rt.ubsan_osx and let me know whether everything is working as<br>
>>> intended, that'd be great; we can then ask to get those patches pulled<br>
>>> onto the 3.2 branch.<br>
>>><br>
>>><br>
>>> I've rebuilt clang r167897 and still get link errors, ex:<br>
>>><br>
>>> Undefined symbols for architecture x86_64:<br>
>>>  "___ubsan_handle_shift_out_of_bounds", referenced from:<br>
>>><br>
>>><br>
>>> I don't have a Darwin machine to test against. Does the attached patch<br>
>>> help?<br>
>>> <driver-ubsan-darwin.diff><br>
>>><br>
>>><br>
>>> This patch is definitively a step in the right direction.<br>
>>><br>
>>> We need to tweak to clang runtime makefile to tell it to build ubsan on<br>
>>> OS X (ubsan-make.patch).<br>
>>><br>
>>> Also, in the previous compiler-rt patch has an issue. It neither builds<br>
>>> sanitize-common objects, not include them in the ubsan archive.<br>
>>> I fix this by looking at how asan is actually built (ubsan.patch). Note<br>
>>> that this patch make the previous change to the compiler-rt SDK headers<br>
>>> useless, as building sanitizer-common requires a full SDK, and so we now use<br>
>>> the system headers instead of the headers provided by compiler-rt.<br>
>>><br>
>>> But I hit a blocking issue that I don't know how to workaround.<br>
>>> AFAIK, on darwin, there is no library that currently provide "typeinfo<br>
>>> for std::type_info".<br>
>>> The libc++abi provided by OS X does not properly export this symbol (and<br>
>>> other typeinfo related symbols). As ubsan_type_hash.cpp require them, trying<br>
>>> to link a software with the libubsan produce the following error:<br>
>>><br>
>>>   "typeinfo for __cxxabiv1::__class_type_info", referenced from:<br>
>>>       __ubsan::checkDynamicType(void*, void*, unsigned long) in<br>
>>> libclang_rt.ubsan_osx.a(ubsan_type_hash.o)<br>
>>>       isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*,<br>
>>> __cxxabiv1::__class_type_info const*, long) in<br>
>>> libclang_rt.ubsan_osx.a(ubsan_type_hash.o)<br>
>>>   "typeinfo for std::type_info", referenced from:<br>
>>>       vtable for testing::internal::ExecDeathTest in gtest-all.o<br>
>>>       __ubsan::checkDynamicType(void*, void*, unsigned long) in<br>
>>> libclang_rt.ubsan_osx.a(ubsan_type_hash.o)<br>
>>>   "typeinfo for __cxxabiv1::__si_class_type_info", referenced from:<br>
>>>       isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*,<br>
>>> __cxxabiv1::__class_type_info const*, long) in<br>
>>> libclang_rt.ubsan_osx.a(ubsan_type_hash.o)<br>
>>>   "typeinfo for __cxxabiv1::__vmi_class_type_info", referenced from:<br>
>>>       isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*,<br>
>>> __cxxabiv1::__class_type_info const*, long) in<br>
>>> libclang_rt.ubsan_osx.a(ubsan_type_hash.o)<br>
>>><br>
>>><br>
>>> Does someone with more knowledge about this subject can help ?<br>
>>><br>
>>><br>
>>> -- Jean-Daniel<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> cfe-dev mailing list<br>
>>> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Alexey Samsonov, MSK<br>
>><br>
><br>
><br>
><br>
> --<br>
> Alexey Samsonov, MSK<br>
><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Alexander Potapenko<br>
Software Engineer<br>
Google Moscow<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div><br>
</div>