This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Set cxx-abi library for ubsan_minimal
AbandonedPublic

Authored by kongyi on Nov 9 2017, 5:15 PM.

Details

Reviewers
eugenis
danalbert

Diff Detail

Repository
rL LLVM

Event Timeline

kongyi created this revision.Nov 9 2017, 5:15 PM
eugenis edited edge metadata.Nov 10 2017, 2:03 PM

Is that for <atomic> implementation? It is normally in CXX, not CXXABI, so this it not entirely correct.
Besides, ubsan-minimal does not link with -nodefaultlibs (because it does not use SANITIZER_COMMON_LINK_FLAGS). It should not need this.

Does it help to add -stdlib=libc++ to both cflags and linkflags?

I think I see your problem.
If I build compiler-rt against Android NDK toolchain with

-DSANITIZER_CXX_ABI=none
-DSANITIZER_CXX_ABI_LIBRARY="unwind;c++abi"

, all sanitizer libraries link c++abi stuff statically, but ubsan_minimal still gets a dependency on libc++_shared.so.

My build succeeds, so you might have a different problem after all.
But the end result is still broken, we want a way to build ubsan_minimal without runtime dependency on libc++.

Perhaps the right solution is to switch to C11 atomics.
We don't need libc++ for anything else here, and don't plan to introduce new dependencies.

kongyi abandoned this revision.Nov 10 2017, 5:22 PM