<div dir="ltr">Try linking with -lc++abi. Note that recently (in trunk, i.e. in upcoming Clang 3.7) we've significantly changed the way ASan/UBSan are used:<div><br></div><div>* -lc++abi problem you see should be fixed</div><div>* Both ASan and UBSan are now dylibs</div><div>* Using ASan and UBSan together should now work (it was not guaranteed to: <a href="https://llvm.org/bugs/show_bug.cgi?id=21112">https://llvm.org/bugs/show_bug.cgi?id=21112</a>).</div><div><br></div><div>I'd appreciate if you could test your example with trunk and report any problems.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 1, 2015 at 5:38 PM, Jeffrey Walton <span dir="ltr"><<a href="mailto:noloader@gmail.com" target="_blank">noloader@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Everyone,<br>
<br>
I download and built Clang 3.6 from sources . The recipe can be found<br>
at <a href="http://pastebin.com/snbuTzPK" target="_blank">http://pastebin.com/snbuTzPK</a>. The recipe fetches components with<br>
wget, unpacks in them in the proper directory, configures, and kicks<br>
off a build. The components are LLVM, CFE (Clang, front end),<br>
Compiler-RT and Tools Extras.<br>
<br>
I'm trying to use the Clang 3.6 Undefined and Address sanitizers. Link<br>
is failing with the errors shown below.<br>
<br>
The link rule include CXXFLAGS, so the sanitizer switches are being<br>
passed through the compiler driver:<br>
<br>
cryptest.exe: libcryptopp.a $(TESTOBJS)<br>
    $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)<br>
<br>
And is on path:<br>
<br>
$ find /usr/local/ -iname libclang_rt.ubsan_osx.a<br>
/usr/local//lib/clang/3.6.0/lib/darwin/libclang_rt.ubsan_osx.a<br>
<br>
Any ideas what I am doing wrong?<br>
<br>
Thanks in advance.<br>
<br>
====================<br>
<br>
$ find /usr/local/ -iname *ubsan*<br>
/usr/local//lib/clang/3.6.0/lib/darwin/libclang_rt.ubsan_osx.a<br>
<br>
$ export DYLD_LIBRARY_PATH=/usr/local//lib/clang/3.6.0/lib/darwin<br>
<br>
$ make test 2>&1 | asan_symbolize.py<br>
/usr/local/bin/clang++ -o cryptest.exe -DNDEBUG -g3 -Os -fPIC<br>
-fsanitize=address -fsanitize=undefined -Wall<br>
-Wno-tautological-compare -Wno-unused-value -Wno-unused-variable<br>
-Wno-unused-parameter -Wno-unused-function -DCRYPTOPP_DISABLE_ASM<br>
-pipe bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o<br>
datatest.o regtest.o fipsalgt.o dlltest.o ./libcryptopp.a<br>
Undefined symbols for architecture x86_64:<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>
      findBaseAtOffset(__cxxabiv1::__class_type_info const*, 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>
      findBaseAtOffset(__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>
      findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in<br>
libclang_rt.ubsan_osx.a(ubsan_type_hash.o)<br>
ld: symbol(s) not found for architecture x86_64<br>
clang: error: linker command failed with exit code 1 (use -v to see invocation)<br>
make: *** [cryptest.exe] Error 1<br>
_______________________________________________<br>
cfe-users mailing list<br>
<a href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div>