[PATCH] [UBSan] Use shared library for UBSan on OS X (compiler-rt part).

Kuba Brecka kuba.brecka at gmail.com
Sun Mar 22 09:29:17 PDT 2015


This doesn't build on my OS X 10.10 system, with the following link error (building with CMake+Ninja):

  Linking CXX shared library lib/clang/3.7.0/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib
  FAILED: ... /usr/bin/c++ -o lib/clang/3.7.0/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib ...
  Undefined symbols for architecture x86_64:
    "typeinfo for __cxxabiv1::__class_type_info", referenced from:
        __ubsan::checkDynamicType(void*, void*, unsigned long) in ubsan_type_hash.cc.o
        isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long) in ubsan_type_hash.cc.o
        findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in ubsan_type_hash.cc.o
    "typeinfo for __cxxabiv1::__si_class_type_info", referenced from:
        isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long) in ubsan_type_hash.cc.o
        findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in ubsan_type_hash.cc.o
    "typeinfo for __cxxabiv1::__vmi_class_type_info", referenced from:
        isDerivedFromAtOffset(__cxxabiv1::__class_type_info const*, __cxxabiv1::__class_type_info const*, long) in ubsan_type_hash.cc.o
        findBaseAtOffset(__cxxabiv1::__class_type_info const*, long) in ubsan_type_hash.cc.o
  ld: symbol(s) not found for architecture x86_64

This looks like the same issue that was discussed at http://reviews.llvm.org/D6960, and the proposed solution (explicitly linking against libc++abi.dylib) should fix this.  I'm not sure if that's the right thing to do here, it was suggested that we shouldn't link against libc++abi, and the issue should be fixed in libc++ re-export list.  However, this would only be available in the next OS X version.  So unless someone has a strong reason why not, we might need to really explicitly link against libc++abi.


http://reviews.llvm.org/D8473

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list