<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 18, 2014 at 2:18 AM, Ben Pope <span dir="ltr"><<a href="mailto:benpope81@gmail.com" target="_blank">benpope81@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"><div class="">On 18/02/14 17:39, Kostya Serebryany wrote:<br>

</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"><div class="">
<br>
    Fair enough.  I'm using cmake to build, so I added the flag with<br></div>
    -DLIBCXX_CXX_FEATURE_FLAGS=-__<u></u>fsanitize=thread<div class=""><br>
<br>
I afraid this is not going to work. tsan-instrumented libc++.so can be<br>
used only with tsan-instrumented binaries.<br>
With non-instrumented binaries you will be getting link time errors<br>
(just like you did).<br>
</div></blockquote>
<br>
Looks like they were due to my clang being linked against my newly installed, instrumented libc++.  I've renamed that one to libc++tsan.so and reinstated the uninstrumented libc++.so.<div class=""><br>
<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">
BTW, I filed a bug for better build/test system support:<br>
<a href="https://code.google.com/p/thread-sanitizer/issues/detail?id=48" target="_blank">https://code.google.com/p/<u></u>thread-sanitizer/issues/<u></u>detail?id=48</a><br>
</blockquote>
<br></div>
Yeah, I think this is going to be useful.<br>
<br>
Not sure why I can't link against my new libc++-tsan though:<br>
<br>
$ clang++-3.5 -fsanitize=thread -std=c++11 -stdlib=libc++ shared_ptr_thread_safety.cpp -nodefaultlibs -lc++-tsan -lc++abi -lm -lc -lgcc_s -lgcc -o shared_ptr_thread_safety<br></blockquote><div><br></div><div>These are the command parameters I used to check your test case: </div>
<div># LIBCXX_ROOT -- directory where I've built tsan-instrumented libc++</div><div>clang -g -I$LIBCXX_ROOT/include -I$LIBCXX_ROOT/test/support $LIBCXX_ROOT/lib/libc++.so -Wl,-R$LIBCXX_ROOT/lib benpope.cc -std=c++11 -fsanitize=thread <br>
</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>
$ ldd shared_ptr_thread_safety<br>
        linux-vdso.so.1 =>  (0x00007fff2a3fe000)<br>
        libc++.so.1 => /usr/lib/libc++.so.1 (0x00007f761245e000)<br>
        libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007f761220f000)<br>
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.<u></u>6 (0x00007f7611f0a000)<br>
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.<u></u>6 (0x00007f7611b42000)<br>
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_<u></u>s.so.1 (0x00007f761192c000)<br>
        libpthread.so.0 => /lib/x86_64-linux-gnu/<u></u>libpthread.so.0 (0x00007f761170e000)<br>
        librt.so.1 => /lib/x86_64-linux-gnu/librt.<u></u>so.1 (0x00007f7611506000)<br>
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.<u></u>so.2 (0x00007f7611302000)<br>
        /lib64/ld-linux-x86-64.so.2 (0x00007f7613847000)<div class=""><div class="h5"><br>
<br>
Ben<br>
<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">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/<u></u>mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div></div>