From b98a74738a027ba7d5f81ef49a154b7c90b80995 Mon Sep 17 00:00:00 2001 From: David Carlos Manuelda Date: Fri, 26 Oct 2018 19:39:17 +0000 Subject: [PATCH] Fix compiler-rt detection and linkage as of bug #592326 --- .../libcxx-7.0.0-fix-compiler-rt-detection.patch | 11 +++++++++++ sys-libs/libcxx/libcxx-7.0.0.ebuild | 11 +++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 sys-libs/libcxx/files/libcxx-7.0.0-fix-compiler-rt-detection.patch diff --git a/sys-libs/libcxx/files/libcxx-7.0.0-fix-compiler-rt-detection.patch b/sys-libs/libcxx/files/libcxx-7.0.0-fix-compiler-rt-detection.patch new file mode 100644 index 000000000..0cf9678c7 --- /dev/null +++ b/sys-libs/libcxx/files/libcxx-7.0.0-fix-compiler-rt-detection.patch @@ -0,0 +1,11 @@ +--- a/cmake/Modules/HandleCompilerRT.cmake 2018-10-26 19:17:14.955186526 -0000 ++++ b/cmake/Modules/HandleCompilerRT.cmake 2018-10-26 19:17:48.613187357 -0000 +@@ -3,7 +3,7 @@ + message(FATAL_ERROR "LIBCXX_COMPILE_FLAGS must be defined when using this function") + endif() + set(dest "" PARENT_SCOPE) +- set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} ++ set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} -m${LIBCXX_LIBDIR_SUFFIX} ${LIBCXX_COMPILE_FLAGS} + "--rtlib=compiler-rt" "--print-libgcc-file-name") + if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_TARGET) + list(APPEND CLANG_COMMAND "--target=${CMAKE_CXX_COMPILER_TARGET}") diff --git a/sys-libs/libcxx/libcxx-7.0.0.ebuild b/sys-libs/libcxx/libcxx-7.0.0.ebuild index 790f5dc12..099088fa4 100644 --- a/sys-libs/libcxx/libcxx-7.0.0.ebuild +++ b/sys-libs/libcxx/libcxx-7.0.0.ebuild @@ -50,6 +50,10 @@ PATCHES=( # Fix installing when using libsupc++ backend. # https://bugs.gentoo.org/667174 "${FILESDIR}/${PN}-7.0.0-libsupcxx-install.patch" + + # Fix compiler-rt detection and linking while linking against libunwind + # https://bugs.gentoo.org/592326 + "${FILESDIR}/${PN}-${PV}-fix-compiler-rt-detection.patch" ) # least intrusive of all @@ -104,7 +108,7 @@ src_configure() { multilib_src_configure() { # 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 + local extra_libs=() use_compiler_rt=OFF if use libunwind; then # work-around missing -lunwind upstream extra_libs+=( -lunwind ) @@ -114,8 +118,7 @@ multilib_src_configure() { local compiler_rt=$($(tc-getCC) ${CFLAGS} ${CPPFLAGS} \ ${LDFLAGS} -print-libgcc-file-name) if [[ ${compiler_rt} == *libclang_rt* ]]; then - want_gcc_s=OFF - extra_libs+=( "${compiler_rt}" ) + use_compiler_rt=ON fi fi fi @@ -139,7 +142,7 @@ 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=${want_gcc_s} + -DLIBCXX_USE_COMPILER_RT=${use_compiler_rt} -DLIBCXX_INCLUDE_TESTS=$(usex test) -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" ) -- 2.19.1