summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2023-10-23 17:20:24 -0700
committerKhem Raj <raj.khem@gmail.com>2023-10-25 10:20:08 -0700
commit41b7f5296d1176160712d79730d3b5ce0c58d1da (patch)
tree1c21380d428f5a7dd175431136159d54435c16e2
parent4c6512205b11140ed381d9fd1b7e0dcfb587c023 (diff)
downloadmeta-clang-41b7f5296d1176160712d79730d3b5ce0c58d1da.tar.gz
meta-clang: Replace RUNTIME with TC_CXX_RUNTIME
TC_CXX_RUNTIME is now defined in OE-core Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--README.md10
-rw-r--r--classes/clang.bbclass18
-rw-r--r--conf/layer.conf2
-rw-r--r--recipes-devtools/clang/clang_git.bb6
-rw-r--r--recipes-devtools/clang/compiler-rt-sanitizers_git.bb2
-rw-r--r--recipes-devtools/clang/libcxx_git.bb6
-rw-r--r--recipes-extended/ghostscript/ghostscript_%.bbappend2
7 files changed, 23 insertions, 23 deletions
diff --git a/README.md b/README.md
index 3ec2313..0bc7cfb 100644
--- a/README.md
+++ b/README.md
@@ -67,17 +67,17 @@ PROVIDES:pn-nativesdk-clang = "nativesdk-llvm"
67``` 67```
68# Default Compiler Runtime 68# Default Compiler Runtime
69 69
70Default is to use GNU runtime `RUNTIME = "gnu"` which consists of libgcc, libstdc++ to provide C/C++ 70Default is to use GNU runtime `TC_CXX_RUNTIME = "gnu"` which consists of libgcc, libstdc++ to provide C/C++
71runtime support. However it's possible to use LLVM runtime to replace it where 71runtime support. However it's possible to use LLVM runtime to replace it where
72compile-rt, llvm libunwind, and libc++ are used to provide C/C++ runtime, while 72compile-rt, llvm libunwind, and libc++ are used to provide C/C++ runtime, while
73GNU runtime works with both GCC and Clang, LLVM runtime is only tested with Clang 73GNU runtime works with both GCC and Clang, LLVM runtime is only tested with Clang
74compiler, switching to use LLVM runtime is done via a config metadata knob 74compiler, switching to use LLVM runtime is done via a config metadata knob
75 75
76```shell 76```shell
77RUNTIME = "llvm" 77TC_CXX_RUNTIME = "llvm"
78``` 78```
79 79
80RUNTIME variable influences individual runtime elements and can be set explicitly as well 80TC_CXX_RUNTIME variable influences individual runtime elements and can be set explicitly as well
81e.g. `LIBCPLUSPLUS` `COMPILER_RT` and `UNWINDLIB`. 81e.g. `LIBCPLUSPLUS` `COMPILER_RT` and `UNWINDLIB`.
82 82
83Please note that this will still use crt files from GNU compiler always, while llvm now 83Please note that this will still use crt files from GNU compiler always, while llvm now
@@ -85,8 +85,8 @@ do provide crt files, they have not been yet integrated into the toolchain.
85 85
86# Default C++ Standard Library Switch 86# Default C++ Standard Library Switch
87 87
88Using RUNTIME variable will select which C++ runtime is used, however it can be overridden 88Using TC_CXX_RUNTIME variable will select which C++ runtime is used, however it can be overridden
89if needed to by modifying `LIBCPLUSPLUS` variable, usually defaults used by `RUNTIME` are 89if needed to by modifying `LIBCPLUSPLUS` variable, usually defaults used by `TC_CXX_RUNTIME` are
90best fit. e.g. below we select LLVM C++ as default C++ runtime. 90best fit. e.g. below we select LLVM C++ as default C++ runtime.
91 91
92```shell 92```shell
diff --git a/classes/clang.bbclass b/classes/clang.bbclass
index 605bfd5..f0330b3 100644
--- a/classes/clang.bbclass
+++ b/classes/clang.bbclass
@@ -75,11 +75,11 @@ DEBUG_PREFIX_MAP:remove:toolchain-clang = "-fcanon-prefix-map"
75# choose between 'gcc' 'clang' an empty '' can be used as well 75# choose between 'gcc' 'clang' an empty '' can be used as well
76TOOLCHAIN ??= "gcc" 76TOOLCHAIN ??= "gcc"
77# choose between 'gnu' 'llvm' 77# choose between 'gnu' 'llvm'
78RUNTIME ??= "gnu" 78TC_CXX_RUNTIME ??= "gnu"
79# Using gcc or llvm runtime is only available when using clang for compiler 79# Using gcc or llvm runtime is only available when using clang for compiler
80#RUNTIME:toolchain-gcc = "gnu" 80#TC_CXX_RUNTIME:toolchain-gcc = "gnu"
81RUNTIME:armeb = "gnu" 81TC_CXX_RUNTIME:armeb = "gnu"
82RUNTIME:armv5 = "gnu" 82TC_CXX_RUNTIME:armv5 = "gnu"
83 83
84TOOLCHAIN:class-native = "gcc" 84TOOLCHAIN:class-native = "gcc"
85TOOLCHAIN:class-nativesdk = "gcc" 85TOOLCHAIN:class-nativesdk = "gcc"
@@ -88,8 +88,8 @@ TOOLCHAIN:class-crosssdk = "gcc"
88TOOLCHAIN:class-cross = "gcc" 88TOOLCHAIN:class-cross = "gcc"
89 89
90OVERRIDES =. "${@['', 'toolchain-${TOOLCHAIN}:']['${TOOLCHAIN}' != '']}" 90OVERRIDES =. "${@['', 'toolchain-${TOOLCHAIN}:']['${TOOLCHAIN}' != '']}"
91OVERRIDES =. "${@['', 'runtime-${RUNTIME}:']['${RUNTIME}' != '']}" 91OVERRIDES =. "${@['', 'runtime-${TC_CXX_RUNTIME}:']['${TC_CXX_RUNTIME}' != '']}"
92OVERRIDES[vardepsexclude] += "TOOLCHAIN RUNTIME" 92OVERRIDES[vardepsexclude] += "TOOLCHAIN TC_CXX_RUNTIME"
93 93
94YOCTO_ALTERNATE_EXE_PATH:toolchain-clang:class-target = "${STAGING_BINDIR}/llvm-config" 94YOCTO_ALTERNATE_EXE_PATH:toolchain-clang:class-target = "${STAGING_BINDIR}/llvm-config"
95YOCTO_ALTERNATE_LIBDIR:toolchain-clang:class-target = "/${BASELIB}" 95YOCTO_ALTERNATE_LIBDIR:toolchain-clang:class-target = "/${BASELIB}"
@@ -104,16 +104,16 @@ def clang_base_deps(d):
104 if not d.getVar('INHIBIT_DEFAULT_DEPS', False): 104 if not d.getVar('INHIBIT_DEFAULT_DEPS', False):
105 if not oe.utils.inherits(d, 'allarch') : 105 if not oe.utils.inherits(d, 'allarch') :
106 ret = " ${MLPREFIX}clang-cross-${TARGET_ARCH} virtual/libc " 106 ret = " ${MLPREFIX}clang-cross-${TARGET_ARCH} virtual/libc "
107 if (d.getVar('RUNTIME').find('android') != -1): 107 if (d.getVar('TC_CXX_RUNTIME').find('android') != -1):
108 ret += " libcxx" 108 ret += " libcxx"
109 return ret 109 return ret
110 if (d.getVar('RUNTIME').find('llvm') != -1): 110 if (d.getVar('TC_CXX_RUNTIME').find('llvm') != -1):
111 ret += " compiler-rt" 111 ret += " compiler-rt"
112 elif (d.getVar('COMPILER_RT').find('-rtlib=compiler-rt') != -1): 112 elif (d.getVar('COMPILER_RT').find('-rtlib=compiler-rt') != -1):
113 ret += " compiler-rt " 113 ret += " compiler-rt "
114 else: 114 else:
115 ret += " libgcc " 115 ret += " libgcc "
116 if (d.getVar('RUNTIME').find('llvm') != -1): 116 if (d.getVar('TC_CXX_RUNTIME').find('llvm') != -1):
117 ret += " libcxx" 117 ret += " libcxx"
118 elif (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1): 118 elif (d.getVar('COMPILER_RT').find('--unwindlib=libunwind') != -1):
119 ret += " libcxx " 119 ret += " libcxx "
diff --git a/conf/layer.conf b/conf/layer.conf
index 67baca0..3f1fee1 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -27,7 +27,7 @@ BBFILES_DYNAMIC += " \
27 27
28PREFERRED_PROVIDER_libgcc-initial = "libgcc-initial" 28PREFERRED_PROVIDER_libgcc-initial = "libgcc-initial"
29#PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs_forcevariable = "libcxx" 29#PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs_forcevariable = "libcxx"
30PREFERRED_PROVIDER_libunwind = "${@bb.utils.contains_any("RUNTIME", "llvm android", "libcxx", "libunwind", d)}" 30PREFERRED_PROVIDER_libunwind = "${@bb.utils.contains_any("TC_CXX_RUNTIME", "llvm android", "libcxx", "libunwind", d)}"
31INHERIT += "clang" 31INHERIT += "clang"
32 32
33# Do not include clang in SDK unless user wants to 33# Do not include clang in SDK unless user wants to
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb
index f735090..1d9ff2e 100644
--- a/recipes-devtools/clang/clang_git.bb
+++ b/recipes-devtools/clang/clang_git.bb
@@ -57,11 +57,11 @@ def get_clang_experimental_target_arch(bb, d):
57 57
58PACKAGECONFIG ??= "compiler-rt libcplusplus shared-libs lldb-wchar \ 58PACKAGECONFIG ??= "compiler-rt libcplusplus shared-libs lldb-wchar \
59 ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto lto', d)} \ 59 ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto lto', d)} \
60 ${@bb.utils.contains('RUNTIME', 'llvm', 'compiler-rt libcplusplus unwindlib libomp', '', d)} \ 60 ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'compiler-rt libcplusplus unwindlib libomp', '', d)} \
61 rtti eh libedit terminfo \ 61 rtti eh libedit terminfo \
62 " 62 "
63PACKAGECONFIG:class-native = "rtti eh libedit shared-libs ${@bb.utils.contains('RUNTIME', 'llvm', 'compiler-rt libcplusplus unwindlib libomp', '', d)}" 63PACKAGECONFIG:class-native = "rtti eh libedit shared-libs ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'compiler-rt libcplusplus unwindlib libomp', '', d)}"
64PACKAGECONFIG:class-nativesdk = "rtti eh libedit shared-libs ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto lto', d)} ${@bb.utils.contains('RUNTIME', 'llvm', 'compiler-rt libcplusplus unwindlib libomp', '', d)}" 64PACKAGECONFIG:class-nativesdk = "rtti eh libedit shared-libs ${@bb.utils.filter('DISTRO_FEATURES', 'thin-lto lto', d)} ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'compiler-rt libcplusplus unwindlib libomp', '', d)}"
65 65
66PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,," 66PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,"
67PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,," 67PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,"
diff --git a/recipes-devtools/clang/compiler-rt-sanitizers_git.bb b/recipes-devtools/clang/compiler-rt-sanitizers_git.bb
index 6c413b2..bc72861 100644
--- a/recipes-devtools/clang/compiler-rt-sanitizers_git.bb
+++ b/recipes-devtools/clang/compiler-rt-sanitizers_git.bb
@@ -40,7 +40,7 @@ EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
40 -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \ 40 -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \
41 -DCOMPILER_RT_BUILD_BUILTINS=OFF \ 41 -DCOMPILER_RT_BUILD_BUILTINS=OFF \
42 -DCOMPILER_RT_INCLUDE_TESTS=OFF \ 42 -DCOMPILER_RT_INCLUDE_TESTS=OFF \
43 -DSANITIZER_CXX_ABI_LIBNAME=${@bb.utils.contains("RUNTIME", "llvm", "libc++", "libstdc++", d)} \ 43 -DSANITIZER_CXX_ABI_LIBNAME=${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "libc++", "libstdc++", d)} \
44 -DCOMPILER_RT_BUILD_XRAY=ON \ 44 -DCOMPILER_RT_BUILD_XRAY=ON \
45 -DCOMPILER_RT_BUILD_SANITIZERS=ON \ 45 -DCOMPILER_RT_BUILD_SANITIZERS=ON \
46 -DCOMPILER_RT_BUILD_LIBFUZZER=ON \ 46 -DCOMPILER_RT_BUILD_LIBFUZZER=ON \
diff --git a/recipes-devtools/clang/libcxx_git.bb b/recipes-devtools/clang/libcxx_git.bb
index 13136fc..3d5ce54 100644
--- a/recipes-devtools/clang/libcxx_git.bb
+++ b/recipes-devtools/clang/libcxx_git.bb
@@ -10,7 +10,7 @@ require common-source.inc
10 10
11inherit cmake cmake-native python3native 11inherit cmake cmake-native python3native
12 12
13PACKAGECONFIG ??= "compiler-rt exceptions ${@bb.utils.contains("RUNTIME", "llvm", "unwind unwind-shared", "", d)}" 13PACKAGECONFIG ??= "compiler-rt exceptions ${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "unwind unwind-shared", "", d)}"
14PACKAGECONFIG:append:armv5 = " no-atomics" 14PACKAGECONFIG:append:armv5 = " no-atomics"
15PACKAGECONFIG:remove:class-native = "compiler-rt" 15PACKAGECONFIG:remove:class-native = "compiler-rt"
16PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON,-DLIBCXXABI_USE_LLVM_UNWINDER=OFF,," 16PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON,-DLIBCXXABI_USE_LLVM_UNWINDER=OFF,,"
@@ -50,7 +50,7 @@ LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da39
50" 50"
51 51
52OECMAKE_TARGET_COMPILE = "cxxabi cxx" 52OECMAKE_TARGET_COMPILE = "cxxabi cxx"
53OECMAKE_TARGET_INSTALL = "install-cxx install-cxxabi ${@bb.utils.contains("RUNTIME", "llvm", "install-unwind", "", d)}" 53OECMAKE_TARGET_INSTALL = "install-cxx install-cxxabi ${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "install-unwind", "", d)}"
54 54
55OECMAKE_SOURCEPATH = "${S}/llvm" 55OECMAKE_SOURCEPATH = "${S}/llvm"
56EXTRA_OECMAKE += "\ 56EXTRA_OECMAKE += "\
@@ -97,7 +97,7 @@ ALLOW_EMPTY:${PN} = "1"
97PROVIDES:append:runtime-llvm = " libunwind" 97PROVIDES:append:runtime-llvm = " libunwind"
98 98
99do_install:append() { 99do_install:append() {
100 if ${@bb.utils.contains("RUNTIME", "llvm", "true", "false", d)} 100 if ${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "true", "false", d)}
101 then 101 then
102 for f in libunwind.h __libunwind_config.h unwind.h unwind_itanium.h unwind_arm_ehabi.h 102 for f in libunwind.h __libunwind_config.h unwind.h unwind_itanium.h unwind_arm_ehabi.h
103 do 103 do
diff --git a/recipes-extended/ghostscript/ghostscript_%.bbappend b/recipes-extended/ghostscript/ghostscript_%.bbappend
index c1496d0..49cf24e 100644
--- a/recipes-extended/ghostscript/ghostscript_%.bbappend
+++ b/recipes-extended/ghostscript/ghostscript_%.bbappend
@@ -1,7 +1,7 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" 1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2 2
3do_configure:prepend:toolchain-clang () { 3do_configure:prepend:toolchain-clang () {
4 if ${@bb.utils.contains('RUNTIME', 'llvm', 'true', 'false', d)}; then 4 if ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'true', 'false', d)}; then
5 sed -i -e "s|-stdlib=libstdc++|-stdlib=libc++|g" ${S}/configure.ac 5 sed -i -e "s|-stdlib=libstdc++|-stdlib=libc++|g" ${S}/configure.ac
6 fi 6 fi
7} 7}