libcxx: Create packageconfig for cross unwinder support
PATCH 1/2 libcxx: Create packageconfig for cross unwinder support
cross-unwinding can pass exception across runtimes e.g. Multi-language applications ( nodejs native modules, python C extensions )
However, cross-unwinding is not default in libcxx for sometime [1] it requires special handling at runtime by apps who use it Switch recipe defaults to upstream defaults, which is to turn it off
This means native unwinding ( with in same runtime ) is build by default which is the most common case.
This also fixes libcxx/libunwind build errors
when enabling TC_CXX_RUNTIME = "llvm" on aarch64 particularly
[1] https://github.com/llvm/llvm-project/commit/85624c5de3e831ffa01fdc2d159e3d69c30de08d
--- meta/recipes-devtools/clang/libcxx_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/clang/libcxx_git.bb +1 -1
@@ -20,6 +20,7 @@ PACKAGECONFIG[exceptions] = "-DLIBCXXABI_ENABLE_EXCEPTIONS=ON -DLIBCXX_ENABLE_EX PACKAGECONFIG[no-atomics] = "-D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF -DCMAKE_SHARED_LINKER_FLAGS='-latomic',," PACKAGECONFIG[compiler-rt] = "-DLIBCXX_USE_COMPILER_RT=ON -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBUNWIND_USE_COMPILER_RT=ON,,compiler-rt" PACKAGECONFIG[unwind-shared] = "-DLIBUNWIND_ENABLE_SHARED=ON,-DLIBUNWIND_ENABLE_SHARED=OFF,," +PACKAGECONFIG[unwind-cross] = "-DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON,-DLIBUNWIND_ENABLE_CROSS_UNWINDING=OFF,," DEPENDS:append:class-target = " virtual/cross-c++ ${MLPREFIX}clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${MLPREFIX}compilerlibs" DEPENDS:append:class-nativesdk = " virtual/cross-c++ clang-crosssdk-${SDK_SYS} nativesdk-compiler-rt"
@@ -64,7 +65,6 @@ EXTRA_OECMAKE += "\ -DCMAKE_CROSSCOMPILING=ON \ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ -DLLVM_ENABLE_RTTI=ON \ - -DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON \ -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \ -DLIBCXXABI_INCLUDE_TESTS=OFF \ -DLIBCXXABI_ENABLE_SHARED=ON \
PATCH 2/2 clang-cross: Create <cross>-clang binary copy instead of symlink
With clang cleanup in [1] we ended up removing this logic, which is still required.
This ensures that search path for subsequent tools e.g. linker assembler are searched in the same dir where <cross>-clang is installed. If its a symlink to ../clang then the reference installation dir is ../ and all cross-tools are not there so clang will fail to find assembler/linker from cross staging area and use /usr/bin/ld or /usr/bin/as which we do not want
--- meta/recipes-devtools/clang/clang-cross_git.bb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
meta/recipes-devtools/clang/clang-cross_git.bb +7 -1
@@ -15,7 +15,7 @@ DEPENDS = "clang-native virtual/cross-binutils ${@bb.utils.contains('DISTRO_FEAT do_install() { install -d ${D}${bindir} - for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata \ + for tool in clang-tidy lld ld.lld llvm-profdata \ llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \ llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov do
@@ -23,4 +23,10 @@ do_install() { ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool fi done + # GNU Linker and assembler is needed in same directory as clang binaries else + # it will fallback to host linker which is not desired + install -m 0755 ${STAGING_BINDIR_NATIVE}/clang ${D}${bindir}/${TARGET_PREFIX}clang + ln -sf ${TARGET_PREFIX}clang ${D}${bindir}/${TARGET_PREFIX}clang++ } +# clang driver being copied above is already stripped +INHIBIT_SYSROOT_STRIP = "1"