Comment #3 on issue 367 by [email protected]: sanitizer prevents linking, tons of undefined references
https://code.google.com/p/address-sanitizer/issues/detail?id=367

This is with MacPorts clang. Native Apple clang doesn't seem to support sanitizers at all.

This is Apple clang:
$ clang -v
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
$ clang++ -fsanitize=undefined -I/opt/local/include -o t t.cpp
clang: error: unsupported argument 'undefined' to option 'fsanitize='
$

This is MacPorts clang:
$ /opt/local/bin/clang-mp-3.5 -v
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
$ /opt/local/bin/clang++-mp-3.5 -fsanitize=undefined -I/opt/local/include -o t t.cpp
Undefined symbols for architecture x86_64:
  "typeinfo for __cxxabiv1::__class_type_info", referenced from:
__ubsan::checkDynamicType(void*, void*, unsigned long) in libclang_rt.ubsan_osx.a(ubsan_type_hash.o) isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long) in libclang_rt.ubsan_osx.a(ubsan_type_hash.o) findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
  "typeinfo for __cxxabiv1::__si_class_type_info", referenced from:
isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long) in libclang_rt.ubsan_osx.a(ubsan_type_hash.o) findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
  "typeinfo for __cxxabiv1::__vmi_class_type_info", referenced from:
isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long) in libclang_rt.ubsan_osx.a(ubsan_type_hash.o) findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in libclang_rt.ubsan_osx.a(ubsan_type_hash.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation) $ /opt/local/bin/clang++-mp-3.5 -fsanitize=undefined -fno-sanitize=vptr -I/opt/local/include -o t t.cpp
$ ./t
Program compiled and linked with mutex fine.
argc=1  argv[0]=./t

That means - your workaround works (now if somebody could explain to me what it does, and why it seems to make such a difference?).

No I haven't built Clang from source (yet). In the process (having problems there, but probably pilot errors) with friend experienced in Clang-building helping. Will report if anything useful surfaces.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to