From f23263ad99b7b7de8986ac41f72db6274aaa63e2 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 7 Sep 2019 15:14:25 -0700 Subject: libcxx: Facilitate building without llvm libunwind when llvm unwind library is disabled, build was not picking up libgcc automatically since we still use, compiler-rt for C runtime, therefore introduce it via special CMAKE_SHARED_LINKER_FLAGS in packageconfig Bundle static unwind library into libcxx-abi library and bundle libcxx-abi.a into libc++.a this helps in just specifying lc++ and no other flags are needed. Also bundle static libunwind and cxx-abi but not into shared libc++, this would avoid adding them explicitly on linker cmdline in packages when doing static linking Use PREFERRED_PROVIDER_libunwind to determine if unwind packageconfig should be enabled or not Pass -fno-exceptions on arm, otherwise it links in unwinding routines which it expects to link from libgcc_s, we really don't need this when doing cmake checks so disable exceptions during cmake checks Signed-off-by: Khem Raj --- recipes-devtools/clang/libcxx_git.bb | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/recipes-devtools/clang/libcxx_git.bb b/recipes-devtools/clang/libcxx_git.bb index 2a2b5b7..e6e7e36 100644 --- a/recipes-devtools/clang/libcxx_git.bb +++ b/recipes-devtools/clang/libcxx_git.bb @@ -13,17 +13,16 @@ inherit cmake pythonnative DEPENDS += "ninja-native" BASEDEPENDS_remove_toolchain-clang = "libcxx" DEPENDS_append_toolchain-clang = " virtual/${TARGET_PREFIX}compilerlibs" -TARGET_CXXFLAGS_remove_toolchain-clang = "--stdlib=libc++" -TUNE_CCARGS_remove_toolchain-clang = "--rtlib=compiler-rt --unwindlib=libunwind --stdlib=libc++" -LDFLAGS_append_toolchain-gcc = " -lgcc" +TARGET_CXXFLAGS_remove_toolchain-clang = "--stdlib=libc++" +TUNE_CCARGS_remove_toolchain-clang = "--unwindlib=libunwind --stdlib=libc++" -PACKAGECONFIG ??= "unwind" -PACKAGECONFIG_toolchain-gcc = "" +PACKAGECONFIG ??= "${@bb.utils.contains('PREFERRED_PROVIDER_libunwind', 'libcxx', 'unwind', '', d)}" PACKAGECONFIG_powerpc = "" PACKAGECONFIG_riscv64 = "" PACKAGECONFIG_riscv32 = "" -PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBUNWIND_ENABLE_SHARED=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON -DLIBCXXABI_LIBUNWIND_INCLUDES=${S}/projects/libunwind/include, -DLIBCXXABI_USE_LLVM_UNWINDER=OFF," + +PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBUNWIND_ENABLE_SHARED=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY=OFF -DLIBCXXABI_LIBUNWIND_INCLUDES=${S}/projects/libunwind/include, -DLIBCXXABI_USE_LLVM_UNWINDER=OFF -DCMAKE_SHARED_LINKER_FLAGS='-lgcc_s'," PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'libunwind', '', d)}" LIBUNWIND = "${@bb.utils.contains('PACKAGECONFIG', 'unwind', ';libunwind', '', d)}" @@ -34,14 +33,15 @@ LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da39 " THUMB_TUNE_CCARGS = "" #TUNE_CCARGS += "-nostdlib" -EXTRA_OECMAKE_append_armv5 = " -D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF" EXTRA_OECMAKE += "\ + -DCMAKE_CROSSCOMPILING=ON \ -DLIBCXX_CXX_ABI=libcxxabi \ - -DLIBCXX_USE_COMPILER_RT=YES \ - -DLIBCXXABI_USE_COMPILER_RT=YES \ - -DCXX_SUPPORTS_CXX11=ON \ + -DLIBCXX_USE_COMPILER_RT=ON \ + -DLIBCXXABI_USE_COMPILER_RT=ON \ -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON \ + -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \ + -DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \ -DLIBCXXABI_LIBCXX_INCLUDES=${S}/libcxx/include \ -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${S}/libcxxabi/include \ -DLIBCXX_CXX_ABI_LIBRARY_PATH=${B}/lib \ @@ -61,6 +61,11 @@ EXTRA_OECMAKE_append_riscv64 = " -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \ -DLIBOMP_LIBFLAGS='-latomic' \ -DCMAKE_SHARED_LINKER_FLAGS='-lgcc_s -latomic' \ " + +EXTRA_OECMAKE_append_armv5 = " -D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF" + +EXTRA_OECMAKE_append_arm = " -DCMAKE_REQUIRED_FLAGS='-fno-exceptions'" + EXTRA_OECMAKE_append_riscv32 = " -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \ -DLIBCXX_ENABLE_EXCEPTIONS=ON \ -DLIBOMP_LIBFLAGS='-latomic' \ -- cgit v1.2.3-54-g00ecf