diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-05-26 11:38:51 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-09-08 09:08:54 -0700 |
commit | 44be83bfe42885a8181852b0fcb1cb1024d069eb (patch) | |
tree | 67555480bb077a156cfef802a409e6b553ebb785 | |
parent | dc5f165fbcb0abc58d49ef4a24df8329f80dec1e (diff) | |
download | meta-clang-44be83bfe42885a8181852b0fcb1cb1024d069eb.tar.gz |
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 <raj.khem@gmail.com>
(cherry picked from commit dc5e04e5819a5e7384ae48f1740ac82970a80b8f)
-rw-r--r-- | classes/clang.bbclass | 18 |
1 files 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" | |||
12 | LTO_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', '-flto=thin', '-flto -fuse-ld=lld', d)}" | 12 | LTO_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', '-flto=thin', '-flto -fuse-ld=lld', d)}" |
13 | PACKAGE_DEBUG_SPLIT_STYLE_toolchain-clang = "debug-without-src" | 13 | PACKAGE_DEBUG_SPLIT_STYLE_toolchain-clang = "debug-without-src" |
14 | 14 | ||
15 | COMPILER_RT ??= "${@bb.utils.contains("RUNTIME", "llvm", "-rtlib=compiler-rt ${UNWINDLIB}", "", d)}" | 15 | COMPILER_RT ??= "" |
16 | COMPILER_RT_powerpc = "-rtlib=libgcc ${UNWINDLIB}" | 16 | COMPILER_RT_powerpc = "-rtlib=libgcc ${UNWINDLIB}" |
17 | COMPILER_RT_armeb = "-rtlib=libgcc ${UNWINDLIB}" | 17 | COMPILER_RT_armeb = "-rtlib=libgcc ${UNWINDLIB}" |
18 | 18 | ||
19 | UNWINDLIB ??= "${@bb.utils.contains("RUNTIME", "llvm", "--unwindlib=libgcc", "", d)}" | 19 | UNWINDLIB ??= "" |
20 | UNWINDLIB_riscv64 = "--unwindlib=libgcc" | 20 | UNWINDLIB_riscv64 = "--unwindlib=libgcc" |
21 | UNWINDLIB_riscv32 = "--unwindlib=libgcc" | 21 | UNWINDLIB_riscv32 = "--unwindlib=libgcc" |
22 | UNWINDLIB_powerpc = "--unwindlib=libgcc" | 22 | UNWINDLIB_powerpc = "--unwindlib=libgcc" |
23 | UNWINDLIB_armeb = "--unwindlib=libgcc" | 23 | UNWINDLIB_armeb = "--unwindlib=libgcc" |
24 | 24 | ||
25 | LIBCPLUSPLUS ??= "${@bb.utils.contains("RUNTIME", "llvm", "-stdlib=libc++", "", d)}" | 25 | LIBCPLUSPLUS ??= "" |
26 | 26 | ||
27 | TARGET_CXXFLAGS_append_toolchain-clang = " ${LIBCPLUSPLUS}" | 27 | TARGET_CXXFLAGS_append_toolchain-clang = " ${LIBCPLUSPLUS}" |
28 | TUNE_CCARGS_append_toolchain-clang = " ${COMPILER_RT} ${LIBCPLUSPLUS}" | 28 | TUNE_CCARGS_append_toolchain-clang = " ${COMPILER_RT} ${LIBCPLUSPLUS}" |
@@ -69,7 +69,7 @@ LDFLAGS_append_toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is | |||
69 | TOOLCHAIN ??= "gcc" | 69 | TOOLCHAIN ??= "gcc" |
70 | # choose between 'gnu' 'llvm' | 70 | # choose between 'gnu' 'llvm' |
71 | RUNTIME ??= "gnu" | 71 | RUNTIME ??= "gnu" |
72 | RUNTIME_toolchain-gcc = "gnu" | 72 | #RUNTIME_toolchain-gcc = "gnu" |
73 | RUNTIME_armeb = "gnu" | 73 | RUNTIME_armeb = "gnu" |
74 | 74 | ||
75 | TOOLCHAIN_class-native = "gcc" | 75 | TOOLCHAIN_class-native = "gcc" |
@@ -89,13 +89,17 @@ def clang_base_deps(d): | |||
89 | if not d.getVar('INHIBIT_DEFAULT_DEPS', False): | 89 | if not d.getVar('INHIBIT_DEFAULT_DEPS', False): |
90 | if not oe.utils.inherits(d, 'allarch') : | 90 | if not oe.utils.inherits(d, 'allarch') : |
91 | ret = " clang-cross-${TARGET_ARCH} virtual/libc " | 91 | ret = " clang-cross-${TARGET_ARCH} virtual/libc " |
92 | if (d.getVar('COMPILER_RT').find('-rtlib=compiler-rt') != -1): | 92 | if (d.getVar('RUNTIME').find('llvm') != -1): |
93 | ret += " compiler-rt libcxx" | ||
94 | elif (d.getVar('COMPILER_RT').find('-rtlib=compiler-rt') != -1): | ||
93 | ret += " compiler-rt " | 95 | ret += " compiler-rt " |
94 | else: | 96 | else: |
95 | ret += " libgcc " | 97 | ret += " libgcc " |
96 | if (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1): | 98 | if (d.getVar('RUNTIME').find('llvm') != -1): |
99 | ret += " libcxx" | ||
100 | elif (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1): | ||
97 | ret += " libcxx " | 101 | ret += " libcxx " |
98 | if (d.getVar('LIBCPLUSPLUS').find('-stdlib=libc++') != -1): | 102 | elif (d.getVar('LIBCPLUSPLUS').find('-stdlib=libc++') != -1): |
99 | ret += " libcxx " | 103 | ret += " libcxx " |
100 | else: | 104 | else: |
101 | ret += " virtual/${TARGET_PREFIX}compilerlibs " | 105 | ret += " virtual/${TARGET_PREFIX}compilerlibs " |