summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2019-09-07 15:14:25 -0700
committerKhem Raj <raj.khem@gmail.com>2019-09-09 12:41:29 -0700
commitf23263ad99b7b7de8986ac41f72db6274aaa63e2 (patch)
tree3b058e9ad0ea1b727e684a81ebb0e588b5ff12c1
parenta8d80b12a73f65eba3be1c10d3a51c7504c1e3cb (diff)
downloadmeta-clang-f23263ad99b7b7de8986ac41f72db6274aaa63e2.tar.gz
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 <raj.khem@gmail.com>
-rw-r--r--recipes-devtools/clang/libcxx_git.bb25
1 files 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
13DEPENDS += "ninja-native" 13DEPENDS += "ninja-native"
14BASEDEPENDS_remove_toolchain-clang = "libcxx" 14BASEDEPENDS_remove_toolchain-clang = "libcxx"
15DEPENDS_append_toolchain-clang = " virtual/${TARGET_PREFIX}compilerlibs" 15DEPENDS_append_toolchain-clang = " virtual/${TARGET_PREFIX}compilerlibs"
16TARGET_CXXFLAGS_remove_toolchain-clang = "--stdlib=libc++"
17TUNE_CCARGS_remove_toolchain-clang = "--rtlib=compiler-rt --unwindlib=libunwind --stdlib=libc++"
18 16
19LDFLAGS_append_toolchain-gcc = " -lgcc" 17TARGET_CXXFLAGS_remove_toolchain-clang = "--stdlib=libc++"
18TUNE_CCARGS_remove_toolchain-clang = "--unwindlib=libunwind --stdlib=libc++"
20 19
21PACKAGECONFIG ??= "unwind" 20PACKAGECONFIG ??= "${@bb.utils.contains('PREFERRED_PROVIDER_libunwind', 'libcxx', 'unwind', '', d)}"
22PACKAGECONFIG_toolchain-gcc = ""
23PACKAGECONFIG_powerpc = "" 21PACKAGECONFIG_powerpc = ""
24PACKAGECONFIG_riscv64 = "" 22PACKAGECONFIG_riscv64 = ""
25PACKAGECONFIG_riscv32 = "" 23PACKAGECONFIG_riscv32 = ""
26PACKAGECONFIG[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," 24
25PACKAGECONFIG[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',"
27 26
28PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'libunwind', '', d)}" 27PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'unwind', 'libunwind', '', d)}"
29LIBUNWIND = "${@bb.utils.contains('PACKAGECONFIG', 'unwind', ';libunwind', '', d)}" 28LIBUNWIND = "${@bb.utils.contains('PACKAGECONFIG', 'unwind', ';libunwind', '', d)}"
@@ -34,14 +33,15 @@ LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da39
34" 33"
35THUMB_TUNE_CCARGS = "" 34THUMB_TUNE_CCARGS = ""
36#TUNE_CCARGS += "-nostdlib" 35#TUNE_CCARGS += "-nostdlib"
37EXTRA_OECMAKE_append_armv5 = " -D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF"
38 36
39EXTRA_OECMAKE += "\ 37EXTRA_OECMAKE += "\
38 -DCMAKE_CROSSCOMPILING=ON \
40 -DLIBCXX_CXX_ABI=libcxxabi \ 39 -DLIBCXX_CXX_ABI=libcxxabi \
41 -DLIBCXX_USE_COMPILER_RT=YES \ 40 -DLIBCXX_USE_COMPILER_RT=ON \
42 -DLIBCXXABI_USE_COMPILER_RT=YES \ 41 -DLIBCXXABI_USE_COMPILER_RT=ON \
43 -DCXX_SUPPORTS_CXX11=ON \
44 -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON \ 42 -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON \
43 -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
44 -DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \
45 -DLIBCXXABI_LIBCXX_INCLUDES=${S}/libcxx/include \ 45 -DLIBCXXABI_LIBCXX_INCLUDES=${S}/libcxx/include \
46 -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${S}/libcxxabi/include \ 46 -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${S}/libcxxabi/include \
47 -DLIBCXX_CXX_ABI_LIBRARY_PATH=${B}/lib \ 47 -DLIBCXX_CXX_ABI_LIBRARY_PATH=${B}/lib \
@@ -61,6 +61,11 @@ EXTRA_OECMAKE_append_riscv64 = " -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
61 -DLIBOMP_LIBFLAGS='-latomic' \ 61 -DLIBOMP_LIBFLAGS='-latomic' \
62 -DCMAKE_SHARED_LINKER_FLAGS='-lgcc_s -latomic' \ 62 -DCMAKE_SHARED_LINKER_FLAGS='-lgcc_s -latomic' \
63 " 63 "
64
65EXTRA_OECMAKE_append_armv5 = " -D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF"
66
67EXTRA_OECMAKE_append_arm = " -DCMAKE_REQUIRED_FLAGS='-fno-exceptions'"
68
64EXTRA_OECMAKE_append_riscv32 = " -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \ 69EXTRA_OECMAKE_append_riscv32 = " -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
65 -DLIBCXX_ENABLE_EXCEPTIONS=ON \ 70 -DLIBCXX_ENABLE_EXCEPTIONS=ON \
66 -DLIBOMP_LIBFLAGS='-latomic' \ 71 -DLIBOMP_LIBFLAGS='-latomic' \