From 44be83bfe42885a8181852b0fcb1cb1024d069eb Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 26 May 2021 11:38:51 -0700 Subject: clang.bbclass: Adjust for clang default changes Now that clang can pass right options automatically when RUNTIME = "llvm", adjust the variables e.g. COMPILER_RT/UNWINDLIB/LIBCPLUSPLUS are no more required to be defaulted Disable enforcing gcc runtime for packages using gcc as its no longer needed here but is taken care by RUNTIME variable as an aside it also helps in building native and nativesdk llvm runtimes Compute right dependencies based on selected RUNTIME along with COMPILER_RT/UNWINDLIB/LIBCPLUSPLUS variables Signed-off-by: Khem Raj (cherry picked from commit dc5e04e5819a5e7384ae48f1740ac82970a80b8f) --- classes/clang.bbclass | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/classes/clang.bbclass b/classes/clang.bbclass index e609061..b53eace 100644 --- a/classes/clang.bbclass +++ b/classes/clang.bbclass @@ -12,17 +12,17 @@ NM_toolchain-clang = "${HOST_PREFIX}llvm-nm" LTO_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', '-flto=thin', '-flto -fuse-ld=lld', d)}" PACKAGE_DEBUG_SPLIT_STYLE_toolchain-clang = "debug-without-src" -COMPILER_RT ??= "${@bb.utils.contains("RUNTIME", "llvm", "-rtlib=compiler-rt ${UNWINDLIB}", "", d)}" +COMPILER_RT ??= "" COMPILER_RT_powerpc = "-rtlib=libgcc ${UNWINDLIB}" COMPILER_RT_armeb = "-rtlib=libgcc ${UNWINDLIB}" -UNWINDLIB ??= "${@bb.utils.contains("RUNTIME", "llvm", "--unwindlib=libgcc", "", d)}" +UNWINDLIB ??= "" UNWINDLIB_riscv64 = "--unwindlib=libgcc" UNWINDLIB_riscv32 = "--unwindlib=libgcc" UNWINDLIB_powerpc = "--unwindlib=libgcc" UNWINDLIB_armeb = "--unwindlib=libgcc" -LIBCPLUSPLUS ??= "${@bb.utils.contains("RUNTIME", "llvm", "-stdlib=libc++", "", d)}" +LIBCPLUSPLUS ??= "" TARGET_CXXFLAGS_append_toolchain-clang = " ${LIBCPLUSPLUS}" TUNE_CCARGS_append_toolchain-clang = " ${COMPILER_RT} ${LIBCPLUSPLUS}" @@ -69,7 +69,7 @@ LDFLAGS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is TOOLCHAIN ??= "gcc" # choose between 'gnu' 'llvm' RUNTIME ??= "gnu" -RUNTIME_toolchain-gcc = "gnu" +#RUNTIME_toolchain-gcc = "gnu" RUNTIME_armeb = "gnu" TOOLCHAIN_class-native = "gcc" @@ -89,13 +89,17 @@ def clang_base_deps(d): if not d.getVar('INHIBIT_DEFAULT_DEPS', False): if not oe.utils.inherits(d, 'allarch') : ret = " clang-cross-${TARGET_ARCH} virtual/libc " - if (d.getVar('COMPILER_RT').find('-rtlib=compiler-rt') != -1): + if (d.getVar('RUNTIME').find('llvm') != -1): + ret += " compiler-rt libcxx" + elif (d.getVar('COMPILER_RT').find('-rtlib=compiler-rt') != -1): ret += " compiler-rt " else: ret += " libgcc " - if (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1): + if (d.getVar('RUNTIME').find('llvm') != -1): + ret += " libcxx" + elif (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1): ret += " libcxx " - if (d.getVar('LIBCPLUSPLUS').find('-stdlib=libc++') != -1): + elif (d.getVar('LIBCPLUSPLUS').find('-stdlib=libc++') != -1): ret += " libcxx " else: ret += " virtual/${TARGET_PREFIX}compilerlibs " -- cgit v1.2.3-54-g00ecf