diff options
author | Michał Górny <mgorny@gentoo.org> | 2016-10-06 18:27:40 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2016-10-07 10:41:24 +0200 |
commit | f9dd98ec5f9aaf196319a0527d0312d18f2430a2 (patch) | |
tree | 70b2989eb40aa45088679ef521f36793de81e898 /sys-libs/libcxx/libcxx-9999.ebuild | |
parent | sys-libs/libcxx: Fix ldscripts to include gcc EH lib for USE=-unwind (diff) | |
download | gentoo-f9dd98ec5f9aaf196319a0527d0312d18f2430a2.tar.gz gentoo-f9dd98ec5f9aaf196319a0527d0312d18f2430a2.tar.bz2 gentoo-f9dd98ec5f9aaf196319a0527d0312d18f2430a2.zip |
sys-libs/libcxx: Always pass compiler runtime libs
Diffstat (limited to 'sys-libs/libcxx/libcxx-9999.ebuild')
-rw-r--r-- | sys-libs/libcxx/libcxx-9999.ebuild | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sys-libs/libcxx/libcxx-9999.ebuild b/sys-libs/libcxx/libcxx-9999.ebuild index bbc218b36af3..3beacf03e290 100644 --- a/sys-libs/libcxx/libcxx-9999.ebuild +++ b/sys-libs/libcxx/libcxx-9999.ebuild @@ -98,6 +98,28 @@ multilib_src_configure() { cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" fi + # we want -lgcc_s for unwinder, and for compiler runtime when using + # gcc, clang with gcc runtime (or any unknown compiler) + local extra_libs=() want_gcc_s=ON + if use libunwind; then + # work-around missing -lunwind upstream + extra_libs+=( -lunwind ) + # if we're using libunwind and clang with compiler-rt, we want + # to link to compiler-rt instead of -lgcc_s + if tc-is-clang; then + # get the full library list out of 'pretend mode' + # and grep it for libclang_rt references + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) ) + local i + for i in "${args[@]}"; do + if [[ ${i} == *libclang_rt* ]]; then + want_gcc_s=OFF + extra_libs+=( "${i}" ) + fi + done + fi + fi + local libdir=$(get_libdir) local mycmakeargs=( # LLVM_LIBDIR_SUFFIX is used to find CMake files @@ -111,10 +133,11 @@ multilib_src_configure() { # we're using our own mechanism for generating linker scripts -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) - -DLIBCXX_HAS_GCC_S_LIB=$(usex !libunwind) + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s} -DLIBCXX_INCLUDE_TESTS=$(usex test) - -DCMAKE_SHARED_LINKER_FLAGS=$(usex libunwind "-lunwind" "") + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" ) + if use test; then mycmakeargs+=( # this can be any directory, it just needs to exist... |