[cfe-dev] UBSAN: undefined symbols when compiling on macOS Sierra (local config issue?)

Kevin Ushey via cfe-dev cfe-dev at lists.llvm.org
Thu Sep 29 11:35:30 PDT 2016


Hi Vedant,

Just want to confirm that this did indeed work for me; thanks!

Cheers,
Kevin

On Thu, Sep 29, 2016 at 10:40 AM, Vedant Kumar <vsk at apple.com> wrote:

> You're hitting a bug which is fixed by this patch:
>
>   https://reviews.llvm.org/D24990
>   [ubsan] Turn on 'Has CXXABI' to enable support for -fsanitize=vptr on
> Darwin
>
> As a workaround, try building with:
>
>   -DSANITIZER_CAN_USE_CXXABI:BOOL=ON
>
> vedant
>
> > On Sep 29, 2016, at 10:23 AM, Kevin Ushey via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> >
> > Hi everyone,
> >
> > I'm running into some issues when attempting to link while using the
> 'undefined' sanitizer -- when linking my program, I'm getting errors of the
> form:
> >
> > Undefined symbols for architecture x86_64:
> >   "___ubsan_handle_dynamic_type_cache_miss", referenced from: <...>
> >   "___ubsan_vptr_type_cache", referenced from: <...>
> > ld: symbol(s) not found for architecture x86_64
> >
> > Looking at the generated ubsan dynamic library, those symbols are not
> present:
> >
> > kevin at cdrv:/usr/local/llvm/db79113/lib/clang/4.0.0/lib/darwin
> > $ nm libclang_rt.ubsan_osx_dynamic.dylib | grep "ubsan_vptr_type_cache"
> >
> > However, with clang-3.8 provided by Homebrew, these symbols are indeed
> present:
> >
> > kevin at cdrv:/usr/local/Cellar/llvm38/3.8.0/lib/llvm-3.8/lib/
> clang/3.8.0/lib/darwin
> > $ nm libclang_rt.ubsan_osx_dynamic.dylib | grep "ubsan_vptr_type_cache"
> > 0000000000b20c00 S ___ubsan_vptr_type_cache
> >
> > which I think implies I'm probably missing some bit of configuration
> when building clang with sanitizers. For reference, I'm building the LLVM
> tree with:
> >
> > cmake -G "Ninja" ..                                  \
> >     -DCMAKE_C_COMPILER=/usr/bin/clang                \
> >     -DCMAKE_C_FLAGS="${INCLUDE_FLAGS}"               \
> >     -DCMAKE_CXX_COMPILER=/usr/bin/clang++            \
> >     -DCMAKE_CXX_FLAGS="${INCLUDE_FLAGS}"             \
> >     -DCMAKE_SHARED_LINKER_FLAGS="-L/usr/local/lib"   \
> >     -DCMAKE_BUILD_TYPE=Release                       \
> >     -DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" \
> >     -DLLVM_ENABLE_EH=Yes                             \
> >     -DLLVM_ENABLE_RTTI=Yes
> > cmake --build .
> > cmake --build . --target install
> >
> > This is built with 'clang' and 'lldb' checked out in the 'llvm/tools'
> folder, and 'compiler-rt', 'openmp', 'libcxx' and 'libcxxabi' checked out
> in the 'llvm/projects' folder, and the master branch from the various git
> mirrors for each project.
> >
> > A bit of googling brought me to http://lists.llvm.org/
> pipermail/llvm-commits/Week-of-Mon-20150622/283017.html, but I'm not sure
> if it's relevant to this particular issue.
> >
> > Any idea what I could be missing?
> >
> > Thanks,
> > Kevin
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160929/f083d2e9/attachment.html>


More information about the cfe-dev mailing list