[cfe-users] Clang 3.6 and undefined symbol "ubsan::checkDynamicType"

Alexey Samsonov vonosmas at gmail.com
Wed Apr 1 18:10:53 PDT 2015


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:

* -lc++abi problem you see should be fixed
* Both ASan and UBSan are now dylibs
* Using ASan and UBSan together should now work (it was not guaranteed to:
https://llvm.org/bugs/show_bug.cgi?id=21112).

I'd appreciate if you could test your example with trunk and report any
problems.

On Wed, Apr 1, 2015 at 5:38 PM, Jeffrey Walton <noloader at gmail.com> wrote:

> Hi Everyone,
>
> I download and built Clang 3.6 from sources . The recipe can be found
> at http://pastebin.com/snbuTzPK. The recipe fetches components with
> wget, unpacks in them in the proper directory, configures, and kicks
> off a build. The components are LLVM, CFE (Clang, front end),
> Compiler-RT and Tools Extras.
>
> I'm trying to use the Clang 3.6 Undefined and Address sanitizers. Link
> is failing with the errors shown below.
>
> The link rule include CXXFLAGS, so the sanitizer switches are being
> passed through the compiler driver:
>
> cryptest.exe: libcryptopp.a $(TESTOBJS)
>     $(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS)
> $(LDLIBS)
>
> And is on path:
>
> $ find /usr/local/ -iname libclang_rt.ubsan_osx.a
> /usr/local//lib/clang/3.6.0/lib/darwin/libclang_rt.ubsan_osx.a
>
> Any ideas what I am doing wrong?
>
> Thanks in advance.
>
> ====================
>
> $ find /usr/local/ -iname *ubsan*
> /usr/local//lib/clang/3.6.0/lib/darwin/libclang_rt.ubsan_osx.a
>
> $ export DYLD_LIBRARY_PATH=/usr/local//lib/clang/3.6.0/lib/darwin
>
> $ make test 2>&1 | asan_symbolize.py
> /usr/local/bin/clang++ -o cryptest.exe -DNDEBUG -g3 -Os -fPIC
> -fsanitize=address -fsanitize=undefined -Wall
> -Wno-tautological-compare -Wno-unused-value -Wno-unused-variable
> -Wno-unused-parameter -Wno-unused-function -DCRYPTOPP_DISABLE_ASM
> -pipe bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o
> datatest.o regtest.o fipsalgt.o dlltest.o ./libcryptopp.a
> 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)
> make: *** [cryptest.exe] Error 1
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
>



-- 
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20150401/bf90cc81/attachment.html>


More information about the cfe-users mailing list