summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md25
-rw-r--r--SECURITY20
-rw-r--r--classes/clang-legacy.bbclass (renamed from classes/clang.bbclass)69
-rw-r--r--classes/clang-native.bbclass23
-rw-r--r--classes/cmake-native.bbclass56
-rw-r--r--conf/layer.conf8
-rw-r--r--conf/nonclangable.conf147
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-tests-cc-Use-c-14-standard.patch29
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bcc/bcc/bpf_stack_id.patch13
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch16
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bcc/bcc/run-ptest23
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bcc/bcc/support_finish_task_switch_isra_0.patch49
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.33.0.bb (renamed from dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb)38
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Fix-build-failures-due-to-missing-location.hh.patch54
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch38
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest (renamed from dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest)0
-rw-r--r--dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.23.0.bb (renamed from dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb)31
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch53
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch49
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch338
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch41
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch27
-rw-r--r--dynamic-layers/qt5-layer/recipes-qt/qt5/qtpdf_%.bbappend3
-rw-r--r--dynamic-layers/qt6-layer/recipes-qt/qt6/qtwebengine_%.bbappend1
-rw-r--r--recipes-connectivity/openssl/openssl_%.bbappend10
-rw-r--r--recipes-core/busybox/busybox/clang.cfg1
-rw-r--r--recipes-core/busybox/busybox_1.36%.bbappend3
-rw-r--r--recipes-core/musl/musl_%.bbappend2
-rw-r--r--recipes-devtools/bindgen-cli/bindgen-cli-crates.inc198
-rw-r--r--recipes-devtools/bindgen-cli/bindgen-cli_0.64.0.bb22
-rw-r--r--recipes-devtools/castxml/castxml_0.6.11.bb (renamed from recipes-devtools/castxml/castxml_0.6.4.20240205.bb)6
-rw-r--r--recipes-devtools/clang/clang-cross-canadian_git.bb36
-rw-r--r--recipes-devtools/clang/clang-cross_git.bb35
-rw-r--r--recipes-devtools/clang/clang-crosssdk_git.bb34
-rw-r--r--recipes-devtools/clang/clang.inc27
-rw-r--r--recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch58
-rw-r--r--recipes-devtools/clang/clang/0002-compiler-rt-support-a-new-embedded-linux-target.patch309
-rw-r--r--recipes-devtools/clang/clang/0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch44
-rw-r--r--recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch90
-rw-r--r--recipes-devtools/clang/clang/0005-llvm-allow-env-override-of-exe-and-libdir-path.patch71
-rw-r--r--recipes-devtools/clang/clang/0006-clang-driver-Check-sysroot-for-ldso-path.patch75
-rw-r--r--recipes-devtools/clang/clang/0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch32
-rw-r--r--recipes-devtools/clang/clang/0008-clang-Prepend-trailing-to-sysroot.patch39
-rw-r--r--recipes-devtools/clang/clang/0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch41
-rw-r--r--recipes-devtools/clang/clang/0010-clang-Define-releative-gcc-installation-dir.patch47
-rw-r--r--recipes-devtools/clang/clang/0011-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch35
-rw-r--r--recipes-devtools/clang/clang/0012-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch24
-rw-r--r--recipes-devtools/clang/clang/0013-Check-for-atomic-double-intrinsics.patch34
-rw-r--r--recipes-devtools/clang/clang/0014-libcxx-Add-compiler-runtime-library-to-link-step-for.patch37
-rw-r--r--recipes-devtools/clang/clang/0015-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch115
-rw-r--r--recipes-devtools/clang/clang/0016-clang-Fix-resource-dir-location-for-cross-toolchains.patch42
-rw-r--r--recipes-devtools/clang/clang/0017-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch79
-rw-r--r--recipes-devtools/clang/clang/0018-clang-Use-python3-in-python-scripts.patch35
-rw-r--r--recipes-devtools/clang/clang/0019-For-x86_64-set-Yocto-based-GCC-install-search-path.patch70
-rw-r--r--recipes-devtools/clang/clang/0020-llvm-Do-not-use-find_library-for-ncurses.patch45
-rw-r--r--recipes-devtools/clang/clang/0021-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch32
-rw-r--r--recipes-devtools/clang/clang/0022-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch68
-rw-r--r--recipes-devtools/clang/clang/0023-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch28
-rw-r--r--recipes-devtools/clang/clang/0024-libunwind-Added-unw_backtrace-method.patch56
-rw-r--r--recipes-devtools/clang/clang/0025-clang-Do-not-use-install-relative-libc-headers.patch34
-rw-r--r--recipes-devtools/clang/clang/0026-clang-Fix-how-driver-finds-GCC-installation-path-on-.patch113
-rw-r--r--recipes-devtools/clang/clang/0027-Fix-lib-paths-for-OpenEmbedded-Host.patch79
-rw-r--r--recipes-devtools/clang/clang/0028-Correct-library-search-path-for-OpenEmbedded-Host.patch84
-rw-r--r--recipes-devtools/clang/clang/0029-lldb-Link-with-libatomic-on-x86.patch33
-rw-r--r--recipes-devtools/clang/clang/0030-compiler-rt-Enable-__int128-for-ppc32.patch73
-rw-r--r--recipes-devtools/clang/clang/0031-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch62
-rw-r--r--recipes-devtools/clang/clang/0032-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch44
-rw-r--r--recipes-devtools/clang/clang/0033-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch43
-rw-r--r--recipes-devtools/clang/clang/0034-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch81
-rw-r--r--recipes-devtools/clang/clang/0035-compiler-rt-Fix-cmake-check-for-_Float16-and-__bf16.patch42
-rw-r--r--recipes-devtools/clang/clang/libunwind.pc.in9
-rw-r--r--recipes-devtools/clang/clang/llvm-config52
-rw-r--r--recipes-devtools/clang/clang_git.bb451
-rw-r--r--recipes-devtools/clang/common-source.inc17
-rw-r--r--recipes-devtools/clang/common.inc57
-rw-r--r--recipes-devtools/clang/compiler-rt-sanitizers_git.bb116
-rw-r--r--recipes-devtools/clang/compiler-rt_git.bb129
-rw-r--r--recipes-devtools/clang/libclc_git.bb48
-rw-r--r--recipes-devtools/clang/libcxx_git.bb116
-rw-r--r--recipes-devtools/clang/llvm-project-source.bb10
-rw-r--r--recipes-devtools/clang/llvm-project-source.inc96
-rw-r--r--recipes-devtools/clang/nativesdk-clang-glue.bb35
-rw-r--r--recipes-devtools/clang/openmp_git.bb64
-rw-r--r--recipes-devtools/include-what-you-use/include-what-you-use_0.23.bb24
-rw-r--r--recipes-devtools/python/python3-cffi_%.bbappend5
-rw-r--r--recipes-devtools/rust/rust-llvm/0001-sancov-Switch-to-OptTable-from-llvm-cl.patch352
-rw-r--r--recipes-devtools/rust/rust-llvm_%.bbappend5
-rw-r--r--recipes-devtools/rust/rust_%.bbappend3
-rw-r--r--recipes-devtools/spirv-llvm-translator/spirv-llvm-translator_git.bb36
-rwxr-xr-xscripts/devtool-clang.sh48
90 files changed, 523 insertions, 4869 deletions
diff --git a/README.md b/README.md
index 599237c..73688ff 100644
--- a/README.md
+++ b/README.md
@@ -103,7 +103,7 @@ in `local.conf`.
103You can select libstdc++ per package too by writing bbappends for them containing 103You can select libstdc++ per package too by writing bbappends for them containing
104 104
105```shell 105```shell
106LIBCPLUSPLUS:toolchain-clang:pn-<recipe> = "-stdlibc=libc++" 106LIBCPLUSPLUS:toolchain-clang:pn-<recipe> = "-stdlib=libc++"
107``` 107```
108Defaults are chosen to be GNU for maximum compatibility with existing GNU systems. It's always 108Defaults are chosen to be GNU for maximum compatibility with existing GNU systems. It's always
109good to use single runtime on a system, mixing runtimes can cause complications during 109good to use single runtime on a system, mixing runtimes can cause complications during
@@ -235,6 +235,29 @@ URI: ghttps://github.com/openembedded/bitbake.git
235branch: master 235branch: master
236revision: HEAD 236revision: HEAD
237``` 237```
238# Using Devtool and Upstream Development
239
240All LLVM based recipes use single llvm source directory, As a LLVM
241developer, you might want to work on your own repository to build
242related recipes, devtool can we useful in establishing such a workflow
243there is a script provided `scripts/devtool-clang.sh` which can assist
244in setting up all the recipes to use custom LLVM repository, in order
245to setup repository make sure that it has all the needed patches applied
246or else it will fail to build. Such a tree is already prepared and kept
247in sync at
248
249https://github.com/kraj/llvm-project
250
251There are branches under `oe` namespace which carry the needed OE patches
252
253```
254cd $TOPDIR/workspace/sources
255git clone https://github.com/kraj/llvm-project -b oe/main llvm-project
256```
257
258Once project is setup and meta-clang is added, run `devtool-clang.sh`
259script which will do the needed for setting up external sources for the
260yocto recipes, now yocto will use custom LLVM tree for its needs.
238 261
239# Contributing 262# Contributing
240 263
diff --git a/SECURITY b/SECURITY
new file mode 100644
index 0000000..952b125
--- /dev/null
+++ b/SECURITY
@@ -0,0 +1,20 @@
1How to Report a Potential Vulnerability?
2========================================
3
4If you would like to report a public issue (for example, one with a released
5CVE number), please report it via Github issues:
6
7 https://github.com/kraj/meta-clang/issues/new/choose
8
9If you are dealing with a not-yet released or urgent issue, please send a
10message to one of the maintainers listed in the README. Include as many
11details as possible:
12 - the layer or software module affected
13 - the recipe and its version
14 - any example code, if available
15
16Branches maintained with security fixes
17---------------------------------------
18
19See https://wiki.yoctoproject.org/wiki/Releases for the list of current
20releases. We only accept patches for the LTS releases and the master branch.
diff --git a/classes/clang.bbclass b/classes/clang-legacy.bbclass
index d5fa67a..dbd600f 100644
--- a/classes/clang.bbclass
+++ b/classes/clang-legacy.bbclass
@@ -1,28 +1,18 @@
1# Add the necessary override 1# Add the necessary override
2CCACHE_COMPILERCHECK:toolchain-clang ?= "%compiler% -v" 2CCACHE_COMPILERCHECK:toolchain-clang ?= "%compiler% -v"
3HOST_CC_ARCH:prepend:toolchain-clang = "-target ${HOST_SYS} " 3HOST_CC_ARCH:prepend:toolchain-clang:class-target = "-target ${HOST_SYS} "
4CC:toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" 4HOST_CC_ARCH:prepend:toolchain-clang:class-nativesdk = "-target ${HOST_SYS} "
5CXX:toolchain-clang = "${CCACHE}${HOST_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" 5LD:toolchain-clang:class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '${HOST_PREFIX}ld.lld${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', '${HOST_PREFIX}ld${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', d)}"
6CPP:toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} -E" 6LD:toolchain-clang:class-nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '${HOST_PREFIX}ld.lld${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', '${HOST_PREFIX}ld${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', d)}"
7CCLD:toolchain-clang = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" 7
8RANLIB:toolchain-clang = "${HOST_PREFIX}llvm-ranlib" 8LTO:toolchain-clang:class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', '-flto=thin', '-flto -fuse-ld=lld', d)}"
9AR:toolchain-clang = "${HOST_PREFIX}llvm-ar" 9LTO:toolchain-clang:class-nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', '-flto=thin', '-flto -fuse-ld=lld', d)}"
10NM:toolchain-clang = "${HOST_PREFIX}llvm-nm"
11OBJDUMP:toolchain-clang = "${HOST_PREFIX}llvm-objdump"
12OBJCOPY:toolchain-clang = "${HOST_PREFIX}llvm-objcopy"
13STRIP:toolchain-clang = "${HOST_PREFIX}llvm-strip"
14STRINGS:toolchain-clang = "${HOST_PREFIX}llvm-strings"
15READELF:toolchain-clang = "${HOST_PREFIX}llvm-readelf"
16
17LTO:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'thin-lto', '-flto=thin', '-flto -fuse-ld=lld', d)}"
18 10
19COMPILER_RT ??= "" 11COMPILER_RT ??= ""
20COMPILER_RT:class-native = "-rtlib=libgcc ${UNWINDLIB}"
21COMPILER_RT:armeb = "-rtlib=libgcc ${UNWINDLIB}" 12COMPILER_RT:armeb = "-rtlib=libgcc ${UNWINDLIB}"
22COMPILER_RT:libc-klibc = "-rtlib=libgcc ${UNWINDLIB}" 13COMPILER_RT:libc-klibc = "-rtlib=libgcc ${UNWINDLIB}"
23 14
24UNWINDLIB ??= "" 15UNWINDLIB ??= ""
25UNWINDLIB:class-native = "--unwindlib=libgcc"
26UNWINDLIB:armeb = "--unwindlib=libgcc" 16UNWINDLIB:armeb = "--unwindlib=libgcc"
27UNWINDLIB_libc-klibc = "--unwindlib=libgcc" 17UNWINDLIB_libc-klibc = "--unwindlib=libgcc"
28 18
@@ -32,10 +22,6 @@ LIBCPLUSPLUS:armv5 = "-stdlib=libstdc++"
32CXXFLAGS:append:toolchain-clang = " ${LIBCPLUSPLUS}" 22CXXFLAGS:append:toolchain-clang = " ${LIBCPLUSPLUS}"
33LDFLAGS:append:toolchain-clang = " ${COMPILER_RT} ${LIBCPLUSPLUS}" 23LDFLAGS:append:toolchain-clang = " ${COMPILER_RT} ${LIBCPLUSPLUS}"
34 24
35TUNE_CCARGS:remove:toolchain-clang = "-meb"
36TUNE_CCARGS:remove:toolchain-clang = "-mel"
37TUNE_CCARGS:append:toolchain-clang = "${@bb.utils.contains("TUNE_FEATURES", "bigendian", " -mbig-endian", " -mlittle-endian", d)}"
38
39# Clang does not yet support big.LITTLE performance tunes, so use the LITTLE for tunes 25# Clang does not yet support big.LITTLE performance tunes, so use the LITTLE for tunes
40TUNE_CCARGS:remove:toolchain-clang = "\ 26TUNE_CCARGS:remove:toolchain-clang = "\
41 -mcpu=cortex-a57.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \ 27 -mcpu=cortex-a57.cortex-a53${TUNE_CCARGS_MARCH_OPTS} \
@@ -56,7 +42,7 @@ TUNE_CCARGS:append:toolchain-clang = "${@bb.utils.contains_any("TUNE_FEATURES",
56TUNE_CCARGS_MARCH_OPTS:append:toolchain-clang = "${@bb.utils.contains_any("DEFAULTTUNE", "cortexa72 cortexa53", "+nocrypto", "", d)}" 42TUNE_CCARGS_MARCH_OPTS:append:toolchain-clang = "${@bb.utils.contains_any("DEFAULTTUNE", "cortexa72 cortexa53", "+nocrypto", "", d)}"
57 43
58# Clang does not support octeontx2 processor 44# Clang does not support octeontx2 processor
59TUNE_CCARGS:remove:toolchain-clang = "-mcpu=octeontx2" 45TUNE_CCARGS:remove:toolchain-clang = "-mcpu=octeontx2${TUNE_CCARGS_MARCH_OPTS}"
60 46
61# Reconcile some ppc anamolies 47# Reconcile some ppc anamolies
62TUNE_CCARGS:remove:toolchain-clang:powerpc = "-mhard-float -mno-spe" 48TUNE_CCARGS:remove:toolchain-clang:powerpc = "-mhard-float -mno-spe"
@@ -76,15 +62,15 @@ LDFLAGS:toolchain-clang:class-nativesdk = "${BUILDSDK_LDFLAGS} \
76 -Wl,-rpath-link,${STAGING_LIBDIR}/.. \ 62 -Wl,-rpath-link,${STAGING_LIBDIR}/.. \
77 -Wl,-rpath,${libdir}/.. " 63 -Wl,-rpath,${libdir}/.. "
78 64
79# Enable lld globally" 65# Enable lld globally except for ppc32 where it causes random segfaults in Qemu usermode
80LDFLAGS:append:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=lld', '', d)}" 66LDFLAGS:append:toolchain-clang:class-target = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=lld', '', d)}"
67LDFLAGS:append:toolchain-clang:class-nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=lld', '', d)}"
68LDFLAGS:remove:toolchain-clang:powerpc = "-fuse-ld=lld"
81 69
82# Remove gcc specific -fcanon-prefix-map option, added in gcc-13+ 70# Remove gcc specific -fcanon-prefix-map option, added in gcc-13+
83# clang does not support it yet 71# clang does not support it yet
84DEBUG_PREFIX_MAP:remove:toolchain-clang = "-fcanon-prefix-map" 72DEBUG_PREFIX_MAP:remove:toolchain-clang = "-fcanon-prefix-map"
85 73
86# choose between 'gcc' 'clang' an empty '' can be used as well
87TOOLCHAIN ??= "gcc"
88# choose between 'gnu' 'llvm' 74# choose between 'gnu' 'llvm'
89TC_CXX_RUNTIME ??= "gnu" 75TC_CXX_RUNTIME ??= "gnu"
90# Using gcc or llvm runtime is only available when using clang for compiler 76# Using gcc or llvm runtime is only available when using clang for compiler
@@ -92,15 +78,15 @@ TC_CXX_RUNTIME ??= "gnu"
92TC_CXX_RUNTIME:armeb = "gnu" 78TC_CXX_RUNTIME:armeb = "gnu"
93TC_CXX_RUNTIME:armv5 = "gnu" 79TC_CXX_RUNTIME:armv5 = "gnu"
94 80
95TOOLCHAIN:class-native = "gcc" 81#TOOLCHAIN:class-native = "gcc"
96TOOLCHAIN:class-nativesdk = "gcc" 82#TOOLCHAIN:class-nativesdk = "gcc"
97TOOLCHAIN:class-cross-canadian = "gcc" 83#TOOLCHAIN:class-cross-canadian = "gcc"
98TOOLCHAIN:class-crosssdk = "gcc" 84#TOOLCHAIN:class-crosssdk = "gcc"
99TOOLCHAIN:class-cross = "gcc" 85#TOOLCHAIN:class-cross = "gcc"
100 86
101OVERRIDES =. "${@['', 'toolchain-${TOOLCHAIN}:']['${TOOLCHAIN}' != '']}" 87#OVERRIDES =. "${@['', 'toolchain-${TOOLCHAIN}:']['${TOOLCHAIN}' != '']}"
102OVERRIDES =. "${@['', 'runtime-${TC_CXX_RUNTIME}:']['${TC_CXX_RUNTIME}' != '']}" 88OVERRIDES =. "${@['', 'runtime-${TC_CXX_RUNTIME}:']['${TC_CXX_RUNTIME}' != '']}"
103OVERRIDES[vardepsexclude] += "TOOLCHAIN TC_CXX_RUNTIME" 89OVERRIDES[vardepsexclude] += "TC_CXX_RUNTIME"
104 90
105YOCTO_ALTERNATE_EXE_PATH:toolchain-clang:class-target = "${STAGING_BINDIR}/llvm-config" 91YOCTO_ALTERNATE_EXE_PATH:toolchain-clang:class-target = "${STAGING_BINDIR}/llvm-config"
106YOCTO_ALTERNATE_LIBDIR:toolchain-clang:class-target = "/${BASELIB}" 92YOCTO_ALTERNATE_LIBDIR:toolchain-clang:class-target = "/${BASELIB}"
@@ -131,13 +117,13 @@ def clang_base_deps(d):
131 elif (d.getVar('LIBCPLUSPLUS').find('-stdlib=libc++') != -1): 117 elif (d.getVar('LIBCPLUSPLUS').find('-stdlib=libc++') != -1):
132 ret += " libcxx " 118 ret += " libcxx "
133 else: 119 else:
134 ret += " virtual/${TARGET_PREFIX}compilerlibs " 120 ret += " virtual/${MLPREFIX}compilerlibs "
135 return ret 121 return ret
136 return "" 122 return ""
137 123
138BASE_DEFAULT_DEPS:append:class-target:toolchain-clang:class-target = " ${@clang_base_deps(d)}" 124BASE_DEFAULT_DEPS:append:class-target:toolchain-clang:class-target = " ${@clang_base_deps(d)}"
139BASE_DEFAULT_DEPS:append:class-native:toolchain-clang:runtime-llvm = " libcxx-native compiler-rt-native" 125BASE_DEFAULT_DEPS:append:class-native:runtime-llvm = " libcxx-native compiler-rt-native"
140BASE_DEFAULT_DEPS:append:class-nativesdk:toolchain-clang:runtime-llvm = " clang-native nativesdk-libcxx nativesdk-compiler-rt" 126BASE_DEFAULT_DEPS:append:class-nativesdk:runtime-llvm = " clang-native nativesdk-libcxx nativesdk-compiler-rt"
141 127
142# do_populate_sysroot needs STRIP 128# do_populate_sysroot needs STRIP
143POPULATESYSROOTDEPS:toolchain-clang:class-target = "${MLPREFIX}clang-cross-${TARGET_ARCH}:do_populate_sysroot" 129POPULATESYSROOTDEPS:toolchain-clang:class-target = "${MLPREFIX}clang-cross-${TARGET_ARCH}:do_populate_sysroot"
@@ -149,17 +135,6 @@ EOF
149 sed -i 's/ -mmusl / /g' ${WORKDIR}/toolchain.cmake 135 sed -i 's/ -mmusl / /g' ${WORKDIR}/toolchain.cmake
150} 136}
151 137
152RECIPESYSROOTFUNCS = ""
153RECIPESYSROOTFUNCS:toolchain-clang = "recipe_sysroot_check_ld_is_lld"
154
155recipe_sysroot_check_ld_is_lld () {
156 if ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', 'true', 'false', d)} && \
157 [ -e ${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}ld.lld ]; then
158 ln -srf ${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}ld.lld ${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}ld
159 fi
160}
161do_prepare_recipe_sysroot[postfuncs] += "${RECIPESYSROOTFUNCS}"
162#
163# dump recipes which still use gcc 138# dump recipes which still use gcc
164#python __anonymous() { 139#python __anonymous() {
165# toolchain = d.getVar("TOOLCHAIN") 140# toolchain = d.getVar("TOOLCHAIN")
diff --git a/classes/clang-native.bbclass b/classes/clang-native.bbclass
deleted file mode 100644
index 51fafcd..0000000
--- a/classes/clang-native.bbclass
+++ /dev/null
@@ -1,23 +0,0 @@
1# inherit this class if you would like to use clang to compile the native
2# version of your recipes instead of system compiler ( which is normally gcc )
3# on build machines
4# to use it add
5#
6# inherit clang-native
7#
8# to the concerned recipe via a bbappend or directly to recipe file
9#
10DEPENDS:append:runtime-llvm = " clang-native compiler-rt-native libcxx-native"
11# Use libcxx headers for native parts
12CXXFLAGS:append:runtime-llvm = " -stdlib=libc++"
13BUILD_CXXFLAGS:append:runtime-llvm = " -isysroot=${STAGING_DIR_NATIVE} -stdlib=libc++"
14# Use libgcc for native parts
15LDFLAGS:append:runtime-llvm = " -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc"
16BUILD_LDFLAGS:append:runtime-llvm = " -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc"
17BUILD_CC:runtime-llvm = "${CCACHE}clang -isysroot=${STAGING_DIR_NATIVE}"
18BUILD_CXX:runtime-llvm = "${CCACHE}clang++ -isysroot=${STAGING_DIR_NATIVE}"
19BUILD_CPP:runtime-llvm = "${CCACHE}clang -isysroot=${STAGING_DIR_NATIVE} -E"
20BUILD_CCLD:runtime-llvm = "${CCACHE}clang"
21BUILD_RANLIB:runtime-llvm = "llvm-ranlib"
22BUILD_AR:runtime-llvm = "llvm-ar"
23BUILD_NM:runtime-llvm = "llvm-nm"
diff --git a/classes/cmake-native.bbclass b/classes/cmake-native.bbclass
deleted file mode 100644
index 116cdd1..0000000
--- a/classes/cmake-native.bbclass
+++ /dev/null
@@ -1,56 +0,0 @@
1# Native C/C++ compiler (without cpu arch/tune arguments)
2OECMAKE_NATIVE_C_COMPILER ?= "`echo ${BUILD_CC} | sed 's/^\([^ ]*\).*/\1/'`"
3OECMAKE_NATIVE_CXX_COMPILER ?= "`echo ${BUILD_CXX} | sed 's/^\([^ ]*\).*/\1/'`"
4OECMAKE_NATIVE_AR ?= "${BUILD_AR}"
5OECMAKE_NATIVE_RANLIB ?= "${BUILD_RANLIB}"
6OECMAKE_NATIVE_NM ?= "${BUILD_NM}"
7
8# Native compiler flags
9OECMAKE_NATIVE_C_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CFLAGS}"
10OECMAKE_NATIVE_CXX_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CXXFLAGS}"
11OECMAKE_NATIVE_C_FLAGS_RELEASE ?= "-DNDEBUG"
12OECMAKE_NATIVE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
13OECMAKE_NATIVE_C_LINK_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS}"
14OECMAKE_NATIVE_CXX_LINK_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CXXFLAGS} ${BUILD_LDFLAGS}"
15BUILD_CXXFLAGS += "${BUILD_CC_ARCH}"
16BUILD_CFLAGS += "${BUILD_CC_ARCH}"
17
18do_generate_native_toolchain_file() {
19 cat > ${WORKDIR}/toolchain-native.cmake <<EOF
20set( CMAKE_SYSTEM_NAME `echo ${BUILD_OS} | sed -e 's/^./\u&/' -e 's/^\(Linux\).*/\1/'` )
21set( CMAKE_SYSTEM_PROCESSOR ${BUILD_ARCH} )
22set( CMAKE_C_COMPILER ${OECMAKE_NATIVE_C_COMPILER} )
23set( CMAKE_CXX_COMPILER ${OECMAKE_NATIVE_CXX_COMPILER} )
24set( CMAKE_ASM_COMPILER ${OECMAKE_NATIVE_C_COMPILER} )
25set( CMAKE_AR ${OECMAKE_NATIVE_AR} CACHE FILEPATH "Archiver" )
26set( CMAKE_RANLIB ${OECMAKE_NATIVE_RANLIB} CACHE FILEPATH "Archive Indexer" )
27set( CMAKE_NM ${OECMAKE_NATIVE_NM} CACHE FILEPATH "Symbol Lister" )
28set( CMAKE_C_FLAGS "${OECMAKE_NATIVE_C_FLAGS}" CACHE STRING "CFLAGS" )
29set( CMAKE_CXX_FLAGS "${OECMAKE_NATIVE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" )
30set( CMAKE_ASM_FLAGS "${OECMAKE_NATIVE_C_FLAGS}" CACHE STRING "ASM FLAGS" )
31set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_NATIVE_C_FLAGS_RELEASE}" CACHE STRING "Additional CFLAGS for release" )
32set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_NATIVE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for release" )
33set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_NATIVE_C_FLAGS_RELEASE}" CACHE STRING "Additional ASM FLAGS for release" )
34set( CMAKE_C_LINK_FLAGS "${OECMAKE_NATIVE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
35set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_NATIVE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
36
37set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_NATIVE} )
38set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
39set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH )
40set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
41set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
42
43# Use native cmake modules
44list(APPEND CMAKE_MODULE_PATH "${STAGING_DATADIR_NATIVE}/cmake/Modules/")
45
46# add for non /usr/lib libdir, e.g. /usr/lib64
47set( CMAKE_LIBRARY_PATH ${STAGING_BASE_LIBDIR_NATIVE} ${STAGING_LIBDIR_NATIVE})
48
49# add include dir to implicit includes in case it differs from /usr/include
50list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${STAGING_INCDIR_NATIVE})
51list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${STAGING_INCDIR_NATIVE})
52
53EOF
54}
55
56addtask generate_native_toolchain_file after do_patch before do_configure
diff --git a/conf/layer.conf b/conf/layer.conf
index ee3446c..806fa56 100644
--- a/conf/layer.conf
+++ b/conf/layer.conf
@@ -7,7 +7,7 @@ BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
7BBFILE_COLLECTIONS += "clang-layer" 7BBFILE_COLLECTIONS += "clang-layer"
8BBFILE_PATTERN_clang-layer := "^${LAYERDIR}/" 8BBFILE_PATTERN_clang-layer := "^${LAYERDIR}/"
9BBFILE_PRIORITY_clang-layer = "7" 9BBFILE_PRIORITY_clang-layer = "7"
10LAYERSERIES_COMPAT_clang-layer = "nanbield scarthgap" 10LAYERSERIES_COMPAT_clang-layer = "whinlatter"
11LAYERDEPENDS_clang-layer = "core" 11LAYERDEPENDS_clang-layer = "core"
12 12
13BBFILES_DYNAMIC += " \ 13BBFILES_DYNAMIC += " \
@@ -26,14 +26,14 @@ BBFILES_DYNAMIC += " \
26" 26"
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/${MLPREFIX}compilerlibs:forcevariable = "libcxx"
30PREFERRED_PROVIDER_libunwind = "${@bb.utils.contains_any("TC_CXX_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-legacy"
32 32
33# Do not include clang in SDK unless user wants to 33# Do not include clang in SDK unless user wants to
34CLANGSDK ??= "0" 34CLANGSDK ??= "0"
35 35
36LLVMVERSION = "18.1.4" 36LLVMVERSION = "20.1.2"
37 37
38require conf/nonclangable.conf 38require conf/nonclangable.conf
39require conf/nonscanable.conf 39require conf/nonscanable.conf
diff --git a/conf/nonclangable.conf b/conf/nonclangable.conf
index 27165f4..c18eada 100644
--- a/conf/nonclangable.conf
+++ b/conf/nonclangable.conf
@@ -1,3 +1,6 @@
1
2TUNE_CCARGS:remove:toolchain-clang = "${@bb.utils.contains('TUNE_FEATURES', 'aarch64', '-mbranch-protection=standard', '', d)}"
3
1# https://github.com/llvm/llvm-project/issues/78337 4# https://github.com/llvm/llvm-project/issues/78337
2TOOLCHAIN:pn-kernel-selftest = "gcc" 5TOOLCHAIN:pn-kernel-selftest = "gcc"
3 6
@@ -62,6 +65,10 @@ TOOLCHAIN:pn-libssp-nonshared = "gcc"
62TOOLCHAIN:pn-m4:powerpc = "gcc" 65TOOLCHAIN:pn-m4:powerpc = "gcc"
63# clang does not have 64bit atomics on ppc 66# clang does not have 64bit atomics on ppc
64TOOLCHAIN:pn-mesa:powerpc = "gcc" 67TOOLCHAIN:pn-mesa:powerpc = "gcc"
68# recipe-sysroot//usr/lib/libGLESv2.so.2: unsupported relocation type 12
69TOOLCHAIN:pn-mesa:riscv32 = "gcc"
70# usr/lib/libgallium-25.0.2.so: unexpected reloc type 0x0c
71TOOLCHAIN:pn-mesa:riscv64 = "gcc"
65# clang fails with db.c:(.text+0x188): unsupported bss-plt -fPIC ifunc mmio_write64_be 72# clang fails with db.c:(.text+0x188): unsupported bss-plt -fPIC ifunc mmio_write64_be
66TOOLCHAIN:pn-rdma-core:powerpc = "gcc" 73TOOLCHAIN:pn-rdma-core:powerpc = "gcc"
67# usermode qemu crashes when running binaries from clang + rust compiler on ppc32 74# usermode qemu crashes when running binaries from clang + rust compiler on ppc32
@@ -150,8 +157,6 @@ TOOLCHAIN:pn-php:mips = "gcc"
150# Workaround oe-core patching problem temporarily 157# Workaround oe-core patching problem temporarily
151TOOLCHAIN:pn-rsync = "gcc" 158TOOLCHAIN:pn-rsync = "gcc"
152 159
153# U-boot does compile with clang but clang-15 crashes compiling it :(
154TOOLCHAIN:pn-u-boot = "gcc"
155TOOLCHAIN:pn-u-boot-at91 = "gcc" 160TOOLCHAIN:pn-u-boot-at91 = "gcc"
156TOOLCHAIN:pn-u-boot-fslc-mfgtool = "gcc" 161TOOLCHAIN:pn-u-boot-fslc-mfgtool = "gcc"
157TOOLCHAIN:pn-u-boot-fslc-mxsboot = "gcc" 162TOOLCHAIN:pn-u-boot-fslc-mxsboot = "gcc"
@@ -198,6 +203,25 @@ TOOLCHAIN:pn-gcc-for-nvcc-runtime:tegra = "gcc"
198#| | ^ 203#| | ^
199TOOLCHAIN:pn-optee-os:imx-nxp-bsp = "gcc" 204TOOLCHAIN:pn-optee-os:imx-nxp-bsp = "gcc"
200 205
206# Fails with clang-19+
207# Poco/PriorityDelegate.h:203:10: error: no member named '_pTarget' in 'PriorityDelegate<type-parameter-0-0, void, true>'
208TOOLCHAIN:pn-poco = "gcc"
209TOOLCHAIN:pn-netdata = "gcc"
210# Needs OMP and with clang openmp is not ported to rv32 yet
211TOOLCHAIN:pn-python3-drgn:riscv32 = "gcc"
212
213# Clang-20 issue - https://github.com/llvm/llvm-project/issues/132322
214TOOLCHAIN:pn-webkitgtk:arm = "gcc"
215TOOLCHAIN:pn-webkitgtk3:arm = "gcc"
216
217# Disable clang on rv64 for now. see - https://bugs.webkit.org/show_bug.cgi?id=290243
218TOOLCHAIN:pn-webkitgtk:riscv64 = "gcc"
219TOOLCHAIN:pn-webkitgtk3:riscv64 = "gcc"
220
221# Clang can not compile vulkan-samples because fmt version is old
222# see - https://github.com/KhronosGroup/Vulkan-Samples/pull/1315
223TOOLCHAIN:pn-vulkan-samples = "gcc"
224
201CFLAGS:append:pn-liboil:toolchain-clang:x86-64 = " -fheinous-gnu-extensions " 225CFLAGS:append:pn-liboil:toolchain-clang:x86-64 = " -fheinous-gnu-extensions "
202 226
203# TOPDIR/build/tmp/work/core2-32-yoe-linux/gnu-efi/3.0.17-r0/gnu-efi-3.0.17//lib/ctors.S:11:41: error: expected the entry size 227# TOPDIR/build/tmp/work/core2-32-yoe-linux/gnu-efi/3.0.17-r0/gnu-efi-3.0.17//lib/ctors.S:11:41: error: expected the entry size
@@ -231,6 +255,14 @@ CFLAGS:append:pn-userland:toolchain-clang = " -no-integrated-as"
231# ^ 255# ^
232CFLAGS:append:pn-libjpeg-turbo:toolchain-clang:mipsarch = " -no-integrated-as" 256CFLAGS:append:pn-libjpeg-turbo:toolchain-clang:mipsarch = " -no-integrated-as"
233 257
258# <inline asm>:1:41: error: expected '%<type>' or "<type>"
259# 1 | .pushsection ".debug_gdb_scripts", "MS",@progbits,1
260# | ^
261# <inline asm>:318:12: error: .popsection without corresponding .pushsection
262# 318 | .popsection
263# | ^
264CXXFLAGS:append:pn-boost:toolchain-clang:arm = " -no-integrated-as"
265
234#| /tmp/x86-sse2-cdb148.s:207:9: error: ambiguous operand size for instruction 'sub' 266#| /tmp/x86-sse2-cdb148.s:207:9: error: ambiguous operand size for instruction 'sub'
235#| sub SIZE, 64 267#| sub SIZE, 64
236#| ^~~~ 268#| ^~~~
@@ -283,7 +315,8 @@ CFLAGS:append:pn-qtbase:toolchain-clang:arm = " -no-integrated-as"
283#../git/common/connection.c:154:55: error: comparison of integers of different signs: 'unsigned long' and 'int' [-Werror,-Wsign-compare] 315#../git/common/connection.c:154:55: error: comparison of integers of different signs: 'unsigned long' and 'int' [-Werror,-Wsign-compare]
284# for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) { 316# for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
285# ^~~~~~~~~~~~~~~~~~~~~~ 317# ^~~~~~~~~~~~~~~~~~~~~~
286CFLAGS:append:pn-seatd:toolchain-clang = " -Wno-sign-compare" 318CFLAGS:append:pn-seatd:toolchain-clang = " -Wno-error=sign-compare"
319CXXFLAGS:append:pn-ot-br-posix:toolchain-clang = " -Wno-error=sign-compare"
287 320
288# -fno-tree-vrp is gcc specific 321# -fno-tree-vrp is gcc specific
289CXXFLAGS:remove:pn-mozjs:toolchain-clang = "-fno-tree-vrp" 322CXXFLAGS:remove:pn-mozjs:toolchain-clang = "-fno-tree-vrp"
@@ -315,34 +348,38 @@ TUNE_CCARGS:remove:pn-tesseract:toolchain-clang = "-Qunused-arguments"
315TUNE_CCARGS:remove:pn-pulseaudio:toolchain-clang = "-Qunused-arguments" 348TUNE_CCARGS:remove:pn-pulseaudio:toolchain-clang = "-Qunused-arguments"
316TUNE_CCARGS:remove:pn-btrfs-tools:toolchain-clang = "-Qunused-arguments" 349TUNE_CCARGS:remove:pn-btrfs-tools:toolchain-clang = "-Qunused-arguments"
317TUNE_CCARGS:append:pn-btrfs-tools:toolchain-clang = " -Werror=unused-command-line-argument" 350TUNE_CCARGS:append:pn-btrfs-tools:toolchain-clang = " -Werror=unused-command-line-argument"
351TUNE_CCARGS:remove:pn-gimp:toolchain-clang = "-Qunused-arguments"
318 352
319# Disable altivec on ppc32 353# Disable altivec on ppc32
320#/usr/include/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h:1345:32: error: use of undeclared identifier 'vec_sqrt'; did you mean 'vec_rsqrt'? 354#/usr/include/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h:1345:32: error: use of undeclared identifier 'vec_sqrt'; did you mean 'vec_rsqrt'?
321# BF16_TO_F32_UNARY_OP_WRAPPER(vec_sqrt, a); 355# BF16_TO_F32_UNARY_OP_WRAPPER(vec_sqrt, a);
322# ^~~~~~~~ 356# ^~~~~~~~
323# vec_rsqrt 357# vec_rsqrt
324TUNE_CCARGS:pn-ceres-solver:append:toolchain-clang:powerpc = " -mno-altivec" 358TUNE_CCARGS:append:pn-ceres-solver:toolchain-clang:powerpc = " -mno-altivec"
325TUNE_CCARGS:pn-opencv:append:toolchain-clang:powerpc = " -mno-altivec" 359TUNE_CCARGS:append:pn-opencv:toolchain-clang:powerpc = " -mno-altivec"
326CXXFLAGS:pn-libeigen:append:toolchain-clang:powerpc = " -DEIGEN_ALTIVEC_DISABLE_MMA" 360CXXFLAGS:append:pn-libeigen:toolchain-clang:powerpc = " -DEIGEN_ALTIVEC_DISABLE_MMA"
327 361
328# external/amber/src/src/amber.cc:53:41: error: unsafe pointer arithmetic [-Werror,-Wunsafe-buffer-usage] 362# external/amber/src/src/amber.cc:53:41: error: unsafe pointer arithmetic [-Werror,-Wunsafe-buffer-usage]
329# vk-wrappers-1-0.inc:74:34: error: cast from 'PFN_vkVoidFunction' (aka 'void (*)()') to 'PFN_vkCmdEndRenderPass' 363# vk-wrappers-1-0.inc:74:34: error: cast from 'PFN_vkVoidFunction' (aka 'void (*)()') to 'PFN_vkCmdEndRenderPass'
330# (aka 'void (*)(VkCommandBuffer_T *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 364# (aka 'void (*)(VkCommandBuffer_T *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
331CXXFLAGS:pn-opengl-es-cts:append:toolchain-clang = " -Wno-error=unsafe-buffer-usage -Wno-error=cast-function-type-strict" 365CXXFLAGS:append:pn-opengl-es-cts:toolchain-clang = " -Wno-error=unsafe-buffer-usage -Wno-error=cast-function-type-strict"
332CXXFLAGS:pn-vulkan-cts:append:toolchain-clang = " -Wno-error=unsafe-buffer-usage -Wno-error=cast-function-type-strict" 366CXXFLAGS:append:pn-vulkan-cts:toolchain-clang = " -Wno-error=unsafe-buffer-usage -Wno-error=cast-function-type-strict"
333# see https://github.com/jtv/libpqxx/issues/738
334CXXFLAGS:pn-vulkan-samples:append:toolchain-clang = " -Wno-error=deprecated-declarations"
335# Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/6033 367# Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/6033
336CFLAGS:pn-gtk4:append:toolchain-clang = " -Wno-error=int-conversion" 368CFLAGS:append:pn-gtk4:toolchain-clang = " -Wno-error=int-conversion"
337 369
338# usr/include/glib-2.0/glib/glib-autocleanups.h:49:1: error: cast from 'void (*)(void)' to 'GDestroyNotify' 370# usr/include/glib-2.0/glib/glib-autocleanups.h:49:1: error: cast from 'void (*)(void)' to 'GDestroyNotify'
339# (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 371# (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
340CFLAGS:pn-pidgin-sipe:append:toolchain-clang = " -Wno-error=cast-function-type-strict" 372CFLAGS:append:pn-pidgin-sipe:toolchain-clang = " -Wno-error=cast-function-type-strict"
341 373
342# 32bit builds of nodejs needs this warning to be disabled with clang16 until 374# 32bit builds of nodejs needs this warning to be disabled with clang16 until
343# v8 engine in nodejs moved beyong this commit 375# v8 engine in nodejs moved beyong this commit
344# https://github.com/v8/v8/commit/d15d49b09dc7aef9edcc4cf6a0cb2b77a0db203f 376# https://github.com/v8/v8/commit/d15d49b09dc7aef9edcc4cf6a0cb2b77a0db203f
345CXXFLAGS:pn-nodejs:append:toolchain-clang = " -Wno-error=enum-constexpr-conversion" 377CXXFLAGS:append:pn-nodejs:toolchain-clang = " -Wno-error=enum-constexpr-conversion"
378# deps/TinyDeflate/gunzip.hh:1144:35: error: a template argument list is expected after a name prefixed by the template keyword [-Wmissing-template-arg-list-after-template-kw]
379CXXFLAGS:append:pn-doxygen:toolchain-clang = " -Wno-error=missing-template-arg-list-after-template-kw"
380
381# Finds this extra warning with clang20+
382CXXFLAGS:append:pn-fmt:toolchain-clang = " -Wno-error=invalid-specialization"
346 383
347#| /usr/src/debug/ruby/2.5.1-r0/build/../ruby-2.5.1/process.c:7073: undefined reference to `__mulodi4' 384#| /usr/src/debug/ruby/2.5.1-r0/build/../ruby-2.5.1/process.c:7073: undefined reference to `__mulodi4'
348#| clang-7: error: linker command failed with exit code 1 (use -v to see invocation) 385#| clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
@@ -361,12 +398,15 @@ COMPILER_RT:remove:pn-webkitgtk:powerpc = "-rtlib=compiler-rt"
361COMPILER_RT:remove:pn-m4:armeb = "-rtlib=compiler-rt" 398COMPILER_RT:remove:pn-m4:armeb = "-rtlib=compiler-rt"
362COMPILER_RT:remove:pn-ruby:armeb = "-rtlib=compiler-rt" 399COMPILER_RT:remove:pn-ruby:armeb = "-rtlib=compiler-rt"
363COMPILER_RT:remove:pn-webkitgtk:armeb = "-rtlib=compiler-rt" 400COMPILER_RT:remove:pn-webkitgtk:armeb = "-rtlib=compiler-rt"
364
365# build/lib/libQt5Widgets.so: undefined reference to `__lshrti3' 401# build/lib/libQt5Widgets.so: undefined reference to `__lshrti3'
366# __lshrti3 is missing in libgcc 402# __lshrti3 is missing in libgcc
367COMPILER_RT:pn-qtbase:toolchain-clang:riscv32 = "-rtlib=compiler-rt ${UNWINDLIB}" 403COMPILER_RT:pn-qtbase:toolchain-clang:riscv32 = "-rtlib=compiler-rt ${UNWINDLIB}"
368 404
369LDFLAGS:append:pn-qtwebengine:toolchain-clang:runtime-gnu:x86 = " -latomic" 405LDFLAGS:append:pn-qtwebengine:toolchain-clang:runtime-gnu:x86 = " -latomic"
406
407# | i686-yoe-linux-ld.lld: error: undefined symbol: __atomic_store
408LDFLAGS:append:pn-lttng-tools:toolchain-clang:x86 = " -latomic"
409
370LDFLAGS:append:pn-qemu:toolchain-clang:x86 = " -latomic" 410LDFLAGS:append:pn-qemu:toolchain-clang:x86 = " -latomic"
371# warning: <elfFile> has a LOAD segment with RWX permissions 411# warning: <elfFile> has a LOAD segment with RWX permissions
372LDFLAGS:append:pn-ruby:toolchain-clang:powerpc = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '', ' -Wl,--no-warn-rwx-segment', d)}" 412LDFLAGS:append:pn-ruby:toolchain-clang:powerpc = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '', ' -Wl,--no-warn-rwx-segment', d)}"
@@ -389,6 +429,17 @@ COMPILER_RT:pn-mpich:toolchain-clang:x86-64 = "-rtlib=libgcc --unwindlib=libgcc"
389COMPILER_RT:pn-aufs-util:libc-glibc:toolchain-clang:x86-64 = "-rtlib=libgcc --unwindlib=libgcc" 429COMPILER_RT:pn-aufs-util:libc-glibc:toolchain-clang:x86-64 = "-rtlib=libgcc --unwindlib=libgcc"
390COMPILER_RT:pn-libhugetlbfs:libc-glibc:toolchain-clang:x86-64 = "-rtlib=libgcc --unwindlib=libgcc" 430COMPILER_RT:pn-libhugetlbfs:libc-glibc:toolchain-clang:x86-64 = "-rtlib=libgcc --unwindlib=libgcc"
391COMPILER_RT:pn-tsocks:libc-glibc:toolchain-clang:x86-64 = "-rtlib=libgcc --unwindlib=libgcc" 431COMPILER_RT:pn-tsocks:libc-glibc:toolchain-clang:x86-64 = "-rtlib=libgcc --unwindlib=libgcc"
432# | tmp-lmp/work/corei7-64-lmp-linux/ostree/2021.6-r0/recipe-sysroot-native/usr/bin/x86_64-lmp-linux/x86_64-lmp-linux-ld: tmp-lmp/work/corei7-64-lmp-linux/ostree/2021.6-r0/recipe-sysroot//usr/lib/libc.a(printf_fp.o): in function `__printf_fp_l':
433# | /usr/src/debug/glibc/2.35-r0/git/stdio-common/printf_fp.c:388: undefined reference to `__unordtf2'
434# | tmp-lmp/work/corei7-64-lmp-linux/ostree/2021.6-r0/recipe-sysroot-native/usr/bin/x86_64-lmp-linux/x86_64-lmp-linux-ld: /usr/src/debug/glibc/2.35-r0/git/stdio-common/printf_fp.c:388: undefined reference to `__unordtf2'
435# | tmp-lmp/work/corei7-64-lmp-linux/ostree/2021.6-r0/recipe-sysroot-native/usr/bin/x86_64-lmp-linux/x86_64-lmp-linux-ld: /usr/src/debug/glibc/2.35-r0/git/stdio-common/printf_fp.c:388: undefined reference to `__letf2'
436# | tmp-lmp/work/corei7-64-lmp-linux/ostree/2021.6-r0/recipe-sysroot-native/usr/bin/x86_64-lmp-linux/x86_64-lmp-linux-ld: tmp-lmp/work/corei7-64-lmp-linux/ostree/2021.6-r0/recipe-sysroot//usr/lib/libc.a(printf_fphex.o): in function `__printf_fphex':
437# | /usr/src/debug/glibc/2.35-r0/git/stdio-common/../stdio-common/printf_fphex.c:206: undefined reference to `__unordtf2'
438# | tmp-lmp/work/corei7-64-lmp-linux/ostree/2021.6-r0/recipe-sysroot-native/usr/bin/x86_64-lmp-linux/x86_64-lmp-linux-ld: /usr/src/debug/glibc/2.35-r0/git/stdio-common/../stdio-common/printf_fphex.c:206: undefined reference to `__unordtf2'
439# | tmp-lmp/work/corei7-64-lmp-linux/ostree/2021.6-r0/recipe-sysroot-native/usr/bin/x86_64-lmp-linux/x86_64-lmp-linux-ld: /usr/src/debug/glibc/2.35-r0/git/stdio-common/../stdio-common/printf_fphex.c:206: undefined reference to `__letf2'
440# | x86_64-lmp-linux-clang -target x86_64-lmp-linux -m64 -march=nehalem -mtune=generic -mfpmath=sse -msse4.2 -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -fstack-protector-strong -O2 -D_F
441COMPILER_RT:pn-ostree:libc-glibc:toolchain-clang:x86 = "-rtlib=libgcc --unwindlib=libgcc"
442COMPILER_RT:pn-ostree:libc-glibc:toolchain-clang:x86-64 = "-rtlib=libgcc --unwindlib=libgcc"
392 443
393#(unwind.o): in function `__pthread_unwind': 444#(unwind.o): in function `__pthread_unwind':
394#/usr/src/debug/glibc/2.29-r0/git/nptl/unwind.c:121: undefined reference to `_Unwind_ForcedUnwind' 445#/usr/src/debug/glibc/2.29-r0/git/nptl/unwind.c:121: undefined reference to `_Unwind_ForcedUnwind'
@@ -399,6 +450,22 @@ COMPILER_RT:pn-libhugetlbfs:libc-glibc:toolchain-clang:arm = "--unwindlib=libgcc
399# https://github.com/llvm/llvm-project/issues/63743 450# https://github.com/llvm/llvm-project/issues/63743
400LIBCPLUSPLUS:pn-apt:toolchain-clang = "-stdlib=libstdc++" 451LIBCPLUSPLUS:pn-apt:toolchain-clang = "-stdlib=libstdc++"
401 452
453# All following need to use libstdc++ with clang-19
454# see https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals
455LIBCPLUSPLUS:pn-pbzip2:toolchain-clang = "-stdlib=libstdc++"
456LIBCPLUSPLUS:pn-nlohmann-json:toolchain-clang = "-stdlib=libstdc++"
457LIBCPLUSPLUS:pn-paho-mqtt-cpp:toolchain-clang = "-stdlib=libstdc++"
458LIBCPLUSPLUS:pn-poco:toolchain-clang = "-stdlib=libstdc++"
459LIBCPLUSPLUS:pn-netdata:toolchain-clang = "-stdlib=libstdc++"
460LIBCPLUSPLUS:pn-cpp-netlib:toolchain-clang = "-stdlib=libstdc++"
461LIBCPLUSPLUS:pn-cpprest:toolchain-clang = "-stdlib=libstdc++"
462# See https://lists.openembedded.org/g/openembedded-devel/topic/meta_oe_patch_2_3/108964413
463LIBCPLUSPLUS:pn-tomlplusplus:toolchain-clang = "-stdlib=libstdc++"
464LIBCPLUSPLUS:pn-doxygen:toolchain-clang = "-stdlib=libstdc++"
465# https://www.mail-archive.com/freebsd-pkg-fallout@freebsd.org/msg2394451.html
466LIBCPLUSPLUS:pn-snort3:toolchain-clang = "-stdlib=libstdc++"
467LIBCPLUSPLUS:pn-libdaq:toolchain-clang = "-stdlib=libstdc++"
468
402# Uses gcc for native tools, e.g. nsinstall and passes clang options which fails so 469# Uses gcc for native tools, e.g. nsinstall and passes clang options which fails so
403# let same compiler ( gcc or clang) be native/cross compiler 470# let same compiler ( gcc or clang) be native/cross compiler
404# | gcc: error: unrecognized command line option ‘-Qunused-arguments’ 471# | gcc: error: unrecognized command line option ‘-Qunused-arguments’
@@ -475,12 +542,9 @@ OBJDUMP:pn-libbsd:mips:toolchain-clang = "${HOST_PREFIX}objdump"
475STRIP:pn-python3-matplotlib:toolchain-clang:riscv64 = "${HOST_PREFIX}llvm-strip" 542STRIP:pn-python3-matplotlib:toolchain-clang:riscv64 = "${HOST_PREFIX}llvm-strip"
476STRIP:pn-python3-matplotlib:toolchain-clang:riscv32 = "${HOST_PREFIX}llvm-strip" 543STRIP:pn-python3-matplotlib:toolchain-clang:riscv32 = "${HOST_PREFIX}llvm-strip"
477 544
478#riscv64-yoe-linux-strip: TOPDIR/build/tmp/work/riscv64-yoe-linux/nmap/7.80-r0/image/usr/bin/stUPhYkC: not enough room for program headers, try linking with -N
479LDFLAGS:append:pn-nmap:riscv64:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,-N', '', d)}"
480
481# Need OBJDUMP during do_package_qa which is set to llvm-objdump with meta-clang 545# Need OBJDUMP during do_package_qa which is set to llvm-objdump with meta-clang
482# it might work with GNU objdump since it falls back to one from build host 546# it might work with GNU objdump since it falls back to one from build host
483DEPENDS:pn-linux-firmware:append:toolchain-clang = " clang-native" 547DEPENDS:append:pn-linux-firmware:toolchain-clang = " clang-native"
484 548
485# Needs for solving fopenmp issues 549# Needs for solving fopenmp issues
486DEPENDS:append:pn-pixman:mips:toolchain-clang = " openmp" 550DEPENDS:append:pn-pixman:mips:toolchain-clang = " openmp"
@@ -495,6 +559,15 @@ CFLAGS:append:pn-pixman:arm:toolchain-clang = " -no-integrated-as"
495# vsetvli zero, zero, e16, m1 559# vsetvli zero, zero, e16, m1
496CFLAGS:append:pn-dav1d:riscv64:toolchain-clang = " -no-integrated-as" 560CFLAGS:append:pn-dav1d:riscv64:toolchain-clang = " -no-integrated-as"
497 561
562# ../numpy-2.2.3/numpy/_core/src/highway/hwy/ops/rvv-inl.h:644:17: error: use of undeclared identifier '__riscv_vsetvl_e8mf8'
563# This only happens with clang with rv64gc
564TOOLCHAIN_OPTIONS:append:pn-python3-numpy:riscv64:toolchain-clang = " -march=rv64gcv"
565TOOLCHAIN_OPTIONS:append:pn-python3-numpy:riscv32:toolchain-clang = " -march=rv32gcv"
566
567# git/lib/simdutf-amalgamation-5.5.0/src/simdutf/simdutf.cpp:4941:57: error: RISC-V type 'vuint16m1_t' (aka '__rvv_uint16m1_t') requires the 'zve32x' extension
568# return __riscv_vmacc_vx_u16m1(__riscv_vsrl_vx_u16m1(v, 8, vl), 0x100, v, vl);
569TOOLCHAIN_OPTIONS:append:pn-fluentbit:riscv64:toolchain-clang = " -march=rv64gcv"
570
498# test_connectx segfaults with this option set to -fstack-protector-strong 571# test_connectx segfaults with this option set to -fstack-protector-strong
499SECURITY_STACK_PROTECTOR:pn-lksctp-tools:toolchain-clang = "" 572SECURITY_STACK_PROTECTOR:pn-lksctp-tools:toolchain-clang = ""
500 573
@@ -510,7 +583,6 @@ LDFLAGS:append:pn-libgcrypt:toolchain-clang = "${@bb.utils.contains('DISTRO_FEAT
510LDFLAGS:append:pn-libxml2:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 583LDFLAGS:append:pn-libxml2:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
511LDFLAGS:append:pn-binutils:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 584LDFLAGS:append:pn-binutils:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
512LDFLAGS:append:pn-libnss-mdns:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 585LDFLAGS:append:pn-libnss-mdns:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
513LDFLAGS:append:pn-bluez5:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
514LDFLAGS:append:pn-pulseaudio:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 586LDFLAGS:append:pn-pulseaudio:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
515LDFLAGS:append:pn-mesa:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 587LDFLAGS:append:pn-mesa:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
516LDFLAGS:append:pn-mesa-gl:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 588LDFLAGS:append:pn-mesa-gl:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
@@ -613,8 +685,18 @@ LDFLAGS:append:pn-libcgroup:toolchain-clang = "${@bb.utils.contains('DISTRO_FEAT
613LDFLAGS:append:pn-kernel-selftest:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 685LDFLAGS:append:pn-kernel-selftest:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
614LDFLAGS:append:pn-openldap:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 686LDFLAGS:append:pn-openldap:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
615LDFLAGS:append:pn-liburing:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 687LDFLAGS:append:pn-liburing:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
688LDFLAGS:append:pn-frame:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
616# | x86_64-yoe-linux-musl-ld.lld: error: version script assignment of 'global' to symbol 'pam_sm_chauthtok' failed: symbol not defined 689# | x86_64-yoe-linux-musl-ld.lld: error: version script assignment of 'global' to symbol 'pam_sm_chauthtok' failed: symbol not defined
617LDFLAGS:append:pn-wtmpdb:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}" 690LDFLAGS:append:pn-wtmpdb:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
691# arm-yoe-linux-gnueabi-ld.lld: error: version script assignment of 'global' to symbol 'pam_sm_chauthtok' failed: symbol not defined
692LDFLAGS:append:pn-util-linux:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
693LDFLAGS:append:pn-util-linux-libuuid:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
694# riscv64-yoe-linux-musl-ld.lld: error: version script assignment of 'global' to symbol 'pam_sm_chauthtok' failed: symbol not defined
695LDFLAGS:append:pn-libpam:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
696# i686-yoe-linux-ld.lld: error: version script assignment of 'SLIRP_4.0' to symbol 'slirp_add_exec' failed: symbol not defined
697LDFLAGS:append:pn-libslirp:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
698# x86_64-yoe-linux-ld.lld: error: version script assignment of 'NSSMDNS_0' to symbol '_nss_mdns_gethostbyaddr_r' failed: symbol not defined
699LDFLAGS:append:pn-avahi-libnss-mdns:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -Wl,--undefined-version', '', d)}"
618TUNE_CCARGS:remove:pn-kernel-selftest:toolchain-clang = "-mfpmath=sse" 700TUNE_CCARGS:remove:pn-kernel-selftest:toolchain-clang = "-mfpmath=sse"
619 701
620# Avoid's go linker crash as reported in https://github.com/golang/go/issues/61872 702# Avoid's go linker crash as reported in https://github.com/golang/go/issues/61872
@@ -634,5 +716,30 @@ LDFLAGS:remove:pn-aufs-util:toolchain-clang = "${@bb.utils.contains('DISTRO_FEAT
634# | arm-yoe-linux-gnueabi-ld.lld: error: version script assignment of 'global' to symbol 'pam_sm_chauthtok' failed: symbol not defined 716# | arm-yoe-linux-gnueabi-ld.lld: error: version script assignment of 'global' to symbol 'pam_sm_chauthtok' failed: symbol not defined
635LDFLAGS:append:pn-lastlog2:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=bfd', '', d)}" 717LDFLAGS:append:pn-lastlog2:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=bfd', '', d)}"
636LDFLAGS:remove:pn-lastlog2:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '-fuse-ld=lld', '', d)}" 718LDFLAGS:remove:pn-lastlog2:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '-fuse-ld=lld', '', d)}"
637 719LDFLAGS:remove:pn-python3-bcrypt:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld ptest', '-fuse-ld=lld', '', d)}"
720LDFLAGS:remove:pn-bluez5:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '-fuse-ld=lld', '', d)}"
721LDFLAGS:append:pn-bluez5:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', ' -fuse-ld=bfd', '', d)}"
722# lld ends up with unsupported relocation type 12 with clang-20 on mesa 25
638LD:pn-gnu-efi:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '${HOST_PREFIX}ld.bfd${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', '${HOST_PREFIX}ld${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', d)}" 723LD:pn-gnu-efi:toolchain-clang = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '${HOST_PREFIX}ld.bfd${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', '${HOST_PREFIX}ld${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}', d)}"
724LD:pn-libhugetlbfs:toolchain-clang = "${HOST_PREFIX}ld.bfd${TOOLCHAIN_OPTIONS} ${HOST_LD_ARCH}"
725LD:pn-libunix-statgrab:toolchain-clang = "${CC}"
726
727TOOLCHAIN:pn-perf = "gcc"
728
729# See https://github.com/llvm/llvm-project/issues/108262
730SELECTED_OPTIMIZATION:remove:pn-libjxl:arm:toolchain-clang = "-O2"
731SELECTED_OPTIMIZATION:append:pn-libjxl:arm:toolchain-clang = " -Og"
732
733# qemu usermode crashes when using clang as system compiler but works with gcc
734# see https://patchwork.yoctoproject.org/project/oe-core/patch/20240923234336.3978188-1-raj.khem@gmail.com/
735GI_DATA_ENABLED:pn-vte:toolchain-clang:armv7ve = "False"
736
737# in following 4 recipes g-i fails to parse glibc 2.41 headers with clang on x86 arches
738GI_DATA_ENABLED:pn-libmodulemd:toolchain-clang:x86 = "False"
739GI_DATA_ENABLED:pn-libblockdev:toolchain-clang:x86 = "False"
740GI_DATA_ENABLED:pn-webkitgtk3:toolchain-clang:x86 = "False"
741GI_DATA_ENABLED:pn-webkitgtk:toolchain-clang:x86 = "False"
742GI_DATA_ENABLED:pn-libmodulemd:toolchain-clang:x86-64 = "False"
743GI_DATA_ENABLED:pn-libblockdev:toolchain-clang:x86-64 = "False"
744GI_DATA_ENABLED:pn-webkitgtk3:toolchain-clang:x86-64 = "False"
745GI_DATA_ENABLED:pn-webkitgtk:toolchain-clang:x86-64 = "False"
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-tests-cc-Use-c-14-standard.patch b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-tests-cc-Use-c-14-standard.patch
deleted file mode 100644
index dcd9dc1..0000000
--- a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-tests-cc-Use-c-14-standard.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 9f45e12ad4689ca2c41844b77c6d789d21509a13 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 6 Mar 2023 13:26:11 -0800
4Subject: [PATCH] tests/cc: Use c++14 standard
5
6default c++ standard was bumped to c++17 when using clang16+ compiler
7via 907b89cc9, however, tests which use check tool is not yet ported
8to work with c++17 standard, therefore use c++14 on tests
9
10Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/4506]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Cc: Hengqi Chen <chenhengqi@outlook.com>
13---
14 tests/cc/CMakeLists.txt | 4 ++++
15 1 file changed, 4 insertions(+)
16
17--- a/tests/cc/CMakeLists.txt
18+++ b/tests/cc/CMakeLists.txt
19@@ -27,6 +27,10 @@ if(${LLVM_PACKAGE_VERSION} VERSION_EQUAL
20 set(CMAKE_CXX_STANDARD 14)
21 endif()
22
23+if(${LLVM_PACKAGE_VERSION} VERSION_EQUAL 16 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 16)
24+set(CMAKE_CXX_STANDARD 14)
25+endif()
26+
27 if(ENABLE_USDT)
28 set(TEST_LIBBCC_SOURCES
29 test_libbcc.cc
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/bpf_stack_id.patch b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/bpf_stack_id.patch
new file mode 100644
index 0000000..18221be
--- /dev/null
+++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/bpf_stack_id.patch
@@ -0,0 +1,13 @@
1Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/5292]
2Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
3
4--- a/tests/cc/test_bpf_table.cc
5+++ b/tests/cc/test_bpf_table.cc
6@@ -260,6 +260,7 @@
7 /* libc locations on different distributions are added below*/
8 bpf.add_module("/lib/x86_64-linux-gnu/libc.so.6"); //Location of libc in ubuntu
9 bpf.add_module("/lib64/libc.so.6"); //Location of libc fedora machine
10+ bpf.add_module("/lib/libc.so.6");//location of libc in image
11
12 int stack_id = id[0];
13 REQUIRE(stack_id >= 0);
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch
new file mode 100644
index 0000000..a3a1ec9
--- /dev/null
+++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch
@@ -0,0 +1,16 @@
1Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/5355]
2Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
3
4diff --git a/tests/python/test_tools_memleak.py b/tests/python/test_tools_memleak.py
5--- a/tests/python/test_tools_memleak.py
6+++ b/tests/python/test_tools_memleak.py
7@@ -26,7 +26,7 @@
8 # Build the memory leaking application.
9 c_src = 'test_tools_memleak_leaker_app.c'
10 tmp_dir = tempfile.mkdtemp(prefix='bcc-test-memleak-')
11- c_src_full = os.path.dirname(sys.argv[0]) + os.path.sep + c_src
12+ c_src_full = os.path.abspath(os.path.dirname(sys.argv[0])) + os.path.sep + c_src
13 exec_dst = tmp_dir + os.path.sep + 'leaker_app'
14
15 if subprocess.call(['gcc', '-g', '-O0', '-o', exec_dst, c_src_full]) != 0:
16
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/run-ptest b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/run-ptest
index a27f697..4740ae9 100644
--- a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/run-ptest
+++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/run-ptest
@@ -17,6 +17,29 @@ print_test_result() {
17 fi 17 fi
18} 18}
19 19
20ARCH=$(uname -m)
21
22case "$ARCH" in
23 x86_64)
24 KDIR="x86"
25 ;;
26 riscv64)
27 KDIR="riscv"
28 ;;
29 aarch64)
30 KDIR="arm64"
31 ;;
32 powerpc64le | ppc64le)
33 KDIR="powerpc"
34 ;;
35 *)
36 echo "Architecture not present, Add the architecture in run-ptest: $ARCH"
37 exit 1
38 ;;
39esac
40
41export BCC_KERNEL_SOURCE="/usr/src/kernel/arch/$KDIR"
42
20# Run CC tests, set IFS as test names have spaces 43# Run CC tests, set IFS as test names have spaces
21IFS=$(printf '\n\t') 44IFS=$(printf '\n\t')
22for test_name in $(./cc/test_libbcc_no_libbpf --list-test-names-only); do 45for test_name in $(./cc/test_libbcc_no_libbpf --list-test-names-only); do
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/support_finish_task_switch_isra_0.patch b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/support_finish_task_switch_isra_0.patch
new file mode 100644
index 0000000..92a3f7b
--- /dev/null
+++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/support_finish_task_switch_isra_0.patch
@@ -0,0 +1,49 @@
1Upstream-Status: Backport [https://github.com/iovisor/bcc/pull/5302/commits/b24519e1ba7b87c9676ae3a7f70772215cd5819d]
2Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
3
4diff --git a/tests/python/test_histogram.py b/tests/python/test_histogram.py
5--- a/tests/python/test_histogram.py
6+++ b/tests/python/test_histogram.py
7@@ -64,7 +64,7 @@
8 #include <linux/version.h>
9 typedef struct { char name[TASK_COMM_LEN]; u64 slot; } Key;
10 BPF_HISTOGRAM(hist1, Key, 1024);
11-int kprobe__finish_task_switch(struct pt_regs *ctx, struct task_struct *prev) {
12+int count_prev_task_start_time(struct pt_regs *ctx, struct task_struct *prev) {
13 #if LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0)
14 Key k = {.slot = bpf_log2l(prev->real_start_time)};
15 #else
16@@ -77,6 +77,10 @@
17 return 0;
18 }
19 """)
20+ b.attach_kprobe(
21+ event_re=r'^finish_task_switch$|^finish_task_switch\.isra\.\d$',
22+ fn_name=b"count_prev_task_start_time"
23+ )
24 for i in range(0, 100): time.sleep(0.01)
25 b[b"hist1"].print_log2_hist()
26 b.cleanup()
27diff --git a/tests/python/test_clang.py b/tests/python/test_clang.py
28--- a/tests/python/test_clang.py
29+++ b/tests/python/test_clang.py
30@@ -399,7 +399,7 @@
31 u32 curr_pid;
32 };
33 BPF_HASH(stats, struct key_t, u64, 1024);
34-int kprobe__finish_task_switch(struct pt_regs *ctx, struct task_struct *prev) {
35+int count_sched(struct pt_regs *ctx, struct task_struct *prev) {
36 struct key_t key = {};
37 u64 zero = 0, *val;
38 key.curr_pid = bpf_get_current_pid_tgid();
39@@ -412,6 +412,10 @@
40 return 0;
41 }
42 """)
43+ b.attach_kprobe(
44+ event_re=r'^finish_task_switch$|^finish_task_switch\.isra\.\d$',
45+ fn_name=b"count_sched"
46+ )
47
48 def test_probe_simple_assign(self):
49 b = BPF(text=b"""
diff --git a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.33.0.bb
index ec3811e..768b08e 100644
--- a/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.29.1.bb
+++ b/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.33.0.bb
@@ -16,20 +16,22 @@ DEPENDS += "bison-native \
16 " 16 "
17 17
18RDEPENDS:${PN} += "bash python3 python3-core python3-setuptools xz" 18RDEPENDS:${PN} += "bash python3 python3-core python3-setuptools xz"
19RDEPENDS:${PN}-ptest = "cmake python3 python3-netaddr python3-pyroute2" 19RDEPENDS:${PN}-ptest = "kernel-devsrc packagegroup-core-buildessential cmake bash python3 python3-netaddr python3-pyroute2"
20 20
21SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https \ 21SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https \
22 file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \ 22 file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \
23 file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \ 23 file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \
24 file://0001-tests-cc-Use-c-14-standard.patch \
25 file://0001-CMakeLists.txt-don-t-modify-.gitconfig-on-build-host.patch \ 24 file://0001-CMakeLists.txt-don-t-modify-.gitconfig-on-build-host.patch \
26 file://run-ptest \ 25 file://run-ptest \
27 file://ptest_wrapper.sh \ 26 file://ptest_wrapper.sh \
27 file://bpf_stack_id.patch \
28 file://support_finish_task_switch_isra_0.patch \
29 file://fix_for_memleak.patch \
28 " 30 "
29 31
30SRCREV = "eb8ede2d70b17350757f2570ef76ea4c2e1dbff8" 32SRCREV = "92e32ff8a06616779f3a3191b75da6881d59fd17"
31 33
32S = "${WORKDIR}/git" 34PV .= "+git"
33 35
34PACKAGECONFIG ??= "examples" 36PACKAGECONFIG ??= "examples"
35PACKAGECONFIG:remove:libc-musl = "examples" 37PACKAGECONFIG:remove:libc-musl = "examples"
@@ -38,6 +40,7 @@ PACKAGECONFIG[manpages] = "-DENABLE_MAN=ON,-DENABLE_MAN=OFF,"
38PACKAGECONFIG[examples] = "-DENABLE_EXAMPLES=ON,-DENABLE_EXAMPLES=OFF," 40PACKAGECONFIG[examples] = "-DENABLE_EXAMPLES=ON,-DENABLE_EXAMPLES=OFF,"
39 41
40EXTRA_OECMAKE = " \ 42EXTRA_OECMAKE = " \
43 -DREVISION='${PV}' \
41 -DCMAKE_USE_LIBBPF_PACKAGE=ON \ 44 -DCMAKE_USE_LIBBPF_PACKAGE=ON \
42 -DENABLE_LLVM_SHARED=ON \ 45 -DENABLE_LLVM_SHARED=ON \
43 -DENABLE_CLANG_JIT=ON \ 46 -DENABLE_CLANG_JIT=ON \
@@ -46,6 +49,10 @@ EXTRA_OECMAKE = " \
46 -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \ 49 -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \
47" 50"
48 51
52# Avoid stripping debuginfo.so to fix some tests.
53INHIBIT_PACKAGE_STRIP = "1"
54INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
55
49do_install:append() { 56do_install:append() {
50 sed -e 's@#!/usr/bin/env python@#!/usr/bin/env python3@g' \ 57 sed -e 's@#!/usr/bin/env python@#!/usr/bin/env python3@g' \
51 -i $(find ${D}${datadir}/${PN} -type f) 58 -i $(find ${D}${datadir}/${PN} -type f)
@@ -56,13 +63,34 @@ do_install:append() {
56 63
57do_install_ptest() { 64do_install_ptest() {
58 install -d ${D}${PTEST_PATH}/tests/cc 65 install -d ${D}${PTEST_PATH}/tests/cc
66 # ptest searches for shared libs and archive files in the build folder.
67 # Hence, these files are copied to the image to fix these tests.
68 install -d ${D}${B}/tests/cc
69 install ${B}/tests/cc/archive.zip ${B}/tests/cc/libdebuginfo_test_lib.so ${B}/tests/cc/with_gnu_debuglink.so ${B}/tests/cc/with_gnu_debugdata.so ${B}/tests/cc/debuginfo.so ${D}${B}/tests/cc
70 install -d ${D}/opt
59 install ${B}/tests/cc/test_libbcc_no_libbpf ${B}/tests/cc/libusdt_test_lib.so ${D}${PTEST_PATH}/tests/cc 71 install ${B}/tests/cc/test_libbcc_no_libbpf ${B}/tests/cc/libusdt_test_lib.so ${D}${PTEST_PATH}/tests/cc
60 cp -rf ${S}/tests/python ${D}${PTEST_PATH}/tests/python 72 cp -rf ${S}/tests/python ${D}${PTEST_PATH}/tests/python
61 install ${WORKDIR}/ptest_wrapper.sh ${D}${PTEST_PATH}/tests 73 install ${UNPACKDIR}/ptest_wrapper.sh ${D}${PTEST_PATH}/tests
62 install ${S}/examples/networking/simulation.py ${D}${PTEST_PATH}/tests/python 74 install ${S}/examples/networking/simulation.py ${D}${PTEST_PATH}/tests/python
75 find ${B}/../sources/bcc-0.33.0+git/tools/ -type f -name "*.py" -exec \
76 sed -i \
77 -e 's@^#! */usr/bin/env python$@#!/usr/bin/env python3@' \
78 -e 's@^#! */usr/bin/python.*@#!/usr/bin/env python3@' {} +
79 cp -rf ${B}/../sources/bcc-0.33.0+git/tools/ ${D}${PTEST_PATH}/../../tools/
63} 80}
64 81
65FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" 82FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}"
83FILES:${PN} += "${B}/tests/cc"
84FILES:${PN}-ptest += "${libdir}/tools/"
85FILES:${PN}-ptest += "/opt/"
66FILES:${PN}-doc += "${datadir}/${PN}/man" 86FILES:${PN}-doc += "${datadir}/${PN}/man"
67 87
68COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" 88COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux"
89
90# WARNING: bcc-0.30.0+git-r0 do_package_qa: QA Issue: File /usr/lib/bcc/ptest/tests/cc/test_libbcc_no_libbpf in package bcc-ptest contains reference to TMPDIR [buildpaths]
91# this one is difficult to resolve, because the tests use CMAKE_CURRENT_BINARY_DIR directly in .cc e.g.:
92# https://github.com/iovisor/bcc/commit/7271bfc946a19413761be2e3c60c48bf72c5eea1#diff-233a0bfa490f3d7466c49935b64c86dd93956bbc0461f5af703b344cf6601461
93# we would probably need to use separate variable for "runtime" path for test assets from the standard CMAKE_CURRENT_BINARY_DIR variable or use relative
94# path from the test binary
95WARN_QA:append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' buildpaths', '', d)}"
96ERROR_QA:remove = "${@bb.utils.contains('PTEST_ENABLED', '1', 'buildpaths', '', d)}"
diff --git a/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Fix-build-failures-due-to-missing-location.hh.patch b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Fix-build-failures-due-to-missing-location.hh.patch
new file mode 100644
index 0000000..1c2ae33
--- /dev/null
+++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Fix-build-failures-due-to-missing-location.hh.patch
@@ -0,0 +1,54 @@
1From 24421ba92c69f1abaadaff01270621917616a2b8 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Thu, 17 Apr 2025 10:38:50 +0800
4Subject: [PATCH] Fix build failures due to missing location.hh
5
6ast/location.h does `#include "location.hh"` and location.hh is
7generated by the parser so any CMake target whose source includes
8ast/location.h needs to have a dependency on the `parser` target,
9otherwise the compilation may fail due to incorrect ordering of build
10targets. This also applies to targets which include ast/location.h
11transitively via other headers.
12
13To avoid such errors, do 2 things:
14- drop includes of ast/location.h where unused
15- for CMake targets including ast/location.h, add an explicit dependency
16 on the `parser` target
17
18Signed-off-by: Viktor Malik <viktor.malik@gmail.com>
19
20Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/commit/743cb9c88c25fb9737d714f4d4ac853f05bb6481]
21
22Signed-off-by: Changqing Li <changqing.li@windriver.com>
23---
24 src/CMakeLists.txt | 1 +
25 src/ast/CMakeLists.txt | 1 +
26 2 files changed, 2 insertions(+)
27
28diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
29index e04ee429..13a51040 100644
30--- a/src/CMakeLists.txt
31+++ b/src/CMakeLists.txt
32@@ -21,6 +21,7 @@ add_library(compiler_core STATIC
33 struct.cpp
34 types.cpp
35 )
36+add_dependencies(compiler_core parser)
37
38 add_library(runtime STATIC
39 attached_probe.cpp
40diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
41index 92231f85..7230cf71 100644
42--- a/src/ast/CMakeLists.txt
43+++ b/src/ast/CMakeLists.txt
44@@ -22,6 +22,7 @@ add_library(ast STATIC
45 passes/return_path_analyser.cpp
46 )
47
48+add_dependencies(ast parser)
49 target_compile_definitions(ast PRIVATE ${BPFTRACE_FLAGS})
50 target_link_libraries(ast PUBLIC ast_defs arch compiler_core parser)
51
52--
532.34.1
54
diff --git a/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch
new file mode 100644
index 0000000..4f0ebbf
--- /dev/null
+++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch
@@ -0,0 +1,38 @@
1From ce5d908bb1256ede680fbfd521f087060a567dca Mon Sep 17 00:00:00 2001
2From: Martin Jansa <martin.jansa@gmail.com>
3Date: Tue, 3 Sep 2024 14:17:51 +0200
4Subject: [PATCH] CMakeLists.txt: allow to set BISON_FLAGS like -l
5
6Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
7
8Upstream-Status: Pending
9---
10 CMakeLists.txt | 10 +++++++---
11 1 file changed, 7 insertions(+), 3 deletions(-)
12
13--- a/CMakeLists.txt
14+++ b/CMakeLists.txt
15@@ -100,16 +100,20 @@ include_directories(SYSTEM ${LIBCEREAL_I
16
17 find_package(BISON REQUIRED)
18 find_package(FLEX REQUIRED)
19+
20+# avoid buildpaths in generated #line statements and allow to pass --file-prefix-map=OLD=NEW
21+set(BISON_FLAGS "${BISON_FLAGS} -l")
22+set(FLEX_FLAGS "${FLEX_FLAGS} -L")
23 # `parser_class_name` is deprecated and generates warnings in bison >= 3.3.
24 # But `api.parser.class` is not supported in bison < 3.3. So we must inject
25 # the %define based on the bison version here.
26 if(${BISON_VERSION} VERSION_GREATER_EQUAL 3.3)
27- set(BISON_FLAGS "-Dapi.parser.class={Parser}")
28+ set(BISON_FLAGS "${BISON_FLAGS} -Dapi.parser.class={Parser}")
29 else()
30- set(BISON_FLAGS "-Dparser_class_name={Parser}")
31+ set(BISON_FLAGS "${BISON_FLAGS} -Dparser_class_name={Parser}")
32 endif()
33 bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS ${BISON_FLAGS} VERBOSE)
34-flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
35+flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc COMPILE_FLAGS ${FLEX_FLAGS})
36 add_flex_bison_dependency(flex_lexer bison_parser)
37 add_library(parser STATIC ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
38 target_compile_options(parser PRIVATE "-w")
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest
index 63d65e2..63d65e2 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest
+++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.23.0.bb
index 355f427..bd3b772 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb
+++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.23.0.bb
@@ -18,23 +18,22 @@ RDEPENDS:${PN} += "bash python3 xz"
18 18
19PV .= "+git" 19PV .= "+git"
20 20
21SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ 21SRC_URI = "git://github.com/iovisor/bpftrace;branch=release/0.23.x;protocol=https \
22 file://0001-replace-python-with-python3-in-the-test.patch \
23 file://0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch \
24 file://0003-ast-Adjust-to-enum-changes-in-llvm-18.patch \
25 file://0004-cmake-Bump-max-LLVM-version-to-18.patch \
26 file://0001-use-64bit-alignment-for-map-counter-atomic-add.patch \
27 file://run-ptest \ 22 file://run-ptest \
23 file://0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch \
24 file://0001-Fix-build-failures-due-to-missing-location.hh.patch \
28" 25"
29SRCREV = "fe6362b4e2c1b9d0833c7d3f308c1d4006b54723" 26SRCREV = "01e806d24c61f996f1809e1e991646311499db4f"
30 27
31S = "${WORKDIR}/git" 28inherit bash-completion cmake ptest pkgconfig
32 29
33inherit cmake ptest 30PACKAGECONFIG ?= " \
34 31 ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
35PACKAGECONFIG ?= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" 32 ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd", "", d)} \
33 "
36 34
37PACKAGECONFIG[tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,gtest xxd-native" 35PACKAGECONFIG[tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,gtest xxd-native"
36PACKAGECONFIG[systemd] = "-DENABLE_SYSTEMD=ON,-DENABLE_SYSTEMD=OFF,systemd"
38 37
39do_install_ptest() { 38do_install_ptest() {
40 if [ -e ${B}/tests/bpftrace_test ]; then 39 if [ -e ${B}/tests/bpftrace_test ]; then
@@ -44,17 +43,12 @@ do_install_ptest() {
44 fi 43 fi
45} 44}
46 45
47def llvm_major_version(d):
48 pvsplit = d.getVar('LLVMVERSION').split('.')
49 return pvsplit[0]
50
51LLVM_MAJOR_VERSION = "${@llvm_major_version(d)}"
52
53EXTRA_OECMAKE = " \ 46EXTRA_OECMAKE = " \
54 -DCMAKE_ENABLE_EXPORTS=1 \ 47 -DCMAKE_ENABLE_EXPORTS=1 \
55 -DCMAKE_BUILD_TYPE=Release \ 48 -DCMAKE_BUILD_TYPE=Release \
56 -DUSE_SYSTEM_BPF_BCC=ON \ 49 -DUSE_SYSTEM_BPF_BCC=ON \
57 -DENABLE_MAN=OFF \ 50 -DENABLE_MAN=OFF \
51 -DBISON_FLAGS='--file-prefix-map=${WORKDIR}=' \
58" 52"
59 53
60COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" 54COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux"
@@ -63,3 +57,6 @@ COMPATIBLE_HOST:libc-musl = "null"
63INHIBIT_PACKAGE_STRIP_FILES += "\ 57INHIBIT_PACKAGE_STRIP_FILES += "\
64 ${PKGD}${PTEST_PATH}/tests/testprogs/uprobe_test \ 58 ${PKGD}${PTEST_PATH}/tests/testprogs/uprobe_test \
65" 59"
60
61WARN_QA:append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' buildpaths', '', d)}"
62ERROR_QA:remove = "${@bb.utils.contains('PTEST_ENABLED', '1', 'buildpaths', '', d)}"
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch
deleted file mode 100644
index 4438716..0000000
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-replace-python-with-python3-in-the-test.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From 62319459e7ef14a37293bc10830b52edf89daabe Mon Sep 17 00:00:00 2001
2From: Wentao Zhang <wentao.zhang@windriver.com>
3Date: Tue, 15 Aug 2023 11:18:36 +0800
4Subject: [PATCH 1/4] replace python with python3 in the test
5
6"runtime:call" in ptest gets the following FAILED:
7python: No such file or directory
8replace python with python3 in the test scripts.
9
10$export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin
11$cd /usr/lib/bpftrace/ptest/tests
12$python3 runtime/engine/main.py --filter="call.*"
13***
14[ RUN ] call.strftime_microsecond_extension_rollover
15[ FAILED ] call.strftime_microsecond_extension_rollover
16 Command: /usr/bin/bpftrace -e 'BEGIN { printf("%s - %s\n", strftime
17 ("1%f", 1000000123000), strftime("1%f", 0)); exit(); }' | tail -n
18 +2 | xargs -I{} python -c "print({})"
19 Unclean exit code: 127
20 Output: __BPFTRACE_NOTIFY_PROBES_ATTACHED\nxargs: python: No such
21 file or directory\n
22***
23
24Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009]
25
26Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com>
27---
28 tests/runtime/call | 4 ++--
29 1 file changed, 2 insertions(+), 2 deletions(-)
30
31diff --git a/tests/runtime/call b/tests/runtime/call
32index 7f7cce6d..174bce95 100644
33--- a/tests/runtime/call
34+++ b/tests/runtime/call
35@@ -371,13 +371,13 @@ TIMEOUT 5
36 #
37 # Note we add a `1` before the timestamp b/c leading zeros (eg `0123`) is invalid integer in python.
38 NAME strftime_microsecond_extension
39-RUN {{BPFTRACE}} -e 'BEGIN { printf("%s - %s\n", strftime("1%f", 1000123000), strftime("1%f", 0)); exit(); }' | tail -n +2 | xargs -I{} python -c "print({})"
40+RUN {{BPFTRACE}} -e 'BEGIN { printf("%s - %s\n", strftime("1%f", 1000123000), strftime("1%f", 0)); exit(); }' | tail -n +2 | xargs -I{} python3 -c "print({})"
41 EXPECT 123
42 TIMEOUT 1
43
44 # Similar to above test but test that rolling over past 1s works as expected
45 NAME strftime_microsecond_extension_rollover
46-RUN {{BPFTRACE}} -e 'BEGIN { printf("%s - %s\n", strftime("1%f", 1000000123000), strftime("1%f", 0)); exit(); }' | tail -n +2 | xargs -I{} python -c "print({})"
47+RUN {{BPFTRACE}} -e 'BEGIN { printf("%s - %s\n", strftime("1%f", 1000000123000), strftime("1%f", 0)); exit(); }' | tail -n +2 | xargs -I{} python3 -c "print({})"
48 EXPECT 123
49 TIMEOUT 1
50
51--
522.43.2
53
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch
deleted file mode 100644
index 49938a1..0000000
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-use-64bit-alignment-for-map-counter-atomic-add.patch
+++ /dev/null
@@ -1,49 +0,0 @@
1From 76538f80d3c56430c3105b6a3a7614313b01ddc5 Mon Sep 17 00:00:00 2001
2From: Frank van der Linden <fvdl@google.com>
3Date: Mon, 11 Mar 2024 15:35:32 +0000
4Subject: [PATCH] use 64bit alignment for map counter atomic add
5
6For an atomic inc of a map counter (ringbuf loss counter), generate
7IR with 64bit alignment. This is more correct, and will avoid problems
8with upcoming LLVM versions, as they will emit a function call for
9a potentially unaligned atomicrmw. This will lead to an error like this:
10
11error: <unknown>:0:0: in function BEGIN i64 (ptr): t15: i64 = GlobalAddress<ptr @__atomic_compare_exchange> 0 too many arguments
12
13Upstream-Status: Backport [https://github.com/bpftrace/bpftrace/pull/3045/commits/3878a437ca946ab69cc92bcd2cb3c2369625b3dc]
14
15Signed-off-by: Wentao Zhang <wentao.zhang@windriver.com>
16---
17 CHANGELOG.md | 2 ++
18 src/ast/irbuilderbpf.cpp | 2 +-
19 2 files changed, 3 insertions(+), 1 deletion(-)
20
21diff --git a/CHANGELOG.md b/CHANGELOG.md
22index 4fa3b673..81b6e0e2 100644
23--- a/CHANGELOG.md
24+++ b/CHANGELOG.md
25@@ -19,6 +19,8 @@ and this project adheres to
26 #### Fixed
27 - Fix field resolution on structs with anon union as first field
28 - [#2964](https://github.com/bpftrace/bpftrace/pull/2964)
29+- Fix alignment of atomic map counter update
30+ - [#3045](https://github.com/bpftrace/bpftrace/pull/3045)
31 #### Docs
32 #### Tools
33
34diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp
35index 2ff3c0ce..98c4b0d5 100644
36--- a/src/ast/irbuilderbpf.cpp
37+++ b/src/ast/irbuilderbpf.cpp
38@@ -1474,7 +1474,7 @@ void IRBuilderBPF::CreateAtomicIncCounter(const std::string &map_name,
39 CREATE_ATOMIC_RMW(AtomicRMWInst::BinOp::Add,
40 val,
41 getInt64(1),
42- 1,
43+ 8,
44 AtomicOrdering::SequentiallyConsistent);
45 CreateBr(lookup_merge_block);
46
47--
482.35.5
49
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch
deleted file mode 100644
index 9167963..0000000
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-ast-Repace-getInt8PtrTy-with-getPtrTy.patch
+++ /dev/null
@@ -1,338 +0,0 @@
1From 441f38a0fa9711a08ca8d904b542559593bffb16 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 16 Feb 2024 10:32:27 -0800
4Subject: [PATCH 2/4] ast: Repace getInt8PtrTy with getPtrTy
5
6getPtrTy is added in LLVM-15 and is to be used instead of getInt8PtrTy
7which is gone in LLVM-18 onwards
8
9https://github.com/llvm/llvm-project/commit/7e0802aeb5b90
10
11Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/ast/irbuilderbpf.cpp | 58 ++++++++++++++++-----------------
15 src/ast/passes/codegen_llvm.cpp | 22 ++++++-------
16 2 files changed, 40 insertions(+), 40 deletions(-)
17
18diff --git a/src/ast/irbuilderbpf.cpp b/src/ast/irbuilderbpf.cpp
19index 670a9e98..2ff3c0ce 100644
20--- a/src/ast/irbuilderbpf.cpp
21+++ b/src/ast/irbuilderbpf.cpp
22@@ -301,7 +301,7 @@ CallInst *IRBuilderBPF::createMapLookup(const std::string &map_name,
23 Value *key,
24 const std::string &name)
25 {
26- return createMapLookup(map_name, key, getInt8PtrTy(), name);
27+ return createMapLookup(map_name, key, getPtrTy(), name);
28 }
29
30 CallInst *IRBuilderBPF::createMapLookup(const std::string &map_name,
31@@ -329,7 +329,7 @@ CallInst *IRBuilderBPF::CreateGetJoinMap(BasicBlock *failure_callback,
32 {
33 return createGetScratchMap(to_string(MapManager::Type::Join),
34 "join",
35- getInt8PtrTy(),
36+ getPtrTy(),
37 loc,
38 failure_callback);
39 }
40@@ -358,8 +358,8 @@ CallInst *IRBuilderBPF::createGetScratchMap(const std::string &map_name,
41 BasicBlock *lookup_merge_block = BasicBlock::Create(
42 module_.getContext(), "lookup_" + name + "_merge", parent);
43 Value *condition = CreateICmpNE(
44- CreateIntCast(call, getInt8PtrTy(), true),
45- ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()),
46+ CreateIntCast(call, getPtrTy(), true),
47+ ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()),
48 "lookup_" + name + "_cond");
49 CreateCondBr(condition, lookup_merge_block, lookup_failure_block);
50
51@@ -379,7 +379,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx,
52 Value *key,
53 const location &loc)
54 {
55- assert(ctx && ctx->getType() == getInt8PtrTy());
56+ assert(ctx && ctx->getType() == getPtrTy());
57 return CreateMapLookupElem(ctx, map.ident, key, map.type, loc);
58 }
59
60@@ -389,7 +389,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx,
61 SizedType &type,
62 const location &loc)
63 {
64- assert(ctx && ctx->getType() == getInt8PtrTy());
65+ assert(ctx && ctx->getType() == getPtrTy());
66 CallInst *call = createMapLookup(map_name, key);
67
68 // Check if result == 0
69@@ -406,8 +406,8 @@ Value *IRBuilderBPF::CreateMapLookupElem(Value *ctx,
70
71 AllocaInst *value = CreateAllocaBPF(type, "lookup_elem_val");
72 Value *condition = CreateICmpNE(
73- CreateIntCast(call, getInt8PtrTy(), true),
74- ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()),
75+ CreateIntCast(call, getPtrTy(), true),
76+ ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()),
77 "map_lookup_cond");
78 CreateCondBr(condition, lookup_success_block, lookup_failure_block);
79
80@@ -449,7 +449,7 @@ void IRBuilderBPF::CreateMapUpdateElem(Value *ctx,
81 {
82 Value *map_ptr = GetMapVar(map.ident);
83
84- assert(ctx && ctx->getType() == getInt8PtrTy());
85+ assert(ctx && ctx->getType() == getPtrTy());
86 assert(key->getType()->isPointerTy());
87 assert(val->getType()->isPointerTy());
88
89@@ -478,7 +478,7 @@ void IRBuilderBPF::CreateMapDeleteElem(Value *ctx,
90 Value *key,
91 const location &loc)
92 {
93- assert(ctx && ctx->getType() == getInt8PtrTy());
94+ assert(ctx && ctx->getType() == getPtrTy());
95 assert(key->getType()->isPointerTy());
96 Value *map_ptr = GetMapVar(map.ident);
97
98@@ -541,7 +541,7 @@ void IRBuilderBPF::CreateProbeRead(Value *ctx,
99 AddrSpace as,
100 const location &loc)
101 {
102- assert(ctx && ctx->getType() == getInt8PtrTy());
103+ assert(ctx && ctx->getType() == getPtrTy());
104 assert(size && size->getType()->getIntegerBitWidth() <= 32);
105 size = CreateIntCast(size, getInt32Ty(), false);
106
107@@ -581,7 +581,7 @@ CallInst *IRBuilderBPF::CreateProbeReadStr(Value *ctx,
108 AddrSpace as,
109 const location &loc)
110 {
111- assert(ctx && ctx->getType() == getInt8PtrTy());
112+ assert(ctx && ctx->getType() == getPtrTy());
113 assert(size && size->getType()->isIntegerTy());
114 if ([[maybe_unused]] auto *dst_alloca = dyn_cast<AllocaInst>(dst)) {
115 assert(dst_alloca->getAllocatedType()->isArrayTy() &&
116@@ -615,7 +615,7 @@ Value *IRBuilderBPF::CreateUSDTReadArgument(Value *ctx,
117 AddrSpace as,
118 const location &loc)
119 {
120- assert(ctx && ctx->getType() == getInt8PtrTy());
121+ assert(ctx && ctx->getType() == getPtrTy());
122 // Argument size must be 1, 2, 4, or 8. See
123 // https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
124 int abs_size = std::abs(argument->size);
125@@ -711,7 +711,7 @@ Value *IRBuilderBPF::CreateUSDTReadArgument(Value *ctx,
126 AddrSpace as,
127 const location &loc)
128 {
129- assert(ctx && ctx->getType() == getInt8PtrTy());
130+ assert(ctx && ctx->getType() == getPtrTy());
131 struct bcc_usdt_argument argument;
132
133 void *usdt;
134@@ -1337,7 +1337,7 @@ CallInst *IRBuilderBPF::CreateGetStackId(Value *ctx,
135 StackType stack_type,
136 const location &loc)
137 {
138- assert(ctx && ctx->getType() == getInt8PtrTy());
139+ assert(ctx && ctx->getType() == getPtrTy());
140
141 Value *map_ptr = GetMapVar(stack_type.name());
142
143@@ -1350,7 +1350,7 @@ CallInst *IRBuilderBPF::CreateGetStackId(Value *ctx,
144 // Return: >= 0 stackid on success or negative error
145 FunctionType *getstackid_func_type = FunctionType::get(
146 getInt64Ty(),
147- { getInt8PtrTy(), map_ptr->getType(), getInt64Ty() },
148+ { getPtrTy(), map_ptr->getType(), getInt64Ty() },
149 false);
150 CallInst *call = CreateHelperCall(libbpf::BPF_FUNC_get_stackid,
151 getstackid_func_type,
152@@ -1399,7 +1399,7 @@ void IRBuilderBPF::CreateOutput(Value *ctx,
153 size_t size,
154 const location *loc)
155 {
156- assert(ctx && ctx->getType() == getInt8PtrTy());
157+ assert(ctx && ctx->getType() == getPtrTy());
158 assert(data && data->getType()->isPointerTy());
159
160 if (bpftrace_.feature_->has_map_ringbuf()) {
161@@ -1464,8 +1464,8 @@ void IRBuilderBPF::CreateAtomicIncCounter(const std::string &map_name,
162 parent);
163
164 Value *condition = CreateICmpNE(
165- CreateIntCast(call, getInt8PtrTy(), true),
166- ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()),
167+ CreateIntCast(call, getPtrTy(), true),
168+ ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()),
169 "map_lookup_cond");
170 CreateCondBr(condition, lookup_success_block, lookup_failure_block);
171
172@@ -1521,8 +1521,8 @@ void IRBuilderBPF::CreateMapElemAdd(Value *ctx,
173
174 AllocaInst *value = CreateAllocaBPF(type, "lookup_elem_val");
175 Value *condition = CreateICmpNE(
176- CreateIntCast(call, getInt8PtrTy(), true),
177- ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getInt8PtrTy()),
178+ CreateIntCast(call, getPtrTy(), true),
179+ ConstantExpr::getCast(Instruction::IntToPtr, getInt64(0), getPtrTy()),
180 "map_lookup_cond");
181 CreateCondBr(condition, lookup_success_block, lookup_failure_block);
182
183@@ -1557,7 +1557,7 @@ void IRBuilderBPF::CreatePerfEventOutput(Value *ctx,
184 // long bpf_perf_event_output(struct pt_regs *ctx, struct bpf_map *map,
185 // u64 flags, void *data, u64 size)
186 FunctionType *perfoutput_func_type = FunctionType::get(getInt64Ty(),
187- { getInt8PtrTy(),
188+ { getPtrTy(),
189 map_ptr->getType(),
190 getInt64Ty(),
191 data->getType(),
192@@ -1600,7 +1600,7 @@ void IRBuilderBPF::CreateTracePrintk(Value *fmt_ptr,
193
194 // long bpf_trace_printk(const char *fmt, u32 fmt_size, ...)
195 FunctionType *traceprintk_func_type = FunctionType::get(
196- getInt64Ty(), { getInt8PtrTy(), getInt32Ty() }, true);
197+ getInt64Ty(), { getPtrTy(), getInt32Ty() }, true);
198
199 CreateHelperCall(libbpf::BPF_FUNC_trace_printk,
200 traceprintk_func_type,
201@@ -1630,7 +1630,7 @@ void IRBuilderBPF::CreateOverrideReturn(Value *ctx, Value *rc)
202 // long bpf_override_return(struct pt_regs *regs, u64 rc)
203 // Return: 0
204 FunctionType *override_func_type = FunctionType::get(
205- getInt64Ty(), { getInt8PtrTy(), getInt64Ty() }, false);
206+ getInt64Ty(), { getPtrTy(), getInt64Ty() }, false);
207 PointerType *override_func_ptr_type = PointerType::get(override_func_type, 0);
208 Constant *override_func = ConstantExpr::getCast(
209 Instruction::IntToPtr,
210@@ -1807,7 +1807,7 @@ void IRBuilderBPF::CreateHelperError(Value *ctx,
211 libbpf::bpf_func_id func_id,
212 const location &loc)
213 {
214- assert(ctx && ctx->getType() == getInt8PtrTy());
215+ assert(ctx && ctx->getType() == getPtrTy());
216 assert(return_value && return_value->getType() == getInt32Ty());
217
218 if (bpftrace_.helper_check_level_ == 0 ||
219@@ -1847,7 +1847,7 @@ void IRBuilderBPF::CreateHelperErrorCond(Value *ctx,
220 const location &loc,
221 bool compare_zero)
222 {
223- assert(ctx && ctx->getType() == getInt8PtrTy());
224+ assert(ctx && ctx->getType() == getPtrTy());
225 if (bpftrace_.helper_check_level_ == 0 ||
226 (bpftrace_.helper_check_level_ == 1 && return_zero_if_err(func_id)))
227 return;
228@@ -1883,7 +1883,7 @@ void IRBuilderBPF::CreatePath(Value *ctx,
229 // int bpf_d_path(struct path *path, char *buf, u32 sz)
230 // Return: 0 or error
231 FunctionType *d_path_func_type = FunctionType::get(
232- getInt64Ty(), { getInt8PtrTy(), buf->getType(), getInt32Ty() }, false);
233+ getInt64Ty(), { getPtrTy(), buf->getType(), getInt32Ty() }, false);
234 CallInst *call = CreateHelperCall(
235 libbpf::bpf_func_id::BPF_FUNC_d_path,
236 d_path_func_type,
237@@ -1905,9 +1905,9 @@ void IRBuilderBPF::CreateSeqPrintf(Value *ctx,
238 // Return: 0 or error
239 FunctionType *seq_printf_func_type = FunctionType::get(getInt64Ty(),
240 { getInt64Ty(),
241- getInt8PtrTy(),
242+ getPtrTy(),
243 getInt32Ty(),
244- getInt8PtrTy(),
245+ getPtrTy(),
246 getInt32Ty() },
247 false);
248 PointerType *seq_printf_func_ptr_type = PointerType::get(seq_printf_func_type,
249diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
250index 073d48ae..258b0b0b 100644
251--- a/src/ast/passes/codegen_llvm.cpp
252+++ b/src/ast/passes/codegen_llvm.cpp
253@@ -380,10 +380,10 @@ void CodegenLLVM::visit(Call &call)
254
255 AllocaInst *value = b_.CreateAllocaBPF(type, "lookup_elem_val");
256 Value *condition = b_.CreateICmpNE(
257- b_.CreateIntCast(lookup, b_.getInt8PtrTy(), true),
258+ b_.CreateIntCast(lookup, b_.getPtrTy(), true),
259 ConstantExpr::getCast(Instruction::IntToPtr,
260 b_.getInt64(0),
261- b_.getInt8PtrTy()),
262+ b_.getPtrTy()),
263 "map_lookup_cond");
264 b_.CreateCondBr(condition, lookup_success_block, lookup_failure_block);
265
266@@ -437,10 +437,10 @@ void CodegenLLVM::visit(Call &call)
267
268 AllocaInst *value = b_.CreateAllocaBPF(type, "lookup_elem_val");
269 Value *condition = b_.CreateICmpNE(
270- b_.CreateIntCast(lookup, b_.getInt8PtrTy(), true),
271+ b_.CreateIntCast(lookup, b_.getPtrTy(), true),
272 ConstantExpr::getCast(Instruction::IntToPtr,
273 b_.getInt64(0),
274- b_.getInt8PtrTy()),
275+ b_.getPtrTy()),
276 "map_lookup_cond");
277 b_.CreateCondBr(condition, lookup_success_block, lookup_failure_block);
278
279@@ -687,7 +687,7 @@ void CodegenLLVM::visit(Call &call)
280 ? Instruction::BitCast
281 : Instruction::IntToPtr,
282 expr_,
283- b_.getInt8PtrTy()),
284+ b_.getPtrTy()),
285 call.loc);
286 expr_ = buf;
287 expr_deleter_ = [this, buf]() { b_.CreateLifetimeEnd(buf); };
288@@ -919,9 +919,9 @@ void CodegenLLVM::visit(Call &call)
289
290 // and finally the seq_printf call
291 b_.CreateSeqPrintf(ctx_,
292- b_.CreateIntToPtr(fmt, b_.getInt8PtrTy()),
293+ b_.CreateIntToPtr(fmt, b_.getPtrTy()),
294 b_.getInt32(size),
295- b_.CreatePointerCast(data, b_.getInt8PtrTy()),
296+ b_.CreatePointerCast(data, b_.getPtrTy()),
297 b_.getInt32(data_size),
298 call.loc);
299
300@@ -950,7 +950,7 @@ void CodegenLLVM::visit(Call &call)
301 values.push_back(expr_);
302 }
303
304- b_.CreateTracePrintk(b_.CreateIntToPtr(fmt, b_.getInt8PtrTy()),
305+ b_.CreateTracePrintk(b_.CreateIntToPtr(fmt, b_.getPtrTy()),
306 b_.getInt32(size),
307 values,
308 call.loc);
309@@ -1878,7 +1878,7 @@ void CodegenLLVM::visit(FieldAccess &acc)
310 // `is_data_loc` should only be set if field access is on `args` which
311 // has to be a ctx access
312 assert(type.IsCtxAccess());
313- assert(ctx_->getType() == b_.getInt8PtrTy());
314+ assert(ctx_->getType() == b_.getPtrTy());
315 // Parser needs to have rewritten field to be a u64
316 assert(field.type.IsIntTy());
317 assert(field.type.GetIntBitWidth() == 64);
318@@ -2416,7 +2416,7 @@ void CodegenLLVM::createRet(Value *value)
319 void CodegenLLVM::visit(Probe &probe)
320 {
321 FunctionType *func_type = FunctionType::get(b_.getInt64Ty(),
322- { b_.getInt8PtrTy() }, // struct
323+ { b_.getPtrTy() }, // struct
324 // pt_regs
325 // *ctx
326 false);
327@@ -3773,7 +3773,7 @@ Function *CodegenLLVM::createMapLenCallback()
328 auto saved_ip = b_.saveIP();
329
330 std::array<llvm::Type *, 4> args = {
331- b_.getInt8PtrTy(), b_.getInt8PtrTy(), b_.getInt8PtrTy(), b_.getInt8PtrTy()
332+ b_.getPtrTy(), b_.getPtrTy(), b_.getPtrTy(), b_.getPtrTy()
333 };
334
335 FunctionType *callback_type = FunctionType::get(b_.getInt64Ty(), args, false);
336--
3372.43.2
338
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch
deleted file mode 100644
index 35f442f..0000000
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0003-ast-Adjust-to-enum-changes-in-llvm-18.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 71618b5eae717c491e11b770dff14ba79306f0c8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 16 Feb 2024 10:40:21 -0800
4Subject: [PATCH 3/4] ast: Adjust to enum changes in llvm 18
5
6llvm 18 has change CodeGenOpt::Level/CodeGenFileType into enum classes via
7https://github.com/llvm/llvm-project/commit/0a1aa6cda2758b0926a95f87d39ffefb1cb90200
8
9Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/ast/passes/codegen_llvm.cpp | 6 ++++--
13 1 file changed, 4 insertions(+), 2 deletions(-)
14
15diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
16index 258b0b0b..ceab4bc4 100644
17--- a/src/ast/passes/codegen_llvm.cpp
18+++ b/src/ast/passes/codegen_llvm.cpp
19@@ -73,7 +73,7 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
20 Optional<Reloc::Model>()
21 #endif
22 ));
23- target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
24+ target_machine_->setOptLevel(llvm::CodeGenOptLevel::Aggressive);
25
26 module_->setTargetTriple(LLVMTargetTriple);
27 module_->setDataLayout(target_machine_->createDataLayout());
28@@ -3530,7 +3530,9 @@ void CodegenLLVM::emit(raw_pwrite_stream &stream)
29 {
30 legacy::PassManager PM;
31
32-#if LLVM_VERSION_MAJOR >= 10
33+#if LLVM_VERSION_MAJOR >= 18
34+ auto type = CodeGenFileType::ObjectFile;
35+#elif LLVM_VERSION_MAJOR >= 10
36 auto type = llvm::CGFT_ObjectFile;
37 #else
38 auto type = llvm::TargetMachine::CGFT_ObjectFile;
39--
402.43.2
41
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch
deleted file mode 100644
index 8a5dbf2..0000000
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0004-cmake-Bump-max-LLVM-version-to-18.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 16186113346c268a0bb45424ba1c41768b7e94cf Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 16 Feb 2024 10:14:41 -0800
4Subject: [PATCH 4/4] cmake: Bump max LLVM version to 18+
5
6Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3009]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 CMakeLists.txt | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/CMakeLists.txt b/CMakeLists.txt
13index 7983ee17..7d0433de 100644
14--- a/CMakeLists.txt
15+++ b/CMakeLists.txt
16@@ -139,7 +139,7 @@ else()
17 endif()
18
19 set(MIN_LLVM_MAJOR 6)
20-set(MAX_LLVM_MAJOR 17)
21+set(MAX_LLVM_MAJOR 18)
22
23 if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
24 message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")
25--
262.43.2
27
diff --git a/dynamic-layers/qt5-layer/recipes-qt/qt5/qtpdf_%.bbappend b/dynamic-layers/qt5-layer/recipes-qt/qt5/qtpdf_%.bbappend
index b4f7374..aaff78e 100644
--- a/dynamic-layers/qt5-layer/recipes-qt/qt5/qtpdf_%.bbappend
+++ b/dynamic-layers/qt5-layer/recipes-qt/qt5/qtpdf_%.bbappend
@@ -1,3 +1,4 @@
1# its needed to build gn-native which is embedded into 1# its needed to build gn-native which is embedded into
2# qtpdf directly 2# qtpdf directly
3inherit clang-native 3
4TOOLCHAIN_NATIVE = "clang"
diff --git a/dynamic-layers/qt6-layer/recipes-qt/qt6/qtwebengine_%.bbappend b/dynamic-layers/qt6-layer/recipes-qt/qt6/qtwebengine_%.bbappend
new file mode 100644
index 0000000..8071b17
--- /dev/null
+++ b/dynamic-layers/qt6-layer/recipes-qt/qt6/qtwebengine_%.bbappend
@@ -0,0 +1 @@
TOOLCHAIN_NATIVE ?= "clang"
diff --git a/recipes-connectivity/openssl/openssl_%.bbappend b/recipes-connectivity/openssl/openssl_%.bbappend
index 6679165..c0a5991 100644
--- a/recipes-connectivity/openssl/openssl_%.bbappend
+++ b/recipes-connectivity/openssl/openssl_%.bbappend
@@ -1,11 +1,3 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" 1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2 2
3LDLIBS:append:toolchain-clang:riscv64 = " -latomic" 3LDFLAGS:append:toolchain-clang:riscv32 = " -Wl,--no-relax"
4LDLIBS:append:toolchain-clang:riscv32 = " -latomic"
5
6do_configure:prepend:toolchain-clang:riscv64 () {
7 export LDLIBS="${LDLIBS}"
8}
9do_configure:prepend:toolchain-clang:riscv32 () {
10 export LDLIBS="${LDLIBS}"
11}
diff --git a/recipes-core/busybox/busybox/clang.cfg b/recipes-core/busybox/busybox/clang.cfg
deleted file mode 100644
index 450fa7e..0000000
--- a/recipes-core/busybox/busybox/clang.cfg
+++ /dev/null
@@ -1 +0,0 @@
1CONFIG_EXTRA_CFLAGS="-DBB_GLOBAL_CONST=''"
diff --git a/recipes-core/busybox/busybox_1.36%.bbappend b/recipes-core/busybox/busybox_1.36%.bbappend
deleted file mode 100644
index 6eadf24..0000000
--- a/recipes-core/busybox/busybox_1.36%.bbappend
+++ /dev/null
@@ -1,3 +0,0 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2
3SRC_URI:append:toolchain-clang = " file://clang.cfg"
diff --git a/recipes-core/musl/musl_%.bbappend b/recipes-core/musl/musl_%.bbappend
index 5140968..0315be3 100644
--- a/recipes-core/musl/musl_%.bbappend
+++ b/recipes-core/musl/musl_%.bbappend
@@ -1,5 +1,5 @@
1DEPENDS:append:toolchain-clang = " clang-cross-${TARGET_ARCH}" 1DEPENDS:append:toolchain-clang = " clang-cross-${TARGET_ARCH}"
2DEPENDS:remove:toolchain-clang = "virtual/${TARGET_PREFIX}gcc" 2DEPENDS:remove:toolchain-clang = "virtual/cross-cc"
3TOOLCHAIN:x86-x32 = "gcc" 3TOOLCHAIN:x86-x32 = "gcc"
4 4
5# crashes seen in malloc@plt 5# crashes seen in malloc@plt
diff --git a/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc b/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc
deleted file mode 100644
index 5bf5faf..0000000
--- a/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc
+++ /dev/null
@@ -1,198 +0,0 @@
1# Autogenerated with 'bitbake -c update_crates bindgen-cli'
2
3# from Cargo.lock
4SRC_URI += " \
5 crate://crates.io/aho-corasick/0.5.3 \
6 crate://crates.io/aho-corasick/0.7.20 \
7 crate://crates.io/ansi_term/0.12.1 \
8 crate://crates.io/atty/0.2.14 \
9 crate://crates.io/bitflags/1.3.2 \
10 crate://crates.io/block/0.1.6 \
11 crate://crates.io/cc/1.0.78 \
12 crate://crates.io/cexpr/0.6.0 \
13 crate://crates.io/cfg-if/1.0.0 \
14 crate://crates.io/clang-sys/1.4.0 \
15 crate://crates.io/clap/2.34.0 \
16 crate://crates.io/clap/4.1.4 \
17 crate://crates.io/clap_derive/4.1.0 \
18 crate://crates.io/clap_lex/0.3.1 \
19 crate://crates.io/diff/0.1.13 \
20 crate://crates.io/either/1.8.1 \
21 crate://crates.io/env_logger/0.3.5 \
22 crate://crates.io/env_logger/0.9.3 \
23 crate://crates.io/errno/0.2.8 \
24 crate://crates.io/errno-dragonfly/0.1.2 \
25 crate://crates.io/fastrand/1.8.0 \
26 crate://crates.io/fuchsia-cprng/0.1.1 \
27 crate://crates.io/glob/0.3.1 \
28 crate://crates.io/heck/0.4.0 \
29 crate://crates.io/hermit-abi/0.1.19 \
30 crate://crates.io/hermit-abi/0.2.6 \
31 crate://crates.io/humantime/2.1.0 \
32 crate://crates.io/instant/0.1.12 \
33 crate://crates.io/io-lifetimes/1.0.4 \
34 crate://crates.io/is-terminal/0.4.2 \
35 crate://crates.io/kernel32-sys/0.2.2 \
36 crate://crates.io/lazy_static/1.4.0 \
37 crate://crates.io/lazycell/1.3.0 \
38 crate://crates.io/libc/0.2.139 \
39 crate://crates.io/libloading/0.6.7 \
40 crate://crates.io/libloading/0.7.4 \
41 crate://crates.io/linux-raw-sys/0.1.4 \
42 crate://crates.io/log/0.3.9 \
43 crate://crates.io/log/0.4.17 \
44 crate://crates.io/malloc_buf/0.0.6 \
45 crate://crates.io/memchr/0.1.11 \
46 crate://crates.io/memchr/2.5.0 \
47 crate://crates.io/minimal-lexical/0.2.1 \
48 crate://crates.io/nom/7.1.3 \
49 crate://crates.io/objc/0.2.7 \
50 crate://crates.io/once_cell/1.17.0 \
51 crate://crates.io/os_str_bytes/6.4.1 \
52 crate://crates.io/peeking_take_while/0.1.2 \
53 crate://crates.io/proc-macro-error/1.0.4 \
54 crate://crates.io/proc-macro-error-attr/1.0.4 \
55 crate://crates.io/proc-macro2/1.0.50 \
56 crate://crates.io/quickcheck/0.4.1 \
57 crate://crates.io/quote/1.0.23 \
58 crate://crates.io/rand/0.3.23 \
59 crate://crates.io/rand/0.4.6 \
60 crate://crates.io/rand_core/0.3.1 \
61 crate://crates.io/rand_core/0.4.2 \
62 crate://crates.io/rdrand/0.4.0 \
63 crate://crates.io/redox_syscall/0.2.16 \
64 crate://crates.io/regex/0.1.80 \
65 crate://crates.io/regex/1.7.1 \
66 crate://crates.io/regex-syntax/0.3.9 \
67 crate://crates.io/regex-syntax/0.6.28 \
68 crate://crates.io/remove_dir_all/0.5.3 \
69 crate://crates.io/rustc-hash/1.1.0 \
70 crate://crates.io/rustix/0.36.7 \
71 crate://crates.io/shlex/1.1.0 \
72 crate://crates.io/strsim/0.8.0 \
73 crate://crates.io/strsim/0.10.0 \
74 crate://crates.io/syn/1.0.107 \
75 crate://crates.io/tempdir/0.3.7 \
76 crate://crates.io/tempfile/3.3.0 \
77 crate://crates.io/termcolor/1.2.0 \
78 crate://crates.io/textwrap/0.11.0 \
79 crate://crates.io/thread-id/2.0.0 \
80 crate://crates.io/thread_local/0.2.7 \
81 crate://crates.io/unicode-ident/1.0.6 \
82 crate://crates.io/unicode-width/0.1.10 \
83 crate://crates.io/utf8-ranges/0.1.3 \
84 crate://crates.io/vec_map/0.8.2 \
85 crate://crates.io/version_check/0.9.4 \
86 crate://crates.io/which/4.4.0 \
87 crate://crates.io/winapi/0.2.8 \
88 crate://crates.io/winapi/0.3.9 \
89 crate://crates.io/winapi-build/0.1.1 \
90 crate://crates.io/winapi-i686-pc-windows-gnu/0.4.0 \
91 crate://crates.io/winapi-util/0.1.5 \
92 crate://crates.io/winapi-x86_64-pc-windows-gnu/0.4.0 \
93 crate://crates.io/windows-sys/0.42.0 \
94 crate://crates.io/windows_aarch64_gnullvm/0.42.1 \
95 crate://crates.io/windows_aarch64_msvc/0.42.1 \
96 crate://crates.io/windows_i686_gnu/0.42.1 \
97 crate://crates.io/windows_i686_msvc/0.42.1 \
98 crate://crates.io/windows_x86_64_gnu/0.42.1 \
99 crate://crates.io/windows_x86_64_gnullvm/0.42.1 \
100 crate://crates.io/windows_x86_64_msvc/0.42.1 \
101"
102
103SRC_URI[aho-corasick-0.5.3.sha256sum] = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
104SRC_URI[aho-corasick-0.7.20.sha256sum] = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
105SRC_URI[ansi_term-0.12.1.sha256sum] = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
106SRC_URI[atty-0.2.14.sha256sum] = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
107SRC_URI[bitflags-1.3.2.sha256sum] = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
108SRC_URI[block-0.1.6.sha256sum] = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
109SRC_URI[cc-1.0.78.sha256sum] = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
110SRC_URI[cexpr-0.6.0.sha256sum] = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
111SRC_URI[cfg-if-1.0.0.sha256sum] = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
112SRC_URI[clang-sys-1.4.0.sha256sum] = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3"
113SRC_URI[clap-2.34.0.sha256sum] = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
114SRC_URI[clap-4.1.4.sha256sum] = "f13b9c79b5d1dd500d20ef541215a6423c75829ef43117e1b4d17fd8af0b5d76"
115SRC_URI[clap_derive-4.1.0.sha256sum] = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8"
116SRC_URI[clap_lex-0.3.1.sha256sum] = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade"
117SRC_URI[diff-0.1.13.sha256sum] = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
118SRC_URI[either-1.8.1.sha256sum] = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
119SRC_URI[env_logger-0.3.5.sha256sum] = "15abd780e45b3ea4f76b4e9a26ff4843258dd8a3eed2775a0e7368c2e7936c2f"
120SRC_URI[env_logger-0.9.3.sha256sum] = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7"
121SRC_URI[errno-0.2.8.sha256sum] = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
122SRC_URI[errno-dragonfly-0.1.2.sha256sum] = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
123SRC_URI[fastrand-1.8.0.sha256sum] = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
124SRC_URI[fuchsia-cprng-0.1.1.sha256sum] = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
125SRC_URI[glob-0.3.1.sha256sum] = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
126SRC_URI[heck-0.4.0.sha256sum] = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
127SRC_URI[hermit-abi-0.1.19.sha256sum] = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
128SRC_URI[hermit-abi-0.2.6.sha256sum] = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
129SRC_URI[humantime-2.1.0.sha256sum] = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
130SRC_URI[instant-0.1.12.sha256sum] = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
131SRC_URI[io-lifetimes-1.0.4.sha256sum] = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
132SRC_URI[is-terminal-0.4.2.sha256sum] = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
133SRC_URI[kernel32-sys-0.2.2.sha256sum] = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
134SRC_URI[lazy_static-1.4.0.sha256sum] = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
135SRC_URI[lazycell-1.3.0.sha256sum] = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
136SRC_URI[libc-0.2.139.sha256sum] = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
137SRC_URI[libloading-0.6.7.sha256sum] = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883"
138SRC_URI[libloading-0.7.4.sha256sum] = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
139SRC_URI[linux-raw-sys-0.1.4.sha256sum] = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
140SRC_URI[log-0.3.9.sha256sum] = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
141SRC_URI[log-0.4.17.sha256sum] = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
142SRC_URI[malloc_buf-0.0.6.sha256sum] = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
143SRC_URI[memchr-0.1.11.sha256sum] = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
144SRC_URI[memchr-2.5.0.sha256sum] = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
145SRC_URI[minimal-lexical-0.2.1.sha256sum] = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
146SRC_URI[nom-7.1.3.sha256sum] = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
147SRC_URI[objc-0.2.7.sha256sum] = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
148SRC_URI[once_cell-1.17.0.sha256sum] = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
149SRC_URI[os_str_bytes-6.4.1.sha256sum] = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
150SRC_URI[peeking_take_while-0.1.2.sha256sum] = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
151SRC_URI[proc-macro-error-1.0.4.sha256sum] = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
152SRC_URI[proc-macro-error-attr-1.0.4.sha256sum] = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
153SRC_URI[proc-macro2-1.0.50.sha256sum] = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
154SRC_URI[quickcheck-0.4.1.sha256sum] = "02c2411d418cea2364325b18a205664f9ef8252e06b2e911db97c0b0d98b1406"
155SRC_URI[quote-1.0.23.sha256sum] = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
156SRC_URI[rand-0.3.23.sha256sum] = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
157SRC_URI[rand-0.4.6.sha256sum] = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
158SRC_URI[rand_core-0.3.1.sha256sum] = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
159SRC_URI[rand_core-0.4.2.sha256sum] = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
160SRC_URI[rdrand-0.4.0.sha256sum] = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
161SRC_URI[redox_syscall-0.2.16.sha256sum] = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
162SRC_URI[regex-0.1.80.sha256sum] = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f"
163SRC_URI[regex-1.7.1.sha256sum] = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
164SRC_URI[regex-syntax-0.3.9.sha256sum] = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957"
165SRC_URI[regex-syntax-0.6.28.sha256sum] = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
166SRC_URI[remove_dir_all-0.5.3.sha256sum] = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
167SRC_URI[rustc-hash-1.1.0.sha256sum] = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
168SRC_URI[rustix-0.36.7.sha256sum] = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
169SRC_URI[shlex-1.1.0.sha256sum] = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
170SRC_URI[strsim-0.8.0.sha256sum] = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
171SRC_URI[strsim-0.10.0.sha256sum] = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
172SRC_URI[syn-1.0.107.sha256sum] = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
173SRC_URI[tempdir-0.3.7.sha256sum] = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
174SRC_URI[tempfile-3.3.0.sha256sum] = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
175SRC_URI[termcolor-1.2.0.sha256sum] = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
176SRC_URI[textwrap-0.11.0.sha256sum] = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
177SRC_URI[thread-id-2.0.0.sha256sum] = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
178SRC_URI[thread_local-0.2.7.sha256sum] = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
179SRC_URI[unicode-ident-1.0.6.sha256sum] = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
180SRC_URI[unicode-width-0.1.10.sha256sum] = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
181SRC_URI[utf8-ranges-0.1.3.sha256sum] = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
182SRC_URI[vec_map-0.8.2.sha256sum] = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
183SRC_URI[version_check-0.9.4.sha256sum] = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
184SRC_URI[which-4.4.0.sha256sum] = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
185SRC_URI[winapi-0.2.8.sha256sum] = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
186SRC_URI[winapi-0.3.9.sha256sum] = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
187SRC_URI[winapi-build-0.1.1.sha256sum] = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
188SRC_URI[winapi-i686-pc-windows-gnu-0.4.0.sha256sum] = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
189SRC_URI[winapi-util-0.1.5.sha256sum] = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
190SRC_URI[winapi-x86_64-pc-windows-gnu-0.4.0.sha256sum] = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
191SRC_URI[windows-sys-0.42.0.sha256sum] = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
192SRC_URI[windows_aarch64_gnullvm-0.42.1.sha256sum] = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
193SRC_URI[windows_aarch64_msvc-0.42.1.sha256sum] = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
194SRC_URI[windows_i686_gnu-0.42.1.sha256sum] = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
195SRC_URI[windows_i686_msvc-0.42.1.sha256sum] = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
196SRC_URI[windows_x86_64_gnu-0.42.1.sha256sum] = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
197SRC_URI[windows_x86_64_gnullvm-0.42.1.sha256sum] = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
198SRC_URI[windows_x86_64_msvc-0.42.1.sha256sum] = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
diff --git a/recipes-devtools/bindgen-cli/bindgen-cli_0.64.0.bb b/recipes-devtools/bindgen-cli/bindgen-cli_0.64.0.bb
deleted file mode 100644
index 7c0b739..0000000
--- a/recipes-devtools/bindgen-cli/bindgen-cli_0.64.0.bb
+++ /dev/null
@@ -1,22 +0,0 @@
1SUMMARY = "Automatically generates Rust FFI bindings to C and C++ libraries."
2HOMEPAGE = "https://rust-lang.github.io/rust-bindgen/"
3LICENSE = "BSD-3-Clause"
4
5LIC_FILES_CHKSUM = "file://LICENSE;md5=0b9a98cb3dcdefcceb145324693fda9b"
6
7inherit rust cargo cargo-update-recipe-crates
8
9SRCREV = "ae6817256ac557981906e93a1f866349db85053e"
10SRC_URI = "git://github.com/rust-lang/rust-bindgen;protocol=https;branch=main"
11
12S = "${WORKDIR}/git"
13
14require ${BPN}-crates.inc
15
16do_install:append:class-native() {
17 create_wrapper ${D}/${bindir}/bindgen LIBCLANG_PATH="${STAGING_LIBDIR_NATIVE}"
18}
19
20RDEPENDS:${PN} = "libclang"
21
22BBCLASSEXTEND = "native"
diff --git a/recipes-devtools/castxml/castxml_0.6.4.20240205.bb b/recipes-devtools/castxml/castxml_0.6.11.bb
index 3ff360c..69663e0 100644
--- a/recipes-devtools/castxml/castxml_0.6.4.20240205.bb
+++ b/recipes-devtools/castxml/castxml_0.6.11.bb
@@ -4,11 +4,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
4 4
5SRC_URI = "git://github.com/CastXML/CastXML;protocol=https;branch=master" 5SRC_URI = "git://github.com/CastXML/CastXML;protocol=https;branch=master"
6 6
7SRCREV = "1a460924d456d9983082d615e0df5f797fdeb635" 7SRCREV = "f38c024b395187814f14f77974d8f5240bb2e71f"
8
9S = "${WORKDIR}/git"
10 8
11DEPENDS = "clang" 9DEPENDS = "clang"
12inherit cmake cmake-native pkgconfig python3native 10inherit cmake pkgconfig python3native
13 11
14BBCLASSEXTEND = "native nativesdk" 12BBCLASSEXTEND = "native nativesdk"
diff --git a/recipes-devtools/clang/clang-cross-canadian_git.bb b/recipes-devtools/clang/clang-cross-canadian_git.bb
deleted file mode 100644
index 33c33c4..0000000
--- a/recipes-devtools/clang/clang-cross-canadian_git.bb
+++ /dev/null
@@ -1,36 +0,0 @@
1# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "Clang/LLVM based C/C++ compiler (cross-canadian for ${TARGET_ARCH} target)"
5HOMEPAGE = "http://clang.llvm.org/"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
7SECTION = "devel"
8
9PN = "clang-cross-canadian-${TRANSLATED_TARGET_ARCH}"
10
11require clang.inc
12require common-source.inc
13inherit cross-canadian
14
15DEPENDS += "nativesdk-clang binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc"
16# We have to point gcc at a sysroot but we don't need to rebuild if this changes
17# e.g. we switch between different machines with different tunes.
18EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH"
19TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
20
21do_install() {
22 install -d ${D}${bindir}
23 for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata \
24 llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \
25 llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov
26 do
27 ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool
28 done
29}
30SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-llvm-ar \
31 *-llvm-ranlib *-llvm-nm *-lld *-ld.lld *-llvm-as *-llvm-strip \
32 *-llvm-objcopy *-llvm-objdump *-llvm-readelf *-llvm-addr2line \
33 *-llvm-dwp *-llvm-size *-llvm-strings *-llvm-cov"
34do_install:append() {
35 cross_canadian_bindirlinks
36}
diff --git a/recipes-devtools/clang/clang-cross_git.bb b/recipes-devtools/clang/clang-cross_git.bb
deleted file mode 100644
index 8aee5cd..0000000
--- a/recipes-devtools/clang/clang-cross_git.bb
+++ /dev/null
@@ -1,35 +0,0 @@
1# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "Cross compiler wrappers for LLVM based C/C++ compiler"
5HOMEPAGE = "http://clang.llvm.org/"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
7SECTION = "devel"
8
9PN = "clang-cross-${TARGET_ARCH}"
10
11require clang.inc
12require common-source.inc
13inherit cross
14DEPENDS += "clang-native virtual/${TARGET_PREFIX}binutils"
15
16do_install() {
17 install -d ${D}${bindir}
18 for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata \
19 llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \
20 llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov
21 do
22 ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool
23 done
24}
25SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-lld *-ld.lld \
26 *-llvm-nm *-llvm-ar *-llvm-as *-llvm-ranlib *-llvm-strip \
27 *-llvm-objcopy *-llvm-objdump *-llvm-readelf *-llvm-addr2line \
28 *-llvm-dwp *-llvm-size *-llvm-strings *-llvm-cov"
29
30SYSROOT_PREPROCESS_FUNCS += "clangcross_sysroot_preprocess"
31
32clangcross_sysroot_preprocess () {
33 sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
34}
35PACKAGES = ""
diff --git a/recipes-devtools/clang/clang-crosssdk_git.bb b/recipes-devtools/clang/clang-crosssdk_git.bb
deleted file mode 100644
index fb8bee5..0000000
--- a/recipes-devtools/clang/clang-crosssdk_git.bb
+++ /dev/null
@@ -1,34 +0,0 @@
1# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "SDK Cross compiler wrappers for LLVM based C/C++ compiler"
5HOMEPAGE = "http://clang.llvm.org/"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
7SECTION = "devel"
8
9PN = "clang-crosssdk-${TARGET_ARCH}"
10
11require clang.inc
12require common-source.inc
13inherit crosssdk
14DEPENDS += "clang-native nativesdk-clang-glue virtual/${TARGET_PREFIX}binutils virtual/nativesdk-libc"
15
16do_install() {
17 install -d ${D}${bindir}
18 for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata \
19 llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \
20 llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov
21 do
22 ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool
23 done
24}
25SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-lld *-ld.lld \
26 *-llvm-nm *-llvm-ar *-llvm-as *-llvm-ranlib *-llvm-strip \
27 *-llvm-objcopy *-llvm-objdump *-llvm-readelf *-llvm-addr2line \
28 *-llvm-dwp *-llvm-size *-llvm-strings *-llvm-cov"
29sysroot_stage_all () {
30 sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
31}
32
33PACKAGES = ""
34
diff --git a/recipes-devtools/clang/clang.inc b/recipes-devtools/clang/clang.inc
deleted file mode 100644
index 8bfc4d1..0000000
--- a/recipes-devtools/clang/clang.inc
+++ /dev/null
@@ -1,27 +0,0 @@
1LLVM_RELEASE = ""
2LLVM_DIR = "llvm${LLVM_RELEASE}"
3
4LLVM_GIT ?= "git://github.com/llvm"
5LLVM_GIT_PROTOCOL ?= "https"
6
7MAJOR_VER = "18"
8MINOR_VER = "1"
9PATCH_VER = "4"
10# could be 'rcX' or 'git' or empty ( for release )
11VER_SUFFIX = ""
12SRCREV ?= "e6c3289804a67ea0bb6a86fadbe454dd93b8d855"
13
14PV = "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}${VER_SUFFIX}"
15BRANCH = "release/18.x"
16
17LLVMMD5SUM = "8a15a0759ef07f2682d2ba4b893c9afe"
18CLANGMD5SUM = "ff42885ed2ab98f1ecb8c1fc41205343"
19LLDMD5SUM = "ae7dc7c027b1fa89b5b013d391d3ee2b"
20LLDBMD5SUM = "2e0d44968471fcde980034dbb826bea9"
21
22LLVM_LIBDIR_SUFFIX="${@d.getVar('baselib').replace('lib', '')}"
23
24# set the default pigz thread
25export PIGZ = "-p ${@oe.utils.cpu_count(at_least=2)}"
26
27require common.inc
diff --git a/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch b/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
deleted file mode 100644
index d4afeed..0000000
--- a/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
+++ /dev/null
@@ -1,58 +0,0 @@
1From ec5bd3bfc9f682c90ceba06f2d76aa5234a9c846 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 Aug 2017 10:37:49 -0700
4Subject: [PATCH] libcxxabi: Find libunwind headers when
5 LIBCXXABI_LIBUNWIND_INCLUDES is set
6
7Currently, when LIBCXXABI_LIBUNWIND_INCLUDES is set via CMake arguments
8then it ends up not searching the specified dir and unwind.h is not found
9especially for ARM targets
10
11This patch makes the searching synthesized directories and then set
12LIBCXXABI_LIBUNWIND_INCLUDES if its there in environment
13
14Upstream-Status: Pending
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 libcxxabi/CMakeLists.txt | 16 +++++++++++-----
18 1 file changed, 11 insertions(+), 5 deletions(-)
19
20diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
21index da998d2221dc..936b78e4d6dd 100644
22--- a/libcxxabi/CMakeLists.txt
23+++ b/libcxxabi/CMakeLists.txt
24@@ -422,7 +422,7 @@ set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
25 "Specify path to libunwind source." FORCE)
26
27 if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
28- find_path(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL libunwind.h
29+ find_path(LIBCXXABI_LIBUNWIND_INCLUDES libunwind.h
30 PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
31 ${LIBCXXABI_LIBUNWIND_PATH}/include
32 ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
33@@ -433,15 +433,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
34 NO_CMAKE_FIND_ROOT_PATH
35 )
36
37- if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")
38- set(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL "")
39+ if (LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES-NOTFOUND")
40+ set(LIBCXXABI_LIBUNWIND_INCLUDES "")
41 endif()
42 endif()
43
44-if (NOT "${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}" STREQUAL "")
45- include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}")
46+if (NOT "${LIBCXXABI_LIBUNWIND_INCLUDES}" STREQUAL "")
47+ include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES}")
48 endif()
49
50+set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
51+ "Specify path to libunwind includes." FORCE)
52+set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
53+ "Specify path to libunwind source." FORCE)
54+
55+
56 # Add source code. This also contains all of the logic for deciding linker flags
57 # soname, etc...
58 add_subdirectory(include)
diff --git a/recipes-devtools/clang/clang/0002-compiler-rt-support-a-new-embedded-linux-target.patch b/recipes-devtools/clang/clang/0002-compiler-rt-support-a-new-embedded-linux-target.patch
deleted file mode 100644
index 6c5c0de..0000000
--- a/recipes-devtools/clang/clang/0002-compiler-rt-support-a-new-embedded-linux-target.patch
+++ /dev/null
@@ -1,309 +0,0 @@
1From ac1643e6e68697e6ee374535dd98413c92224076 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 19 Apr 2015 15:16:23 -0700
4Subject: [PATCH] compiler-rt: support a new embedded linux target
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 .../make/platform/clang_linux_embedded.mk | 286 ++++++++++++++++++
10 .../clang_linux_embedded_test_input.c | 0
11 2 files changed, 286 insertions(+)
12 create mode 100644 compiler-rt/make/platform/clang_linux_embedded.mk
13 create mode 100644 compiler-rt/make/platform/clang_linux_embedded_test_input.c
14
15diff --git a/compiler-rt/make/platform/clang_linux_embedded.mk b/compiler-rt/make/platform/clang_linux_embedded.mk
16new file mode 100644
17index 000000000000..d0a890075a1c
18--- /dev/null
19+++ b/compiler-rt/make/platform/clang_linux_embedded.mk
20@@ -0,0 +1,286 @@
21+# These are the functions which clang needs when it is targeting a previous
22+# version of the OS. The issue is that the backend may use functions which were
23+# not present in the libgcc that shipped on the platform. In such cases, we link
24+# with a version of the library which contains private_extern definitions of all
25+# the extra functions which might be referenced.
26+
27+Description := Static runtime libraries for embedded clang/Linux
28+
29+# A function that ensures we don't try to build for architectures that we
30+# don't have working toolchains for.
31+CheckArches = \
32+ $(shell \
33+ result=""; \
34+ for arch in $(1); do \
35+ if $(CC) -arch $$arch -c \
36+ -integrated-as \
37+ $(ProjSrcRoot)/make/platform/clang_linux_embedded_test_input.c \
38+ -o /dev/null > /dev/null 2> /dev/null; then \
39+ result="$$result$$arch "; \
40+ else \
41+ printf 1>&2 \
42+ "warning: clang_linux_embedded.mk: dropping arch '$$arch' from lib '$(2)'\n"; \
43+ fi; \
44+ done; \
45+ echo $$result)
46+
47+XCRun = \
48+ $(shell \
49+ result=`xcrun -find $(1) 2> /dev/null`; \
50+ if [ "$$?" != "0" ]; then result=$(1); fi; \
51+ echo $$result)
52+
53+###
54+
55+CC := $(call XCRun,clang)
56+AR := $(call XCRun,ar)
57+RANLIB := $(call XCRun,ranlib)
58+STRIP := $(call XCRun,strip)
59+LIPO := $(call XCRun,lipo)
60+DSYMUTIL := $(call XCRun,dsymutil)
61+Configs :=
62+UniversalArchs :=
63+
64+# Soft-float version of the runtime. No floating-point instructions will be used
65+# and the ABI (out of necessity) passes floating values in normal registers:
66+# non-VFP variant of the AAPCS.
67+UniversalArchs.soft_static := $(call CheckArches,arm armv7m armv7em armv7,soft_static)
68+Configs += $(if $(UniversalArchs.soft_static),soft_static)
69+
70+# Hard-float version of the runtime. On ARM VFP instructions and registers are
71+# allowed, and floating point values get passed in them. VFP variant of the
72+# AAPCS.
73+UniversalArchs.hard_static := $(call CheckArches,armv7em armv7 i386 x86_64,hard_static)
74+Configs += $(if $(UniversalArchs.hard_static),hard_static)
75+
76+UniversalArchs.soft_pic := $(call CheckArches,armv6m armv7m armv7em armv7,soft_pic)
77+Configs += $(if $(UniversalArchs.soft_pic),soft_pic)
78+
79+UniversalArchs.hard_pic := $(call CheckArches,armv7em armv7 i386 x86_64,hard_pic)
80+Configs += $(if $(UniversalArchs.hard_pic),hard_pic)
81+
82+CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding
83+
84+PIC_CFLAGS := -fPIC
85+STATIC_CFLAGS := -static
86+
87+CFLAGS_SOFT := -mfloat-abi=soft
88+CFLAGS_HARD := -mfloat-abi=hard
89+
90+CFLAGS_I386 := -march=pentium
91+
92+CFLAGS.soft_static := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_SOFT)
93+CFLAGS.hard_static := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_HARD)
94+CFLAGS.soft_pic := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_SOFT)
95+CFLAGS.hard_pic := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_HARD)
96+
97+CFLAGS.soft_static.armv7 := $(CFLAGS.soft_static) $(CFLAGS_ARMV7)
98+CFLAGS.hard_static.armv7 := $(CFLAGS.hard_static) $(CFLAGS_ARMV7)
99+CFLAGS.soft_pic.armv7 := $(CFLAGS.soft_pic) $(CFLAGS_ARMV7)
100+CFLAGS.hard_pic.armv7 := $(CFLAGS.hard_pic) $(CFLAGS_ARMV7)
101+
102+# x86 platforms ignore -mfloat-abi options and complain about doing so. Despite
103+# this they're hard-float.
104+CFLAGS.hard_static.i386 := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_I386)
105+CFLAGS.hard_pic.i386 := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_I386)
106+CFLAGS.hard_static.x86_64 := $(CFLAGS) $(STATIC_CFLAGS)
107+CFLAGS.hard_pic.x86_64 := $(CFLAGS) $(PIC_CFLAGS)
108+
109+# Functions not wanted:
110+# + eprintf is obsolete anyway
111+# + *vfp: designed for Thumb1 CPUs with VFPv2
112+
113+COMMON_FUNCTIONS := \
114+ absvdi2 \
115+ absvsi2 \
116+ addvdi3 \
117+ addvsi3 \
118+ ashldi3 \
119+ ashrdi3 \
120+ bswapdi2 \
121+ bswapsi2 \
122+ clzdi2 \
123+ clzsi2 \
124+ cmpdi2 \
125+ ctzdi2 \
126+ ctzsi2 \
127+ divdc3 \
128+ divdi3 \
129+ divsc3 \
130+ divmodsi4 \
131+ udivmodsi4 \
132+ do_global_dtors \
133+ ffsdi2 \
134+ fixdfdi \
135+ fixsfdi \
136+ fixunsdfdi \
137+ fixunsdfsi \
138+ fixunssfdi \
139+ fixunssfsi \
140+ floatdidf \
141+ floatdisf \
142+ floatundidf \
143+ floatundisf \
144+ gcc_bcmp \
145+ lshrdi3 \
146+ moddi3 \
147+ muldc3 \
148+ muldi3 \
149+ mulsc3 \
150+ mulvdi3 \
151+ mulvsi3 \
152+ negdi2 \
153+ negvdi2 \
154+ negvsi2 \
155+ paritydi2 \
156+ paritysi2 \
157+ popcountdi2 \
158+ popcountsi2 \
159+ powidf2 \
160+ powisf2 \
161+ subvdi3 \
162+ subvsi3 \
163+ ucmpdi2 \
164+ udiv_w_sdiv \
165+ udivdi3 \
166+ udivmoddi4 \
167+ umoddi3 \
168+ adddf3 \
169+ addsf3 \
170+ cmpdf2 \
171+ cmpsf2 \
172+ div0 \
173+ divdf3 \
174+ divsf3 \
175+ divsi3 \
176+ extendsfdf2 \
177+ ffssi2 \
178+ fixdfsi \
179+ fixsfsi \
180+ floatsidf \
181+ floatsisf \
182+ floatunsidf \
183+ floatunsisf \
184+ comparedf2 \
185+ comparesf2 \
186+ modsi3 \
187+ muldf3 \
188+ mulsf3 \
189+ negdf2 \
190+ negsf2 \
191+ subdf3 \
192+ subsf3 \
193+ truncdfsf2 \
194+ udivsi3 \
195+ umodsi3 \
196+ unorddf2 \
197+ unordsf2
198+
199+ARM_FUNCTIONS := \
200+ aeabi_cdcmpeq \
201+ aeabi_cdrcmple \
202+ aeabi_cfcmpeq \
203+ aeabi_cfrcmple \
204+ aeabi_dcmpeq \
205+ aeabi_dcmpge \
206+ aeabi_dcmpgt \
207+ aeabi_dcmple \
208+ aeabi_dcmplt \
209+ aeabi_drsub \
210+ aeabi_fcmpeq \
211+ aeabi_fcmpge \
212+ aeabi_fcmpgt \
213+ aeabi_fcmple \
214+ aeabi_fcmplt \
215+ aeabi_frsub \
216+ aeabi_idivmod \
217+ aeabi_uidivmod \
218+
219+# ARM Assembly implementation which requires Thumb2 (i.e. won't work on v6M).
220+THUMB2_FUNCTIONS := \
221+ switch16 \
222+ switch32 \
223+ switch8 \
224+ switchu8 \
225+ sync_fetch_and_add_4 \
226+ sync_fetch_and_sub_4 \
227+ sync_fetch_and_and_4 \
228+ sync_fetch_and_or_4 \
229+ sync_fetch_and_xor_4 \
230+ sync_fetch_and_nand_4 \
231+ sync_fetch_and_max_4 \
232+ sync_fetch_and_umax_4 \
233+ sync_fetch_and_min_4 \
234+ sync_fetch_and_umin_4 \
235+ sync_fetch_and_add_8 \
236+ sync_fetch_and_sub_8 \
237+ sync_fetch_and_and_8 \
238+ sync_fetch_and_or_8 \
239+ sync_fetch_and_xor_8 \
240+ sync_fetch_and_nand_8 \
241+ sync_fetch_and_max_8 \
242+ sync_fetch_and_umax_8 \
243+ sync_fetch_and_min_8 \
244+ sync_fetch_and_umin_8
245+
246+I386_FUNCTIONS := \
247+ i686.get_pc_thunk.eax \
248+ i686.get_pc_thunk.ebp \
249+ i686.get_pc_thunk.ebx \
250+ i686.get_pc_thunk.ecx \
251+ i686.get_pc_thunk.edi \
252+ i686.get_pc_thunk.edx \
253+ i686.get_pc_thunk.esi
254+
255+# FIXME: Currently, compiler-rt is missing implementations for a number of the
256+# functions. Filter them out for now.
257+MISSING_FUNCTIONS := \
258+ cmpdf2 cmpsf2 div0 \
259+ ffssi2 \
260+ udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \
261+ bswapsi2 \
262+ gcc_bcmp \
263+ do_global_dtors \
264+ i686.get_pc_thunk.eax i686.get_pc_thunk.ebp i686.get_pc_thunk.ebx \
265+ i686.get_pc_thunk.ecx i686.get_pc_thunk.edi i686.get_pc_thunk.edx \
266+ i686.get_pc_thunk.esi \
267+ aeabi_cdcmpeq aeabi_cdrcmple aeabi_cfcmpeq aeabi_cfrcmple aeabi_dcmpeq \
268+ aeabi_dcmpge aeabi_dcmpgt aeabi_dcmple aeabi_dcmplt aeabi_drsub \
269+ aeabi_fcmpeq \ aeabi_fcmpge aeabi_fcmpgt aeabi_fcmple aeabi_fcmplt \
270+ aeabi_frsub aeabi_idivmod aeabi_uidivmod
271+
272+FUNCTIONS_ARMV6M := $(COMMON_FUNCTIONS) $(ARM_FUNCTIONS)
273+FUNCTIONS_ARM_ALL := $(COMMON_FUNCTIONS) $(ARM_FUNCTIONS) $(THUMB2_FUNCTIONS)
274+FUNCTIONS_I386 := $(COMMON_FUNCTIONS) $(I386_FUNCTIONS)
275+FUNCTIONS_X86_64 := $(COMMON_FUNCTIONS)
276+
277+FUNCTIONS_ARMV6M := \
278+ $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_ARMV6M))
279+FUNCTIONS_ARM_ALL := \
280+ $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_ARM_ALL))
281+FUNCTIONS_I386 := \
282+ $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_I386))
283+FUNCTIONS_X86_64 := \
284+ $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_X86_64))
285+
286+FUNCTIONS.soft_static.armv6m := $(FUNCTIONS_ARMV6M)
287+FUNCTIONS.soft_pic.armv6m := $(FUNCTIONS_ARMV6M)
288+
289+FUNCTIONS.soft_static.armv7m := $(FUNCTIONS_ARM_ALL)
290+FUNCTIONS.soft_pic.armv7m := $(FUNCTIONS_ARM_ALL)
291+
292+FUNCTIONS.soft_static.armv7em := $(FUNCTIONS_ARM_ALL)
293+FUNCTIONS.hard_static.armv7em := $(FUNCTIONS_ARM_ALL)
294+FUNCTIONS.soft_pic.armv7em := $(FUNCTIONS_ARM_ALL)
295+FUNCTIONS.hard_pic.armv7em := $(FUNCTIONS_ARM_ALL)
296+
297+FUNCTIONS.soft_static.armv7 := $(FUNCTIONS_ARM_ALL)
298+FUNCTIONS.hard_static.armv7 := $(FUNCTIONS_ARM_ALL)
299+FUNCTIONS.soft_pic.armv7 := $(FUNCTIONS_ARM_ALL)
300+FUNCTIONS.hard_pic.armv7 := $(FUNCTIONS_ARM_ALL)
301+
302+FUNCTIONS.hard_static.i386 := $(FUNCTIONS_I386)
303+FUNCTIONS.hard_pic.i386 := $(FUNCTIONS_I386)
304+
305+FUNCTIONS.hard_static.x86_64 := $(FUNCTIONS_X86_64)
306+FUNCTIONS.hard_pic.x86_64 := $(FUNCTIONS_X86_64)
307diff --git a/compiler-rt/make/platform/clang_linux_embedded_test_input.c b/compiler-rt/make/platform/clang_linux_embedded_test_input.c
308new file mode 100644
309index 000000000000..e69de29bb2d1
diff --git a/recipes-devtools/clang/clang/0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch b/recipes-devtools/clang/clang/0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
deleted file mode 100644
index c5c809b..0000000
--- a/recipes-devtools/clang/clang/0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From 3d969ae73698da3518f3230f9e40cb7bd6f2e6c3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 May 2016 23:11:45 -0700
4Subject: [PATCH] compiler-rt: Simplify cross-compilation. Don't use
5 native-compiled llvm-config.
6
7 Note: AddLLVM.cmake does not expose the LLVM source directory.
8 So if you want to run the test suite, you need to either:
9
10 1) set LLVM_MAIN_SRC_DIR explicitly (to find lit.py)
11 2) change AddLLVM.cmake to point to an installed 'lit'.
12 3) add_subdirectory(compiler-rt/test) from clang instead of compiler-rt.
13
14https://us.codeaurora.org/patches/quic/llvm/50683/compiler-rt-cross-compilation.patch
15
16Upstream-Status: Pending
17Signed-off-by: Greg Fitzgerald <gregf@codeaurora.org>
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 compiler-rt/CMakeLists.txt | 11 ++++++++++-
21 1 file changed, 10 insertions(+), 1 deletion(-)
22
23diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
24index bbb4e8d7c333..583e5630b03c 100644
25--- a/compiler-rt/CMakeLists.txt
26+++ b/compiler-rt/CMakeLists.txt
27@@ -82,7 +82,16 @@ if (COMPILER_RT_STANDALONE_BUILD)
28 set(CMAKE_CXX_EXTENSIONS NO)
29
30 if (NOT LLVM_RUNTIMES_BUILD)
31- load_llvm_config()
32+ find_package(LLVM REQUIRED)
33+ list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
34+
35+ # Variables that AddLLVM.cmake depends on (included by AddCompilerRT)
36+ set(LLVM_TOOLS_BINARY_DIR "${LLVM_INSTALL_PREFIX}/bin")
37+ set(LLVM_LIBRARY_DIR "${LLVM_INSTALL_PREFIX}/lib")
38+
39+ set(LLVM_LIBRARY_OUTPUT_INTDIR
40+ ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
41+
42 endif()
43 if (TARGET intrinsics_gen)
44 # Loading the llvm config causes this target to be imported so place it
diff --git a/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
deleted file mode 100644
index 505a5ba..0000000
--- a/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ /dev/null
@@ -1,90 +0,0 @@
1From df831369b91c38565d73b56d452186eff0a63dd4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 21 May 2016 00:33:20 +0000
4Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are
5 macros
6
7musl defines some functions as macros and not inline functions
8if this is the case then make sure to undefine them
9
10Upstream-Status: Pending
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 .../llvm/Analysis/TargetLibraryInfo.def | 22 ++++++++++++++++++-
14 1 file changed, 21 insertions(+), 1 deletion(-)
15
16diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
17index 6bd922eed89e..9e15466f963a 100644
18--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
19+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
20@@ -1348,6 +1348,9 @@ TLI_DEFINE_STRING_INTERNAL("fopen")
21 TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
22
23 /// FILE *fopen64(const char *filename, const char *opentype)
24+#ifdef fopen64
25+#undef fopen64
26+#endif
27 TLI_DEFINE_ENUM_INTERNAL(fopen64)
28 TLI_DEFINE_STRING_INTERNAL("fopen64")
29 TLI_DEFINE_SIG_INTERNAL(Ptr, Ptr, Ptr)
30@@ -1426,7 +1429,9 @@ TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Long, Int)
31 TLI_DEFINE_ENUM_INTERNAL(fseeko)
32 TLI_DEFINE_STRING_INTERNAL("fseeko")
33 TLI_DEFINE_SIG_INTERNAL(Int, Ptr, IntX, Int)
34-
35+#ifdef fseeko64
36+#undef fseeko64
37+#endif
38 /// int fseeko64(FILE *stream, off64_t offset, int whence)
39 TLI_DEFINE_ENUM_INTERNAL(fseeko64)
40 TLI_DEFINE_STRING_INTERNAL("fseeko64")
41@@ -1443,6 +1448,9 @@ TLI_DEFINE_STRING_INTERNAL("fstat")
42 TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
43
44 /// int fstat64(int filedes, struct stat64 *buf)
45+#ifdef fstat64
46+#undef fstat64
47+#endif
48 TLI_DEFINE_ENUM_INTERNAL(fstat64)
49 TLI_DEFINE_STRING_INTERNAL("fstat64")
50 TLI_DEFINE_SIG_INTERNAL(Int, Int, Ptr)
51@@ -1468,6 +1476,9 @@ TLI_DEFINE_STRING_INTERNAL("ftello")
52 TLI_DEFINE_SIG_INTERNAL(IntPlus, Ptr)
53
54 /// off64_t ftello64(FILE *stream)
55+#ifdef ftello64
56+#undef ftello64
57+#endif
58 TLI_DEFINE_ENUM_INTERNAL(ftello64)
59 TLI_DEFINE_STRING_INTERNAL("ftello64")
60 TLI_DEFINE_SIG_INTERNAL(Int64, Ptr)
61@@ -1678,6 +1689,9 @@ TLI_DEFINE_STRING_INTERNAL("lstat")
62 TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
63
64 /// int lstat64(const char *path, struct stat64 *buf);
65+#ifdef lstat64
66+#undef lstat64
67+#endif
68 TLI_DEFINE_ENUM_INTERNAL(lstat64)
69 TLI_DEFINE_STRING_INTERNAL("lstat64")
70 TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
71@@ -2090,6 +2104,9 @@ TLI_DEFINE_STRING_INTERNAL("stat")
72 TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
73
74 /// int stat64(const char *path, struct stat64 *buf);
75+#ifdef stat64
76+#undef stat64
77+#endif
78 TLI_DEFINE_ENUM_INTERNAL(stat64)
79 TLI_DEFINE_STRING_INTERNAL("stat64")
80 TLI_DEFINE_SIG_INTERNAL(Int, Ptr, Ptr)
81@@ -2315,6 +2332,9 @@ TLI_DEFINE_STRING_INTERNAL("tmpfile")
82 TLI_DEFINE_SIG_INTERNAL(Ptr)
83
84 /// FILE *tmpfile64(void)
85+#ifdef tmpfile64
86+#undef tmpfile64
87+#endif
88 TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
89 TLI_DEFINE_STRING_INTERNAL("tmpfile64")
90 TLI_DEFINE_SIG_INTERNAL(Ptr)
diff --git a/recipes-devtools/clang/clang/0005-llvm-allow-env-override-of-exe-and-libdir-path.patch b/recipes-devtools/clang/clang/0005-llvm-allow-env-override-of-exe-and-libdir-path.patch
deleted file mode 100644
index 249027a..0000000
--- a/recipes-devtools/clang/clang/0005-llvm-allow-env-override-of-exe-and-libdir-path.patch
+++ /dev/null
@@ -1,71 +0,0 @@
1From a160c086ee25bb5db31bc497e910c3615681e948 Mon Sep 17 00:00:00 2001
2From: Martin Kelly <mkelly@xevo.com>
3Date: Fri, 19 May 2017 00:22:57 -0700
4Subject: [PATCH] llvm: allow env override of exe and libdir path
5
6When using a native llvm-config from inside a sysroot, we need llvm-config to
7return the libraries, include directories, etc. from inside the sysroot rather
8than from the native sysroot. Thus provide an env override for calling
9llvm-config from a target sysroot.
10
11Add YOCTO_ALTERNATE_LIBDIR and YOCTO_ALTERNATE_EXE_PATH env variables
12
13Upstream-Status: Inappropriate [OE-specific]
14
15Signed-off-by: Martin Kelly <mkelly@xevo.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 llvm/tools/llvm-config/llvm-config.cpp | 25 +++++++++++++++++++------
19 1 file changed, 19 insertions(+), 6 deletions(-)
20
21diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
22index d5b76b1bb6c1..a739f0d8dbea 100644
23--- a/llvm/tools/llvm-config/llvm-config.cpp
24+++ b/llvm/tools/llvm-config/llvm-config.cpp
25@@ -246,6 +246,13 @@ Typical components:\n\
26
27 /// Compute the path to the main executable.
28 std::string GetExecutablePath(const char *Argv0) {
29+ // Hack for Yocto: we need to override the root path when we are using
30+ // llvm-config from within a target sysroot.
31+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
32+ if (Sysroot != nullptr) {
33+ return Sysroot;
34+ }
35+
36 // This just needs to be some symbol in the binary; C++ doesn't
37 // allow taking the address of ::main however.
38 void *P = (void *)(intptr_t)GetExecutablePath;
39@@ -325,7 +332,7 @@ int main(int argc, char **argv) {
40 // Compute various directory locations based on the derived location
41 // information.
42 std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir,
43- ActiveCMakeDir;
44+ ActiveCMakeDir, BaseLibDir;
45 std::string ActiveIncludeOption;
46 if (IsInDevelopmentTree) {
47 ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
48@@ -366,12 +373,18 @@ int main(int argc, char **argv) {
49 sys::fs::make_absolute(ActivePrefix, Path);
50 ActiveBinDir = std::string(Path);
51 }
52- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
53- {
54- SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR);
55- sys::fs::make_absolute(ActivePrefix, Path);
56- ActiveCMakeDir = std::string(Path);
57+ // Hack for Yocto: we need to override the lib path when we are using
58+ // llvm-config from within a target sysroot since LLVM_LIBDIR_SUFFIX
59+ // maybe different for host llvm vs target e.g. ppc64 Libdir=lib64 but
60+ // x86_64 Libdir = lib
61+ const char *YoctoLibDir = std::getenv("YOCTO_ALTERNATE_LIBDIR");
62+ if (YoctoLibDir != nullptr) {
63+ BaseLibDir = std::string(YoctoLibDir);
64+ } else {
65+ BaseLibDir = std::string("/lib") + LLVM_LIBDIR_SUFFIX;
66 }
67+ ActiveLibDir = ActivePrefix + BaseLibDir;
68+ ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
69 ActiveIncludeOption = "-I" + ActiveIncludeDir;
70 }
71
diff --git a/recipes-devtools/clang/clang/0006-clang-driver-Check-sysroot-for-ldso-path.patch b/recipes-devtools/clang/clang/0006-clang-driver-Check-sysroot-for-ldso-path.patch
deleted file mode 100644
index 1175ec7..0000000
--- a/recipes-devtools/clang/clang/0006-clang-driver-Check-sysroot-for-ldso-path.patch
+++ /dev/null
@@ -1,75 +0,0 @@
1From af511db3b78d27f21af09877c1c188b1c0c2ce0a Mon Sep 17 00:00:00 2001
2From: Dan McGregor <dan.mcgregor@usask.ca>
3Date: Wed, 26 Apr 2017 20:29:41 -0600
4Subject: [PATCH] clang: driver: Check sysroot for ldso path
5
6OE does not necessarily follow the default path for the dynamic linker,
7therefore adjust it for OE. Check for the default path, and if it isn't
8there, check /lib.
9
10Upstream-Status: Pending
11Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 clang/lib/Driver/ToolChains/Linux.cpp | 22 +++++++++++++++++++++-
15 1 file changed, 21 insertions(+), 1 deletion(-)
16
17diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
18index 4300a2bdff17..fe1bea2bde9d 100644
19--- a/clang/lib/Driver/ToolChains/Linux.cpp
20+++ b/clang/lib/Driver/ToolChains/Linux.cpp
21@@ -499,7 +499,11 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
22 Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
23 tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard;
24
25- LibDir = "lib";
26+ LibDir = "lib32";
27+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
28+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
29+ LibDir = "lib";
30+ }
31 Loader = HF ? "ld-linux-armhf.so.3" : "ld-linux.so.3";
32 break;
33 }
34@@ -554,11 +558,19 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
35 LibDir = "lib64";
36 Loader =
37 (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
38+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
39+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
40+ LibDir = "lib";
41+ }
42 break;
43 case llvm::Triple::ppc64le:
44 LibDir = "lib64";
45 Loader =
46 (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
47+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
48+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
49+ LibDir = "lib";
50+ }
51 break;
52 case llvm::Triple::riscv32: {
53 StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
54@@ -580,6 +592,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
55 case llvm::Triple::sparcv9:
56 LibDir = "lib64";
57 Loader = "ld-linux.so.2";
58+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
59+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
60+ LibDir = "lib";
61+ }
62 break;
63 case llvm::Triple::systemz:
64 LibDir = "lib";
65@@ -594,6 +610,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
66
67 LibDir = X32 ? "libx32" : "lib64";
68 Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
69+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
70+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
71+ LibDir = "lib";
72+ }
73 break;
74 }
75 case llvm::Triple::ve:
diff --git a/recipes-devtools/clang/clang/0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch b/recipes-devtools/clang/clang/0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
deleted file mode 100644
index 9d174a7..0000000
--- a/recipes-devtools/clang/clang/0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From a842a494f82f68c92a562aa40e6861f792d5b703 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 19 May 2016 21:11:06 -0700
4Subject: [PATCH] clang: Driver/tools.cpp: Add -lssp_nonshared on musl
5
6musl driver will need to add ssp_nonshared for stack_check_local
7on the linker cmdline when using stack protector commands on
8compiler cmdline
9
10Upstream-Status: Pending
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++
14 1 file changed, 6 insertions(+)
15
16diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
17index e5e1b1d77269..7b43cde6b884 100644
18--- a/clang/lib/Driver/ToolChains/Gnu.cpp
19+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
20@@ -628,6 +628,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
21 if (IsIAMCU)
22 CmdArgs.push_back("-lgloss");
23
24+ if (ToolChain.getTriple().isMusl() &&
25+ (Args.hasArg(options::OPT_fstack_protector) ||
26+ Args.hasArg(options::OPT_fstack_protector_strong) ||
27+ Args.hasArg(options::OPT_fstack_protector_all))) {
28+ CmdArgs.push_back("-lssp_nonshared");
29+ }
30 if (IsStatic || IsStaticPIE)
31 CmdArgs.push_back("--end-group");
32 else
diff --git a/recipes-devtools/clang/clang/0008-clang-Prepend-trailing-to-sysroot.patch b/recipes-devtools/clang/clang/0008-clang-Prepend-trailing-to-sysroot.patch
deleted file mode 100644
index c43219f..0000000
--- a/recipes-devtools/clang/clang/0008-clang-Prepend-trailing-to-sysroot.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 53b47e96f7c69bea46d16489dd6887561245c23f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 16 Mar 2017 09:02:13 -0700
4Subject: [PATCH] clang: Prepend trailing '/' to sysroot
5
6This is needed to handle a case where clang
7isntall and target sysroot are perilously same
8
9e.g.
10
11sysroot = /mnt/clang/recipe-sysroot
12clang install = /mnt/clang/recipe-sysroot-native
13
14in this case it will mistakenly assume that
15clang is installed under the same sysroot dir
16and it will try to add relative ../lib paths
17to linker steps which would then be wrong
18since they will become relative to clang
19installation and not sysroot
20
21Upstream-Status: Pending
22Signed-off-by: Khem Raj <raj.khem@gmail.com>
23---
24 clang/lib/Driver/ToolChains/Linux.cpp | 2 +-
25 1 file changed, 1 insertion(+), 1 deletion(-)
26
27diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
28index fe1bea2bde9d..9cfc135ed2c0 100644
29--- a/clang/lib/Driver/ToolChains/Linux.cpp
30+++ b/clang/lib/Driver/ToolChains/Linux.cpp
31@@ -219,7 +219,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
32 Multilibs = GCCInstallation.getMultilibs();
33 SelectedMultilibs.assign({GCCInstallation.getMultilib()});
34 llvm::Triple::ArchType Arch = Triple.getArch();
35- std::string SysRoot = computeSysRoot();
36+ std::string SysRoot = computeSysRoot() + "/";
37 ToolChain::path_list &PPaths = getProgramPaths();
38
39 Generic_GCC::PushPPaths(PPaths);
diff --git a/recipes-devtools/clang/clang/0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch b/recipes-devtools/clang/clang/0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
deleted file mode 100644
index 3149159..0000000
--- a/recipes-devtools/clang/clang/0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From fd99d9521a7f9ce8c8de7c05a9636efa5a5c34e2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 16 Mar 2017 19:06:26 -0700
4Subject: [PATCH] clang: Look inside the target sysroot for compiler runtime
5
6In OE compiler-rt and libc++ are built and staged into target
7sysroot and not into resourcedir which is relative to clang
8driver installation where the libraries are not instlled
9
10Specific to cross compiling the way yocto/OE works
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 clang/lib/Driver/ToolChain.cpp | 6 +++++-
16 1 file changed, 5 insertions(+), 1 deletion(-)
17
18diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
19index 388030592b48..c59700b4a7ab 100644
20--- a/clang/lib/Driver/ToolChain.cpp
21+++ b/clang/lib/Driver/ToolChain.cpp
22@@ -15,6 +15,7 @@
23 #include "ToolChains/InterfaceStubs.h"
24 #include "clang/Basic/ObjCRuntime.h"
25 #include "clang/Basic/Sanitizers.h"
26+#include "clang/Basic/Version.h"
27 #include "clang/Config/config.h"
28 #include "clang/Driver/Action.h"
29 #include "clang/Driver/Driver.h"
30@@ -595,7 +596,10 @@ StringRef ToolChain::getOSLibName() const {
31 }
32
33 std::string ToolChain::getCompilerRTPath() const {
34- SmallString<128> Path(getDriver().ResourceDir);
35+ SmallString<128> Path(getDriver().SysRoot);
36+ StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
37+ llvm::sys::path::append(Path, "/usr/", ClangLibdirBasename, "clang",
38+ CLANG_VERSION_STRING);
39 if (isBareMetal()) {
40 llvm::sys::path::append(Path, "lib", getOSLibName());
41 if (!SelectedMultilibs.empty()) {
diff --git a/recipes-devtools/clang/clang/0010-clang-Define-releative-gcc-installation-dir.patch b/recipes-devtools/clang/clang/0010-clang-Define-releative-gcc-installation-dir.patch
deleted file mode 100644
index 7d56623..0000000
--- a/recipes-devtools/clang/clang/0010-clang-Define-releative-gcc-installation-dir.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1From a310e5638205777893228a1c0853bd5494e7d02c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 20 Mar 2021 16:09:16 -0700
4Subject: [PATCH] clang: Define / releative gcc installation dir
5
6This is required for OE gcc installation to work.
7Without this its not able to find the paths for libgcc
8and other standard headers and libraries from gcc
9installation in OE
10
11Upstream-Status: Pending
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 clang/lib/Driver/ToolChains/Gnu.cpp | 14 +++++++-------
15 1 file changed, 7 insertions(+), 7 deletions(-)
16
17diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
18index 7b43cde6b884..1ea6927d06f3 100644
19--- a/clang/lib/Driver/ToolChains/Gnu.cpp
20+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
21@@ -2913,19 +2913,19 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
22 // Whether this library suffix is relevant for the triple.
23 bool Active;
24 } Suffixes[] = {
25- // This is the normal place.
26- {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists},
27-
28- // Debian puts cross-compilers in gcc-cross.
29- {"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists},
30-
31 // The Freescale PPC SDK has the gcc libraries in
32 // <sysroot>/usr/lib/<triple>/x.y.z so have a look there as well. Only do
33 // this on Freescale triples, though, since some systems put a *lot* of
34 // files in that location, not just GCC installation data.
35 {CandidateTriple.str(), "..",
36 TargetTriple.getVendor() == llvm::Triple::Freescale ||
37- TargetTriple.getVendor() == llvm::Triple::OpenEmbedded}};
38+ TargetTriple.getVendor() == llvm::Triple::OpenEmbedded},
39+
40+ // This is the normal place.
41+ {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists},
42+
43+ // Debian puts cross-compilers in gcc-cross.
44+ {"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists}};
45
46 for (auto &Suffix : Suffixes) {
47 if (!Suffix.Active)
diff --git a/recipes-devtools/clang/clang/0011-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch b/recipes-devtools/clang/clang/0011-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
deleted file mode 100644
index 4e9360c..0000000
--- a/recipes-devtools/clang/clang/0011-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From bc21d17ff434af5efdb2fac86392862230c6f9e6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 31 Jul 2019 22:51:39 -0700
4Subject: [PATCH] clang: Add -lpthread and -ldl along with -lunwind for static
5 linking
6
7When doing static liking with --unwindlib=libunwind -static we encounter
8undefined symbols
9libunwind/src/RWMutex.hpp:68: undefined reference to `pthread_rwlock_wrlock'
10
11and
12
13libunwind/src/AddressSpace.hpp:597: undefined reference to `dladdr'
14
15therefore we need to link in libpthread and libdl to fill these symbols
16
17Upstream-Status: Pending
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 ++
21 1 file changed, 2 insertions(+)
22
23diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
24index 2b916f000336..de823347a527 100644
25--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
26+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
27@@ -2179,6 +2179,8 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D,
28 CmdArgs.push_back("-lunwind");
29 } else if (LGT == LibGccType::StaticLibGcc) {
30 CmdArgs.push_back("-l:libunwind.a");
31+ CmdArgs.push_back("-lpthread");
32+ CmdArgs.push_back("-ldl");
33 } else if (LGT == LibGccType::SharedLibGcc) {
34 if (TC.getTriple().isOSCygMing())
35 CmdArgs.push_back("-l:libunwind.dll.a");
diff --git a/recipes-devtools/clang/clang/0012-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch b/recipes-devtools/clang/clang/0012-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
deleted file mode 100644
index b6efd2b..0000000
--- a/recipes-devtools/clang/clang/0012-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1From a48c97d8a0f5eee9729cad03eac5be677c9963e8 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Thu, 26 Dec 2019 12:56:16 -0800
4Subject: [PATCH] Pass PYTHON_EXECUTABLE when cross compiling for native build
5
6Upstream-Status: Pending
7Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 llvm/cmake/modules/CrossCompile.cmake | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake
14index 55bf3be75642..71b09ec05b68 100644
15--- a/llvm/cmake/modules/CrossCompile.cmake
16+++ b/llvm/cmake/modules/CrossCompile.cmake
17@@ -90,6 +90,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
18 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}"
19 -DLLVM_INCLUDE_BENCHMARKS=OFF
20 -DLLVM_INCLUDE_TESTS=OFF
21+ -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}"
22 ${build_type_flags} ${linker_flag} ${external_clang_dir} ${libc_flags}
23 ${ARGN}
24 WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD}
diff --git a/recipes-devtools/clang/clang/0013-Check-for-atomic-double-intrinsics.patch b/recipes-devtools/clang/clang/0013-Check-for-atomic-double-intrinsics.patch
deleted file mode 100644
index 5a942e6..0000000
--- a/recipes-devtools/clang/clang/0013-Check-for-atomic-double-intrinsics.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 4e96e75d77d0d59399f0b8ad7aa0555e39e7b5cc Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 18 Nov 2019 17:00:29 -0800
4Subject: [PATCH] Check for atomic<double> intrinsics
5
6On some architectures e.g. x86/32bit gcc decides to inline calls to
7double atomic variables but clang does not and defers it to libatomic
8therefore detect if clang can use built-ins for atomic<double> if not
9then link libatomic, this helps building clangd for x86 on linux systems
10with gcc runtime
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 llvm/cmake/modules/CheckAtomic.cmake | 3 ++-
16 1 file changed, 2 insertions(+), 1 deletion(-)
17
18diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
19index f11cadf39ff6..80a18a92956a 100644
20--- a/llvm/cmake/modules/CheckAtomic.cmake
21+++ b/llvm/cmake/modules/CheckAtomic.cmake
22@@ -30,10 +30,11 @@ function(check_working_cxx_atomics64 varname)
23 #include <atomic>
24 #include <cstdint>
25 std::atomic<uint64_t> x (0);
26+std::atomic<double> y (0);
27 int main() {
28 uint64_t i = x.load(std::memory_order_relaxed);
29 (void)i;
30- return 0;
31+ return int(y);
32 }
33 " ${varname})
34 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
diff --git a/recipes-devtools/clang/clang/0014-libcxx-Add-compiler-runtime-library-to-link-step-for.patch b/recipes-devtools/clang/clang/0014-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
deleted file mode 100644
index 757917f..0000000
--- a/recipes-devtools/clang/clang/0014-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From c0a66d4f358b24bf3acd89910e0f7fc780d16a11 Mon Sep 17 00:00:00 2001
2From: Jeremy Puhlman <jpuhlman@mvista.com>
3Date: Thu, 16 Jan 2020 21:16:10 +0000
4Subject: [PATCH] libcxx: Add compiler runtime library to link step for libcxx
5
6This corrects "undefined reference to __divti3"
7
8Upstream-Status: Inappropriate [configuration]
9
10Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 libcxx/src/CMakeLists.txt | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
17index 1b80625304a4..fe706c9e920f 100644
18--- a/libcxx/src/CMakeLists.txt
19+++ b/libcxx/src/CMakeLists.txt
20@@ -198,7 +198,7 @@ if (LIBCXX_ENABLE_SHARED)
21 add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
22 target_include_directories(cxx_shared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
23 target_link_libraries(cxx_shared PUBLIC cxx-headers
24- PRIVATE ${LIBCXX_LIBRARIES})
25+ PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)")
26 set_target_properties(cxx_shared
27 PROPERTIES
28 COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}"
29@@ -291,7 +291,7 @@ if (LIBCXX_ENABLE_STATIC)
30 add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS})
31 target_include_directories(cxx_static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
32 target_link_libraries(cxx_static PUBLIC cxx-headers
33- PRIVATE ${LIBCXX_LIBRARIES}
34+ PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)"
35 PRIVATE libcxx-abi-static)
36 set_target_properties(cxx_static
37 PROPERTIES
diff --git a/recipes-devtools/clang/clang/0015-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/recipes-devtools/clang/clang/0015-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
deleted file mode 100644
index d42836d..0000000
--- a/recipes-devtools/clang/clang/0015-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
+++ /dev/null
@@ -1,115 +0,0 @@
1From aab6a666bf1094d9750a10e547ebd6fe093af513 Mon Sep 17 00:00:00 2001
2From: Ovidiu Panait <ovidiu.panait@windriver.com>
3Date: Fri, 31 Jan 2020 10:56:11 +0200
4Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using
5 find_package()
6
7Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git])
8that depends on LLVM/Clang tries to run cmake find_package() during
9do_configure, it will fail with a similar error:
10
11| The imported target "llvm-tblgen" references the file
12| ".../recipe-sysroot/usr/bin/llvm-tblgen"
13|
14| but this file does not exist. Possible reasons include:
15| * The file was deleted, renamed, or moved to another location.
16| * An install or uninstall procedure did not complete successfully.
17| * The installation package was faulty and contained
18| ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake"
19| but not all the files it references.
20
21This is due to the fact that currently the cmake scripts look for target
22binaries in sysroot. Work around this by not exporting the target binaries in
23Exports-* cmake files.
24
25Upstream-Status: Inappropriate [oe-specific]
26
27Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
28---
29 clang/cmake/modules/AddClang.cmake | 2 --
30 llvm/cmake/modules/AddLLVM.cmake | 6 ------
31 llvm/cmake/modules/TableGen.cmake | 6 ------
32 3 files changed, 14 deletions(-)
33
34diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
35index 75b0080f6715..ddf446a13eca 100644
36--- a/clang/cmake/modules/AddClang.cmake
37+++ b/clang/cmake/modules/AddClang.cmake
38@@ -168,7 +168,6 @@ macro(add_clang_tool name)
39 if (CLANG_BUILD_TOOLS)
40 get_target_export_arg(${name} Clang export_to_clangtargets)
41 install(TARGETS ${name}
42- ${export_to_clangtargets}
43 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
44 COMPONENT ${name})
45
46@@ -177,7 +176,6 @@ macro(add_clang_tool name)
47 DEPENDS ${name}
48 COMPONENT ${name})
49 endif()
50- set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
51 endif()
52 endif()
53 endmacro()
54diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
55index 3bc78b0dc935..bc492ceb90db 100644
56--- a/llvm/cmake/modules/AddLLVM.cmake
57+++ b/llvm/cmake/modules/AddLLVM.cmake
58@@ -1368,7 +1368,6 @@ macro(llvm_add_tool project name)
59 if( LLVM_BUILD_TOOLS )
60 get_target_export_arg(${name} LLVM export_to_llvmexports)
61 install(TARGETS ${name}
62- ${export_to_llvmexports}
63 RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
64 COMPONENT ${name})
65
66@@ -1379,9 +1378,6 @@ macro(llvm_add_tool project name)
67 endif()
68 endif()
69 endif()
70- if( LLVM_BUILD_TOOLS )
71- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
72- endif()
73 set_target_properties(${name} PROPERTIES FOLDER "Tools")
74 endif()
75 endmacro(llvm_add_tool project name)
76@@ -1426,7 +1422,6 @@ macro(add_llvm_utility name)
77 if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
78 get_target_export_arg(${name} LLVM export_to_llvmexports)
79 install(TARGETS ${name}
80- ${export_to_llvmexports}
81 RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
82 COMPONENT ${name})
83
84@@ -1435,7 +1430,6 @@ macro(add_llvm_utility name)
85 DEPENDS ${name}
86 COMPONENT ${name})
87 endif()
88- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
89 elseif(LLVM_BUILD_UTILS)
90 set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
91 endif()
92diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
93index 1d18fdde2bb9..c9363ffb3376 100644
94--- a/llvm/cmake/modules/TableGen.cmake
95+++ b/llvm/cmake/modules/TableGen.cmake
96@@ -222,12 +222,7 @@ macro(add_tablegen target project)
97
98 if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND
99 (LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS))
100- set(export_arg)
101- if(ADD_TABLEGEN_EXPORT)
102- get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg)
103- endif()
104 install(TARGETS ${target}
105- ${export_arg}
106 COMPONENT ${target}
107 RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}")
108 if(NOT LLVM_ENABLE_IDE)
109@@ -238,6 +233,5 @@ macro(add_tablegen target project)
110 endif()
111 if(ADD_TABLEGEN_EXPORT)
112 string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper)
113- set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target})
114 endif()
115 endmacro()
diff --git a/recipes-devtools/clang/clang/0016-clang-Fix-resource-dir-location-for-cross-toolchains.patch b/recipes-devtools/clang/clang/0016-clang-Fix-resource-dir-location-for-cross-toolchains.patch
deleted file mode 100644
index b7aeb2b..0000000
--- a/recipes-devtools/clang/clang/0016-clang-Fix-resource-dir-location-for-cross-toolchains.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 58cae5f6f4df0e6fd8529f99f940984e770f4c84 Mon Sep 17 00:00:00 2001
2From: Jim Broadus <jbroadus@xevo.com>
3Date: Thu, 26 Mar 2020 16:05:53 -0700
4Subject: [PATCH] clang: Fix resource dir location for cross toolchains
5
6When clang looks for the resources directory, it does so based on the binary
7location and assumes that the containing directory is a sibling to lib. The
8Yocto cross.bbclass defines the default bindir as
9${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}. ex: /usr/bin/aarch64-poky-linux/.
10This causes clang to form a path that looks like /usr/bin/lib/clang/...
11
12As a fix for this, check the parent directory name. If that is "bin", then
13use that directory's parent.
14
15Upstream-Status: Pending
16Signed-off-by: Jim Broadus <jbroadus@xevo.com>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 clang/lib/Driver/Driver.cpp | 8 +++++++-
20 1 file changed, 7 insertions(+), 1 deletion(-)
21
22diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
23index 93cddf742d52..88291dd125d3 100644
24--- a/clang/lib/Driver/Driver.cpp
25+++ b/clang/lib/Driver/Driver.cpp
26@@ -179,9 +179,15 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
27 // With a static-library build of libclang, LibClangPath will contain the
28 // path of the embedding binary, which for LLVM binaries will be in bin/.
29 // ../lib gets us to lib/ in both cases.
30- P = llvm::sys::path::parent_path(Dir);
31+ Dir = std::string(llvm::sys::path::parent_path(Dir));
32 // This search path is also created in the COFF driver of lld, so any
33 // changes here also needs to happen in lld/COFF/Driver.cpp
34+
35+ // OE cross toolchains are installed, by default, in a subdir of bin.
36+ if (llvm::sys::path::filename(Dir) == "bin") {
37+ Dir = std::string(llvm::sys::path::parent_path(Dir));
38+ }
39+ P = Dir;
40 llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang",
41 CLANG_VERSION_MAJOR_STRING);
42 }
diff --git a/recipes-devtools/clang/clang/0017-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch b/recipes-devtools/clang/clang/0017-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
deleted file mode 100644
index fca46f4..0000000
--- a/recipes-devtools/clang/clang/0017-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1From 6c83a2e75b42eff98975bebacd446455d60cb128 Mon Sep 17 00:00:00 2001
2From: Oleksandr Ocheretnyi <oocheret@cisco.com>
3Date: Wed, 15 Apr 2020 00:08:39 +0300
4Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso
5 path
6
7 * the dyld-prefix shall be taken into account when the default
8 path for the dynamic linker has to be checked.
9
10 * this patch shall be used as annex to the next patch:
11 'clang: driver: Check sysroot for ldso path' which includes
12 the usrmerge scenario.
13
14Upstream-Status: Pending
15Signed-off-by: Oleksandr Ocheretnyi <oocheret@cisco.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 clang/lib/Driver/ToolChains/Linux.cpp | 20 ++++++++++----------
19 1 file changed, 10 insertions(+), 10 deletions(-)
20
21diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
22index 9cfc135ed2c0..6df8c58076c9 100644
23--- a/clang/lib/Driver/ToolChains/Linux.cpp
24+++ b/clang/lib/Driver/ToolChains/Linux.cpp
25@@ -500,8 +500,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
26 tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard;
27
28 LibDir = "lib32";
29- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
30- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
31+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
32+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
33 LibDir = "lib";
34 }
35 Loader = HF ? "ld-linux-armhf.so.3" : "ld-linux.so.3";
36@@ -558,8 +558,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
37 LibDir = "lib64";
38 Loader =
39 (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
40- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
41- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
42+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
43+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
44 LibDir = "lib";
45 }
46 break;
47@@ -567,8 +567,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
48 LibDir = "lib64";
49 Loader =
50 (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
51- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
52- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
53+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
54+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
55 LibDir = "lib";
56 }
57 break;
58@@ -592,8 +592,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
59 case llvm::Triple::sparcv9:
60 LibDir = "lib64";
61 Loader = "ld-linux.so.2";
62- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
63- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
64+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
65+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
66 LibDir = "lib";
67 }
68 break;
69@@ -610,8 +610,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
70
71 LibDir = X32 ? "libx32" : "lib64";
72 Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
73- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
74- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
75+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
76+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
77 LibDir = "lib";
78 }
79 break;
diff --git a/recipes-devtools/clang/clang/0018-clang-Use-python3-in-python-scripts.patch b/recipes-devtools/clang/clang/0018-clang-Use-python3-in-python-scripts.patch
deleted file mode 100644
index d72a623..0000000
--- a/recipes-devtools/clang/clang/0018-clang-Use-python3-in-python-scripts.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 5a572d401005fb992b421d65628267e49d70ee74 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 14 Oct 2020 22:19:57 -0700
4Subject: [PATCH] clang: Use python3 in python scripts
5
6Some scripts ask for python, but they work fine with python3
7and in OE python symlink is not exposed to build, only python3 is
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 .../find-all-symbols/tool/run-find-all-symbols.py | 2 +-
13 clang/tools/scan-view/bin/scan-view | 2 +-
14 2 files changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
17index 471dbf8c110b..f98385dc6651 100755
18--- a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
19+++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py
20@@ -1,4 +1,4 @@
21-#!/usr/bin/env python
22+#!/usr/bin/env python3
23 #
24 # =- run-find-all-symbols.py - Parallel find-all-symbols runner -*- python -*-=#
25 #
26diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view
27index d01aebb4029a..f3375804654d 100755
28--- a/clang/tools/scan-view/bin/scan-view
29+++ b/clang/tools/scan-view/bin/scan-view
30@@ -1,4 +1,4 @@
31-#!/usr/bin/env python
32+#!/usr/bin/env python3
33
34 from __future__ import print_function
35
diff --git a/recipes-devtools/clang/clang/0019-For-x86_64-set-Yocto-based-GCC-install-search-path.patch b/recipes-devtools/clang/clang/0019-For-x86_64-set-Yocto-based-GCC-install-search-path.patch
deleted file mode 100644
index 3270872..0000000
--- a/recipes-devtools/clang/clang/0019-For-x86_64-set-Yocto-based-GCC-install-search-path.patch
+++ /dev/null
@@ -1,70 +0,0 @@
1From b928740f3def5353a779859c0454666cae1f7d61 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Mon, 25 Jan 2021 16:14:35 +0800
4Subject: [PATCH] For x86_64, set Yocto based GCC install search path
5
6Under Yocto host, while using clang-native to build, it searches
7install host gcc failed which causing the include file not found
8[snip]
9|clang++ -target x86_64-linux -MMD -MF src/base/files/file_path_constants.o.d -I../../../tools/gn/src -I. \
10-isystem/tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/recipe-sysroot-native/usr/include -O2 -pipe \
11-std=c++17 -c ../../../tools/gn/src/base/files/file_path_constants.cc -o src/base/files/file_path_constants.o
12|../../../tools/gn/src/base/files/file_path_constants.cc:7:10: fatal error: 'iterator' file not found
13|#include <iterator>
14| ^~~~~~~~
15[snip]
16
17Set three Yocto based GCC triple: poky, oe-core and wind river
18
19Before aplly the patch
20[snip]
21$ ../recipe-sysroot-native/usr/bin/clang++ -v
22clang version 11.0.1 (https://github.com/llvm/llvm-project 43ff75f2c3feef64f9d73328230d34dac8832a91)
23Target: x86_64-unknown-linux-gnu
24Thread model: posix
25InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin
26[snip]
27
28After aplly the patch:
29[snip]
30$ ../recipe-sysroot-native/usr/bin/clang++ -v
31clang version 11.0.1 (https://github.com/llvm/llvm-project 22c3241ff9a6224261df48d0258957fd8acc3d64)
32Target: x86_64-unknown-linux-gnu
33Thread model: posix
34InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin
35Found candidate GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0
36Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.1.0
37Selected GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0
38Candidate multilib: .;@m64
39Selected multilib: .;@m64
40[snip]
41
42BTW, it is hardly to insert a triple by the replacement of TARGET_SYS
43(=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR
44is different between clang and clang-native
45
46The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of
47additional triples based on CLANG_EXTRA_OE_VENDORS variable in
48recipes-devtools/clang/llvm-project-source.inc:add_distro_vendor()
49
50Upstream-Status: Inappropriate [oe specific]
51
52Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
53Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
54Signed-off-by: Khem Raj <raj.khem@gmail.com>
55---
56 clang/lib/Driver/ToolChains/Gnu.cpp | 1 +
57 1 file changed, 1 insertion(+)
58
59diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
60index 1ea6927d06f3..185ea3df16f5 100644
61--- a/clang/lib/Driver/ToolChains/Gnu.cpp
62+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
63@@ -2488,6 +2488,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
64 "x86_64-redhat-linux", "x86_64-suse-linux",
65 "x86_64-manbo-linux-gnu", "x86_64-linux-gnu",
66 "x86_64-slackware-linux", "x86_64-unknown-linux",
67+ "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES
68 "x86_64-amazon-linux"};
69 static const char *const X32Triples[] = {"x86_64-linux-gnux32",
70 "x86_64-pc-linux-gnux32"};
diff --git a/recipes-devtools/clang/clang/0020-llvm-Do-not-use-find_library-for-ncurses.patch b/recipes-devtools/clang/clang/0020-llvm-Do-not-use-find_library-for-ncurses.patch
deleted file mode 100644
index e14bc9d..0000000
--- a/recipes-devtools/clang/clang/0020-llvm-Do-not-use-find_library-for-ncurses.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From 07e74b7f5147d5da67b46067df5d26090a3bb96b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 7 Feb 2021 23:58:41 -0800
4Subject: [PATCH] llvm: Do not use find_library for ncurses
5
6This ensures that it lets OE to decide which lib to link
7otherwise it adds absolute paths to linker cmdline and confuses it
8horribly with native and target libs when build clang for target
9
10TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/clang/12.0.0-r0/recipe-sysroot-native/usr/lib/libtinfo.so: error adding symbols: file in wrong format
11clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
12
13Upstream-Status: Pending
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 compiler-rt/cmake/config-ix.cmake | 2 +-
17 llvm/cmake/modules/FindTerminfo.cmake | 2 +-
18 2 files changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
21index 2ca18ebb4ad4..51c56f1e0b8b 100644
22--- a/compiler-rt/cmake/config-ix.cmake
23+++ b/compiler-rt/cmake/config-ix.cmake
24@@ -188,7 +188,7 @@ else()
25 set(MAYBE_REQUIRED)
26 endif()
27 if(LLVM_ENABLE_TERMINFO)
28- find_library(COMPILER_RT_TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED})
29+ find_library(COMPILER_RT_TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
30 endif()
31 if(COMPILER_RT_TERMINFO_LIB)
32 set(LLVM_ENABLE_TERMINFO 1)
33diff --git a/llvm/cmake/modules/FindTerminfo.cmake b/llvm/cmake/modules/FindTerminfo.cmake
34index 163af6697067..bf2e760bed8a 100644
35--- a/llvm/cmake/modules/FindTerminfo.cmake
36+++ b/llvm/cmake/modules/FindTerminfo.cmake
37@@ -11,7 +11,7 @@
38 # Additionally, the following import target will be defined:
39 # Terminfo::terminfo
40
41-find_library(Terminfo_LIBRARIES NAMES terminfo tinfo curses ncurses ncursesw)
42+find_library(Terminfo_LIBRARIES NAMES terminfo tinfo curses ncurses ncursesw NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
43
44 if(Terminfo_LIBRARIES)
45 include(CMakePushCheckState)
diff --git a/recipes-devtools/clang/clang/0021-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch b/recipes-devtools/clang/clang/0021-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch
deleted file mode 100644
index 4feca04..0000000
--- a/recipes-devtools/clang/clang/0021-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From a3dbd6b6c8bfab6877632ec7a1e981aaa2883d90 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 11 Feb 2021 16:42:49 -0800
4Subject: [PATCH] llvm: Insert anchor for adding OE distro vendor names
5
6This helps in making right detection for OE built gcc toolchains
7
8The //CLANG_EXTRA_OE_VENDORS_CASES string is replaced with list of
9additional Ceses based on CLANG_EXTRA_OE_VENDORS variable in
10recipes-devtools/clang/llvm-project-source.inc:add_distro_vendor()
11
12Upstream-Status: Inappropriate [OE-specific]
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
16---
17 llvm/lib/TargetParser/Triple.cpp | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
21index 0bbe8a3cedfd..dbc1240703a0 100644
22--- a/llvm/lib/TargetParser/Triple.cpp
23+++ b/llvm/lib/TargetParser/Triple.cpp
24@@ -601,7 +601,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
25 .Case("amd", Triple::AMD)
26 .Case("mesa", Triple::Mesa)
27 .Case("suse", Triple::SUSE)
28- .Case("oe", Triple::OpenEmbedded)
29+ .Case("oe", Triple::OpenEmbedded)//CLANG_EXTRA_OE_VENDORS_CASES
30 .Default(Triple::UnknownVendor);
31 }
32
diff --git a/recipes-devtools/clang/clang/0022-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch b/recipes-devtools/clang/clang/0022-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch
deleted file mode 100644
index 5498c70..0000000
--- a/recipes-devtools/clang/clang/0022-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch
+++ /dev/null
@@ -1,68 +0,0 @@
1From afed95c05037559e53d9a60b8520b372d54b467d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 19 May 2021 17:32:13 -0700
4Subject: [PATCH] compiler-rt: Do not use backtrace APIs on non-glibc linux
5
6musl e.g. does not provide backtrace APIs
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 .../lib/gwp_asan/optional/backtrace_linux_libc.cpp | 13 ++++++++++++-
12 1 file changed, 12 insertions(+), 1 deletion(-)
13
14diff --git a/compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp b/compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp
15index ea8e72be287d..0344074dd254 100644
16--- a/compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp
17+++ b/compiler-rt/lib/gwp_asan/optional/backtrace_linux_libc.cpp
18@@ -7,7 +7,9 @@
19 //===----------------------------------------------------------------------===//
20
21 #include <assert.h>
22+#ifdef __GLIBC__
23 #include <execinfo.h>
24+#endif
25 #include <stddef.h>
26 #include <stdint.h>
27 #include <stdlib.h>
28@@ -21,8 +23,11 @@
29 namespace {
30 size_t Backtrace(uintptr_t *TraceBuffer, size_t Size) {
31 static_assert(sizeof(uintptr_t) == sizeof(void *), "uintptr_t is not void*");
32-
33+#ifdef __GLIBC__
34 return backtrace(reinterpret_cast<void **>(TraceBuffer), Size);
35+#else
36+ return -1;
37+#endif
38 }
39
40 // We don't need any custom handling for the Segv backtrace - the libc unwinder
41@@ -30,7 +35,11 @@ size_t Backtrace(uintptr_t *TraceBuffer, size_t Size) {
42 // to avoid the additional frame.
43 GWP_ASAN_ALWAYS_INLINE size_t SegvBacktrace(uintptr_t *TraceBuffer, size_t Size,
44 void * /*Context*/) {
45+#ifdef __GLIBC__
46 return Backtrace(TraceBuffer, Size);
47+#else
48+ return -1;
49+#endif
50 }
51
52 static void PrintBacktrace(uintptr_t *Trace, size_t TraceLength,
53@@ -40,6 +49,7 @@ static void PrintBacktrace(uintptr_t *Trace, size_t TraceLength,
54 return;
55 }
56
57+#ifdef __GLIBC__
58 char **BacktraceSymbols =
59 backtrace_symbols(reinterpret_cast<void **>(Trace), TraceLength);
60
61@@ -53,6 +63,7 @@ static void PrintBacktrace(uintptr_t *Trace, size_t TraceLength,
62 Printf("\n");
63 if (BacktraceSymbols)
64 free(BacktraceSymbols);
65+#endif
66 }
67 } // anonymous namespace
68
diff --git a/recipes-devtools/clang/clang/0023-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch b/recipes-devtools/clang/clang/0023-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch
deleted file mode 100644
index 6f982e9..0000000
--- a/recipes-devtools/clang/clang/0023-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 25434c45f0c7079e9171b5ef4027626a64d3e50b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 19 May 2021 17:56:03 -0700
4Subject: [PATCH] clang: Fix x86 triple for non-debian multiarch linux distros
5
6OpenEmbedded does not hardcode mutli-arch like debian therefore ensure
7that it still uses the proper tuple
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 clang/lib/Driver/ToolChains/Linux.cpp | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
16index 6df8c58076c9..cf549331d255 100644
17--- a/clang/lib/Driver/ToolChains/Linux.cpp
18+++ b/clang/lib/Driver/ToolChains/Linux.cpp
19@@ -707,6 +707,9 @@ void Linux::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
20 GCCInstallation.getTriple().getArch() == llvm::Triple::x86
21 ? "i386-linux-gnu"
22 : TripleStr;
23+ // OpenEmbedded does not hardcode the triple to i386-linux-gnu like debian
24+ if (GCCInstallation.getTriple().getVendor() == llvm::Triple::OpenEmbedded)
25+ DebianMultiarch = TripleStr;
26
27 // Try generic GCC detection first.
28 if (Generic_GCC::addGCCLibStdCxxIncludePaths(DriverArgs, CC1Args,
diff --git a/recipes-devtools/clang/clang/0024-libunwind-Added-unw_backtrace-method.patch b/recipes-devtools/clang/clang/0024-libunwind-Added-unw_backtrace-method.patch
deleted file mode 100644
index 887fcd5..0000000
--- a/recipes-devtools/clang/clang/0024-libunwind-Added-unw_backtrace-method.patch
+++ /dev/null
@@ -1,56 +0,0 @@
1From c4ec538a1e00eb60ad890df51401f27484b349d9 Mon Sep 17 00:00:00 2001
2From: Maksim Kita <maksim-kita@yandex-team.ru>
3Date: Sun, 23 May 2021 10:27:29 +0000
4Subject: [PATCH] libunwind: Added unw_backtrace method
5
6Source: https://github.com/ClickHouse-Extras/libunwind/commit/52f0f7861926cbfaef7e6c97d8a6d7ba2a1f6747#diff-a82fc885e2e4facf4b92d26171c13aa4aa5db296f77e1158ba2f8664e3bd1f5c
7Upstream-Status: Pending
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 libunwind/include/libunwind.h | 1 +
11 libunwind/src/libunwind.cpp | 20 ++++++++++++++++++++
12 2 files changed, 21 insertions(+)
13
14diff --git a/libunwind/include/libunwind.h b/libunwind/include/libunwind.h
15index b2dae8feed9a..0ab974c9bfa4 100644
16--- a/libunwind/include/libunwind.h
17+++ b/libunwind/include/libunwind.h
18@@ -130,6 +130,7 @@ extern int unw_is_fpreg(unw_cursor_t *, unw_regnum_t) LIBUNWIND_AVAIL;
19 extern int unw_is_signal_frame(unw_cursor_t *) LIBUNWIND_AVAIL;
20 extern int unw_get_proc_name(unw_cursor_t *, char *, size_t, unw_word_t *) LIBUNWIND_AVAIL;
21 //extern int unw_get_save_loc(unw_cursor_t*, int, unw_save_loc_t*);
22+extern int unw_backtrace(void **, int) LIBUNWIND_AVAIL;
23
24 extern unw_addr_space_t unw_local_addr_space;
25
26diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp
27index 217dde909863..5797c806c084 100644
28--- a/libunwind/src/libunwind.cpp
29+++ b/libunwind/src/libunwind.cpp
30@@ -432,6 +432,26 @@ int __unw_remove_find_dynamic_unwind_sections(
31
32 #endif // __APPLE__
33
34+int unw_backtrace(void **buffer, int size) {
35+ unw_context_t context;
36+ unw_cursor_t cursor;
37+ if (unw_getcontext(&context) || unw_init_local(&cursor, &context)) {
38+ return 0;
39+ }
40+
41+ unw_word_t ip;
42+ int current = 0;
43+ while (unw_step(&cursor) > 0) {
44+ if (current >= size || unw_get_reg(&cursor, UNW_REG_IP, &ip)) {
45+ break;
46+ }
47+
48+ buffer[current++] = reinterpret_cast<void *>(static_cast<uintptr_t>(ip));
49+ }
50+
51+ return current;
52+}
53+
54 // Add logging hooks in Debug builds only
55 #ifndef NDEBUG
56 #include <stdlib.h>
diff --git a/recipes-devtools/clang/clang/0025-clang-Do-not-use-install-relative-libc-headers.patch b/recipes-devtools/clang/clang/0025-clang-Do-not-use-install-relative-libc-headers.patch
deleted file mode 100644
index 0e4a3b3..0000000
--- a/recipes-devtools/clang/clang/0025-clang-Do-not-use-install-relative-libc-headers.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From b759741be82cc87406f5b7ece236617ad5450e78 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 11 Aug 2021 18:37:11 -0700
4Subject: [PATCH] clang: Do not use install relative libc++ headers
5
6In OE we use same clang for native and cross builds, therefore we need
7to ensure that native sysroot install of libc++ is not searched for
8headers when doing cross compile instead it searches the target sysroot
9this is especially troublesome when libcxx-native is staged along with
10libcxx e.g. chromium
11
12Upstream-Status: Pending
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 clang/lib/Driver/ToolChains/Gnu.cpp | 5 ++++-
16 1 file changed, 4 insertions(+), 1 deletion(-)
17
18diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
19index 185ea3df16f5..d883dc3e7558 100644
20--- a/clang/lib/Driver/ToolChains/Gnu.cpp
21+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
22@@ -3313,8 +3313,11 @@ Generic_GCC::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
23 // incompatible with the NDK libraries.
24 SmallString<128> DriverIncludeDir(getDriver().Dir);
25 llvm::sys::path::append(DriverIncludeDir, "..", "include");
26+
27+ // do not add it when --sysroot is specified, since it would expect
28+ // libc++ headers from sysroot and not relative to compiler install location
29 if (AddIncludePath(DriverIncludeDir,
30- /*TargetDirRequired=*/getTriple().isAndroid()))
31+ /*TargetDirRequired=*/getTriple().isAndroid() | !computeSysRoot().empty()))
32 return;
33 // If this is a development, non-installed, clang, libcxx will
34 // not be found at ../include/c++ but it likely to be found at
diff --git a/recipes-devtools/clang/clang/0026-clang-Fix-how-driver-finds-GCC-installation-path-on-.patch b/recipes-devtools/clang/clang/0026-clang-Fix-how-driver-finds-GCC-installation-path-on-.patch
deleted file mode 100644
index 7ceccd5..0000000
--- a/recipes-devtools/clang/clang/0026-clang-Fix-how-driver-finds-GCC-installation-path-on-.patch
+++ /dev/null
@@ -1,113 +0,0 @@
1From c95b551389ae1622faf630be3ddaf0dc62892595 Mon Sep 17 00:00:00 2001
2From: David Abdurachmanov <david.abdurachmanov@sifive.com>
3Date: Wed, 20 Oct 2021 17:30:36 -0700
4Subject: [PATCH] clang: Fix how driver finds GCC installation path on
5 OpenEmbedded
6
7Fix how Clang Driver finds GCC installation path on OpenEmbedded
8
9- For RISCV (riscv{32,64}) we define new two multi-lib options without any
10 subdirectories (e.g., lib32/ilp32d or lib64/lp64d). OpenEmbedded GCC
11 builds don't use them.
12- Modify how Clang Driver finds GCC installation path. This is important
13 because GCC files on OpenEmbedded are in two different directories:
14 (1) /usr/bin/../lib/gcc/riscv64-oe-linux/9.2.0
15 (2) /usr/lib/riscv64-oe-linux/9.2.0
16
17Clang Driver will check (1) first. The directory exist, but will produce
18no valid multi-libs and there will be no multi-lib selected. (2) contains
19actual GCC run-time objects/libraries, but because the path has exact
20same GCC version (9.2.0) it will be skipped.
21
22We modify the approach by allowing to check other directories with the same
23GCC version. We also avoid picking GCC installation path if it results in
24an empty multi-lib list.
25
26Upstream-Status: Pending
27Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29---
30 clang/lib/Driver/ToolChains/Gnu.cpp | 57 ++++++++++++++++++++---------
31 1 file changed, 39 insertions(+), 18 deletions(-)
32
33diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
34index d883dc3e7558..c627602827c3 100644
35--- a/clang/lib/Driver/ToolChains/Gnu.cpp
36+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
37@@ -1909,23 +1909,38 @@ static void findRISCVMultilibs(const Driver &D,
38 return findRISCVBareMetalMultilibs(D, TargetTriple, Path, Args, Result);
39
40 FilterNonExistent NonExistent(Path, "/crtbegin.o", D.getVFS());
41- MultilibBuilder Ilp32 =
42- MultilibBuilder("lib32/ilp32").flag("-m32").flag("-mabi=ilp32");
43- MultilibBuilder Ilp32f =
44- MultilibBuilder("lib32/ilp32f").flag("-m32").flag("-mabi=ilp32f");
45- MultilibBuilder Ilp32d =
46- MultilibBuilder("lib32/ilp32d").flag("-m32").flag("-mabi=ilp32d");
47- MultilibBuilder Lp64 =
48- MultilibBuilder("lib64/lp64").flag("-m64").flag("-mabi=lp64");
49- MultilibBuilder Lp64f =
50- MultilibBuilder("lib64/lp64f").flag("-m64").flag("-mabi=lp64f");
51- MultilibBuilder Lp64d =
52- MultilibBuilder("lib64/lp64d").flag("-m64").flag("-mabi=lp64d");
53- MultilibSet RISCVMultilibs =
54- MultilibSetBuilder()
55- .Either({Ilp32, Ilp32f, Ilp32d, Lp64, Lp64f, Lp64d})
56- .makeMultilibSet()
57- .FilterOut(NonExistent);
58+
59+ MultilibSet RISCVMultilibs;
60+
61+ if (TargetTriple.getVendor() == llvm::Triple::OpenEmbedded) {
62+ MultilibBuilder OpenEmbeddedIlp32d =
63+ MultilibBuilder("").flag("+m32").flag("+mabi=ilp32d");
64+ MultilibBuilder OpenEmbeddedLp64d =
65+ MultilibBuilder("").flag("+m64").flag("+mabi=lp64d");
66+ RISCVMultilibs =
67+ MultilibSetBuilder()
68+ .Either({OpenEmbeddedIlp32d, OpenEmbeddedLp64d})
69+ .makeMultilibSet()
70+ .FilterOut(NonExistent);
71+ } else {
72+ MultilibBuilder Ilp32 =
73+ MultilibBuilder("lib32/ilp32").flag("-m32").flag("-mabi=ilp32");
74+ MultilibBuilder Ilp32f =
75+ MultilibBuilder("lib32/ilp32f").flag("-m32").flag("-mabi=ilp32f");
76+ MultilibBuilder Ilp32d =
77+ MultilibBuilder("lib32/ilp32d").flag("-m32").flag("-mabi=ilp32d");
78+ MultilibBuilder Lp64 =
79+ MultilibBuilder("lib64/lp64").flag("-m64").flag("-mabi=lp64");
80+ MultilibBuilder Lp64f =
81+ MultilibBuilder("lib64/lp64f").flag("-m64").flag("-mabi=lp64f");
82+ MultilibBuilder Lp64d =
83+ MultilibBuilder("lib64/lp64d").flag("-m64").flag("-mabi=lp64d");
84+ RISCVMultilibs =
85+ MultilibSetBuilder()
86+ .Either({Ilp32, Ilp32f, Ilp32d, Lp64, Lp64f, Lp64d})
87+ .makeMultilibSet()
88+ .FilterOut(NonExistent);
89+ }
90
91 Multilib::flags_list Flags;
92 bool IsRV64 = TargetTriple.getArch() == llvm::Triple::riscv64;
93@@ -2945,13 +2960,19 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
94 continue; // Saw this path before; no need to look at it again.
95 if (CandidateVersion.isOlderThan(4, 1, 1))
96 continue;
97- if (CandidateVersion <= Version)
98+ if (CandidateVersion < Version)
99 continue;
100
101 if (!ScanGCCForMultilibs(TargetTriple, Args, LI->path(),
102 NeedsBiarchSuffix))
103 continue;
104
105+ // We might have found existing directory with GCCVersion, but it
106+ // might not have GCC libraries we are looking for (i.e. return an
107+ // empty Mulilibs)
108+ if (Multilibs.size() == 0)
109+ continue;
110+
111 Version = CandidateVersion;
112 GCCTriple.setTriple(CandidateTriple);
113 // FIXME: We hack together the directory name here instead of
diff --git a/recipes-devtools/clang/clang/0027-Fix-lib-paths-for-OpenEmbedded-Host.patch b/recipes-devtools/clang/clang/0027-Fix-lib-paths-for-OpenEmbedded-Host.patch
deleted file mode 100644
index 20ce278..0000000
--- a/recipes-devtools/clang/clang/0027-Fix-lib-paths-for-OpenEmbedded-Host.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1From 93855bad691059a81906ab632830239039527c6c Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Tue, 7 Dec 2021 04:08:22 +0000
4Subject: [PATCH] Fix lib paths for OpenEmbedded Host
5
6Under OpenEmbedded Host, while building with clang-native, it cannot find
7the GCCInstallPath, which causing following error:
8[snip]
9compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang
10-target x86_64-linux
11-isystem/path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/include
12-O2 -pipe
13/path/to/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/share/cmake-3.21/Modules/CMakeCCompilerABI.c`
14hosttools/ld: cannot find crtbeginS.o: No such file or directory
15[snip]
16
17Before this patch:
18compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang
19clang version 13.0.1 (https://github.com/llvm/llvm-project 08e3a5ccd952edee36b3c002e3a29c6b1b5153de)
20Target: x86_64-unknown-linux-gnu
21Thread model: posix
22InstalledDir: /build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
23Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.2.0
24
25After this patch:
26compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang
27clang version 13.0.1 (https://github.com/llvm/llvm-project 08e3a5ccd952edee36b3c002e3a29c6b1b5153de)
28Thread model: posix
29InstalledDir: /build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
30Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.2.0
31Found candidate GCC installation: /usr/lib/x86_64-wrs-linux/10.2.0
32Selected GCC installation: /usr/lib/x86_64-wrs-linux/10.2.0
33Candidate multilib: .;@m64
34Selected multilib: .;@m64
35
36Summary:
37For OpenEmbedded Host, sysroots are of the form<sysroot>/usr/lib/<triple>/x.y.z.
38Take x86-64 as example, the default triple is x86_64-unknown-linux-gnu.
39For clang-native, the target vendor is '-unknown', need to test current distro
40to follow above form.
41
42Upstream-Status: Inappropriate [oe specific]
43
44Signed-off-by: Changqing Li <changqing.li@windriver.com>
45Signed-off-by: Khem Raj <raj.khem@gmail.com>
46---
47 clang/lib/Driver/ToolChains/Gnu.cpp | 5 ++++-
48 1 file changed, 4 insertions(+), 1 deletion(-)
49
50diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
51index c627602827c3..98d979ace17b 100644
52--- a/clang/lib/Driver/ToolChains/Gnu.cpp
53+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
54@@ -19,6 +19,7 @@
55 #include "Linux.h"
56 #include "clang/Config/config.h" // for GCC_INSTALL_PREFIX
57 #include "clang/Driver/Compilation.h"
58+#include "clang/Driver/Distro.h"
59 #include "clang/Driver/Driver.h"
60 #include "clang/Driver/DriverDiagnostic.h"
61 #include "clang/Driver/MultilibBuilder.h"
62@@ -2918,6 +2919,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
63 const llvm::Triple &TargetTriple, const ArgList &Args,
64 const std::string &LibDir, StringRef CandidateTriple,
65 bool NeedsBiarchSuffix, bool GCCDirExists, bool GCCCrossDirExists) {
66+ Distro Distro(D.getVFS(), TargetTriple);
67 // Locations relative to the system lib directory where GCC's triple-specific
68 // directories might reside.
69 struct GCCLibSuffix {
70@@ -2935,7 +2937,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
71 // files in that location, not just GCC installation data.
72 {CandidateTriple.str(), "..",
73 TargetTriple.getVendor() == llvm::Triple::Freescale ||
74- TargetTriple.getVendor() == llvm::Triple::OpenEmbedded},
75+ TargetTriple.getVendor() == llvm::Triple::OpenEmbedded ||
76+ Distro.IsOpenEmbedded()},
77
78 // This is the normal place.
79 {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists},
diff --git a/recipes-devtools/clang/clang/0028-Correct-library-search-path-for-OpenEmbedded-Host.patch b/recipes-devtools/clang/clang/0028-Correct-library-search-path-for-OpenEmbedded-Host.patch
deleted file mode 100644
index 554f966..0000000
--- a/recipes-devtools/clang/clang/0028-Correct-library-search-path-for-OpenEmbedded-Host.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1From 42bf038560a9b0bf688b0a85cbd444445e1c26dc Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Tue, 7 Dec 2021 04:55:48 +0000
4Subject: [PATCH] Correct library search path for OpenEmbedded Host
5
6For OpenEmbedded Host, the gcc install path is
7/usr/lib/x86_64-[distroname]-linux/[gcc-version].
8So the library search path is not found with default triple
9'x86_64-linux-gnu' for x86_64. Causing following error:
10[snip]
11compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang
12-target x86_64-linux
13-isystem/path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/include
14-O2 -pipe
15/path/to/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/share/cmake-3.21/Modules/CMakeCCompilerABI.c`
16| /build/tmp-glibc/hosttools/ld: cannot find -lgcc
17| /build/tmp-glibc/hosttools/ld: cannot find -lgcc
18| clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
19[snip]
20
21before this patch:
22b59da142f2b0:$ /path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang --print-search-dirs
23programs: =/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
24libraries: =/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/lib/clang/13.0.1:/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/../lib://lib://usr/lib
25
26after this patch:
27b59da142f2b0:$ /path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang --print-search-dirs
28programs: =/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
29libraries: =/build/tmp-glibc/work/x84_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/lib/clang/13.0.1:/usr/lib/x86_64-wrs-linux/10.2.0://lib/x86_64-wrs-linux://usr/lib/x86_64-wrs-linux:/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/../lib://lib://usr/lib
30
31Upstream-Status: Inappropriate [oe specific]
32
33Signed-off-by: Changqing Li <changqing.li@windriver.com>
34Signed-off-by: Khem Raj <raj.khem@gmail.com>
35---
36 clang/include/clang/Driver/Distro.h | 2 ++
37 clang/lib/Driver/Distro.cpp | 1 +
38 clang/lib/Driver/ToolChains/Linux.cpp | 1 +
39 3 files changed, 4 insertions(+)
40
41diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
42index a8de94163e8b..847d6a3f9d1a 100644
43--- a/clang/include/clang/Driver/Distro.h
44+++ b/clang/include/clang/Driver/Distro.h
45@@ -45,6 +45,7 @@ public:
46 RHEL7,
47 Fedora,
48 Gentoo,
49+ //CLANG_EXTRA_OE_DISTRO_NAME
50 OpenSUSE,
51 UbuntuHardy,
52 UbuntuIntrepid,
53@@ -137,6 +138,7 @@ public:
54
55 bool IsGentoo() const { return DistroVal == Gentoo; }
56
57+ //CLANG_EXTRA_OE_DISTRO_CHECK
58 /// @}
59 };
60
61diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
62index a7e7f169dc14..48d4e15196da 100644
63--- a/clang/lib/Driver/Distro.cpp
64+++ b/clang/lib/Driver/Distro.cpp
65@@ -44,6 +44,7 @@ static Distro::DistroType DetectOsRelease(llvm::vfs::FileSystem &VFS) {
66 .Case("sles", Distro::OpenSUSE)
67 .Case("opensuse", Distro::OpenSUSE)
68 .Case("exherbo", Distro::Exherbo)
69+ //CLANG_EXTRA_OE_DISTRO_CASE
70 .Default(Distro::UnknownDistro);
71 return Version;
72 }
73diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
74index cf549331d255..699ff18b1240 100644
75--- a/clang/lib/Driver/ToolChains/Linux.cpp
76+++ b/clang/lib/Driver/ToolChains/Linux.cpp
77@@ -82,6 +82,7 @@ std::string Linux::getMultiarchTriple(const Driver &D,
78 return "x86_64-linux-android";
79 if (TargetEnvironment == llvm::Triple::GNUX32)
80 return "x86_64-linux-gnux32";
81+ //CLANG_EXTRA_OE_DISTRO_TRIPLE
82 return "x86_64-linux-gnu";
83 case llvm::Triple::aarch64:
84 if (IsAndroid)
diff --git a/recipes-devtools/clang/clang/0029-lldb-Link-with-libatomic-on-x86.patch b/recipes-devtools/clang/clang/0029-lldb-Link-with-libatomic-on-x86.patch
deleted file mode 100644
index cbc0549..0000000
--- a/recipes-devtools/clang/clang/0029-lldb-Link-with-libatomic-on-x86.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 0e9dd56bafb1273c784d357fca86a09f9ce02af2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Feb 2022 01:31:26 -0800
4Subject: [PATCH] lldb: Link with libatomic on x86
5
6cmake atomic check is not sufficient for i686 target where clang14 still
7generates __atomic_store calls but the check does not entail this
8function and happily thinks that compiler can resolve all atomic via intrinsics
9on i686, but thats not the case, ideally the check for determining
10atomic operation should be make more robust but until then lets ask to
11link with libatomic on i686/linux
12
13Upstream-Status: Inappropriate [OE-Specific]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 lldb/source/Utility/CMakeLists.txt | 4 ++++
17 1 file changed, 4 insertions(+)
18
19diff --git a/lldb/source/Utility/CMakeLists.txt b/lldb/source/Utility/CMakeLists.txt
20index a3b0a405b413..a68cfb503dfa 100644
21--- a/lldb/source/Utility/CMakeLists.txt
22+++ b/lldb/source/Utility/CMakeLists.txt
23@@ -19,6 +19,10 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
24 list(APPEND LLDB_SYSTEM_LIBS ws2_32 rpcrt4)
25 endif ()
26
27+if (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" AND CMAKE_SYSTEM_NAME MATCHES "Linux")
28+ list(APPEND LLDB_SYSTEM_LIBS atomic)
29+endif()
30+
31 if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
32 list(APPEND LLDB_SYSTEM_LIBS atomic)
33 endif()
diff --git a/recipes-devtools/clang/clang/0030-compiler-rt-Enable-__int128-for-ppc32.patch b/recipes-devtools/clang/clang/0030-compiler-rt-Enable-__int128-for-ppc32.patch
deleted file mode 100644
index 8619465..0000000
--- a/recipes-devtools/clang/clang/0030-compiler-rt-Enable-__int128-for-ppc32.patch
+++ /dev/null
@@ -1,73 +0,0 @@
1From 8ff4e362a824257f89cb77119fe8206667dd88ff Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 Mar 2022 16:28:16 -0800
4Subject: [PATCH] compiler-rt: Enable __int128 for ppc32
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 compiler-rt/lib/builtins/CMakeLists.txt | 15 +++++++--------
10 compiler-rt/lib/builtins/int_types.h | 2 +-
11 2 files changed, 8 insertions(+), 9 deletions(-)
12
13diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
14index 28ded8766f25..08495c491f08 100644
15--- a/compiler-rt/lib/builtins/CMakeLists.txt
16+++ b/compiler-rt/lib/builtins/CMakeLists.txt
17@@ -686,11 +686,9 @@ set(mips64_SOURCES ${GENERIC_TF_SOURCES}
18 set(mips64el_SOURCES ${GENERIC_TF_SOURCES}
19 ${mips_SOURCES})
20
21-set(powerpc_SOURCES ${GENERIC_SOURCES})
22-
23 set(powerpcspe_SOURCES ${GENERIC_SOURCES})
24
25-set(powerpc64_SOURCES
26+set(powerpc_SOURCES
27 ppc/divtc3.c
28 ppc/fixtfdi.c
29 ppc/fixunstfdi.c
30@@ -705,14 +703,15 @@ set(powerpc64_SOURCES
31 )
32 # These routines require __int128, which isn't supported on AIX.
33 if (NOT OS_NAME MATCHES "AIX")
34- set(powerpc64_SOURCES
35+ set(powerpc_SOURCES
36 ppc/floattitf.c
37 ppc/fixtfti.c
38 ppc/fixunstfti.c
39- ${powerpc64_SOURCES}
40+ ${powerpc_SOURCES}
41 )
42 endif()
43-set(powerpc64le_SOURCES ${powerpc64_SOURCES})
44+set(powerpc64le_SOURCES ${powerpc_SOURCES})
45+set(powerpc64_SOURCES ${powerpc_SOURCES})
46
47 set(riscv_SOURCES
48 riscv/fp_mode.c
49@@ -847,9 +846,9 @@ else ()
50 list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET)
51 endif()
52
53- # For RISCV32, we must force enable int128 for compiling long
54+ # For RISCV32/PPC32, we must force enable int128 for compiling long
55 # double routines.
56- if(COMPILER_RT_ENABLE_SOFTWARE_INT128 OR "${arch}" STREQUAL "riscv32")
57+ if(COMPILER_RT_ENABLE_SOFTWARE_INT128 OR "${arch}" STREQUAL "riscv32" OR "${arch}" STREQUAL "powerpc")
58 list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128)
59 endif()
60
61diff --git a/compiler-rt/lib/builtins/int_types.h b/compiler-rt/lib/builtins/int_types.h
62index ca97391fc284..6fa1dac2325f 100644
63--- a/compiler-rt/lib/builtins/int_types.h
64+++ b/compiler-rt/lib/builtins/int_types.h
65@@ -64,7 +64,7 @@ typedef union {
66 } udwords;
67
68 #if defined(__LP64__) || defined(__wasm__) || defined(__mips64) || \
69- defined(__SIZEOF_INT128__) || defined(_WIN64)
70+ defined(__SIZEOF_INT128__) || defined(_WIN64) || defined(__powerpc__)
71 #define CRT_HAS_128BIT
72 #endif
73
diff --git a/recipes-devtools/clang/clang/0031-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch b/recipes-devtools/clang/clang/0031-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch
deleted file mode 100644
index c51326f..0000000
--- a/recipes-devtools/clang/clang/0031-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch
+++ /dev/null
@@ -1,62 +0,0 @@
1From 39e87eabd251d5086ef14305a36134053af09ae5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 12 Aug 2022 11:50:57 -0700
4Subject: [PATCH] llvm: Do not use cmake infra to detect libzstd
5
6OE's version is build using plain make not cmake as a result we do not
7have the cmake support files and this probing method can get this info
8from build host and force linking with libzstd from /usr/lib which is
9not what we want when cross building.
10
11Fixes errors building llvm-config like
12/usr/lib/libzstd.so.1.5.2: error adding symbols: file in wrong
13format
14| clang-15: error: linker command failed with exit code 1 (use -v to see invocation)
15| ninja: build stopped: subcommand failed.
16
17Upstream-Status: Inappropriate [OE-Specific]
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 llvm/lib/Support/CMakeLists.txt | 8 ++++----
21 1 file changed, 4 insertions(+), 4 deletions(-)
22
23diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
24index e19223fdef4f..9c8af2404545 100644
25--- a/llvm/lib/Support/CMakeLists.txt
26+++ b/llvm/lib/Support/CMakeLists.txt
27@@ -22,7 +22,7 @@ if (HAS_WERROR_GLOBAL_CTORS)
28 endif()
29
30 if(LLVM_ENABLE_ZLIB)
31- list(APPEND imported_libs ZLIB::ZLIB)
32+ list(APPEND imported_libs z)
33 endif()
34
35 if(LLVM_ENABLE_ZSTD)
36@@ -34,7 +34,7 @@ if(LLVM_ENABLE_ZSTD)
37 endif()
38
39 if(LLVM_ENABLE_ZSTD)
40- list(APPEND imported_libs ${zstd_target})
41+ list(APPEND imported_libs zstd)
42 endif()
43
44 if( MSVC OR MINGW )
45@@ -306,7 +306,7 @@ if(LLVM_ENABLE_ZLIB)
46 get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION)
47 endif()
48 get_library_name(${zlib_library} zlib_library)
49- set(llvm_system_libs ${llvm_system_libs} "${zlib_library}")
50+ set(llvm_system_libs ${llvm_system_libs} z)
51 endif()
52
53 if(LLVM_ENABLE_ZSTD)
54@@ -319,7 +319,7 @@ if(LLVM_ENABLE_ZSTD)
55 get_property(zstd_library TARGET ${zstd_target} PROPERTY LOCATION)
56 endif()
57 get_library_name(${zstd_library} zstd_library)
58- set(llvm_system_libs ${llvm_system_libs} "${zstd_library}")
59+ set(llvm_system_libs ${llvm_system_libs} zstd)
60 endif()
61
62 if(LLVM_ENABLE_TERMINFO)
diff --git a/recipes-devtools/clang/clang/0032-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch b/recipes-devtools/clang/clang/0032-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch
deleted file mode 100644
index ec59ffa..0000000
--- a/recipes-devtools/clang/clang/0032-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From 7e735f7b956eca38c2d882f3630af9bfd215f652 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 3 Jan 2023 18:44:34 -0800
4Subject: [PATCH] compiler-rt: Fix stat struct's size for O32 ABI
5
6stat struct size differs on glibc based on ABI choices e.g. 64bit off_t
7and/or 64bit time_t will make this size different. Therefore separate
8out the O32 case out, makes it more readable.
9
10Upstream-Status: Pending
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 .../sanitizer_platform_limits_posix.h | 13 +++++++++++++
14 1 file changed, 13 insertions(+)
15
16diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
17index 34bfef1f7ef4..0ba5451c1ccf 100644
18--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
19+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
20@@ -98,11 +98,24 @@ const unsigned struct_kernel_stat64_sz = 104;
21 const unsigned struct_kernel_stat_sz = 144;
22 const unsigned struct_kernel_stat64_sz = 104;
23 #elif defined(__mips__)
24+#if defined(__mips_o32) // O32 ABI
25+#if _TIME_BITS == 64
26+const unsigned struct_kernel_stat_sz = 112;
27+const unsigned struct_kernel_stat64_sz = 112;
28+#elif _FILE_OFFSET_BITS == 64
29+const unsigned struct_kernel_stat_sz = 160;
30+const unsigned struct_kernel_stat64_sz = 160;
31+#else
32+const unsigned struct_kernel_stat_sz = 144;
33+const unsigned struct_kernel_stat64_sz = 160;
34+#endif
35+#else // __mips_o32
36 const unsigned struct_kernel_stat_sz =
37 SANITIZER_ANDROID
38 ? FIRST_32_SECOND_64(104, 128)
39 : FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 176 : 160, 216);
40 const unsigned struct_kernel_stat64_sz = 104;
41+#endif
42 #elif defined(__s390__) && !defined(__s390x__)
43 const unsigned struct_kernel_stat_sz = 64;
44 const unsigned struct_kernel_stat64_sz = 104;
diff --git a/recipes-devtools/clang/clang/0033-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch b/recipes-devtools/clang/clang/0033-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch
deleted file mode 100644
index 43cd05b..0000000
--- a/recipes-devtools/clang/clang/0033-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From cfeae6f76bbfc62bffca278aa8d58db3981ca100 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 21 Feb 2023 12:46:10 -0800
4Subject: [PATCH] compiler-rt: Undef _TIME_BITS along with _FILE_OFFSET_BITS in
5 sanitizers
6
7On 32bit systems using 64bit time_t build fails because
8_FILE_OFFSET_BITS is undefined here but _TIME_BITS is still set to 64
9
10Fixes
11In file included from compiler-rt/lib/sanitizer_common/sanitizer_procmaps_solaris.cpp:17:
12In file included from compiler-rt/lib/sanitizer_common/sanitizer_platform.h:25:
13In file included from /usr/include/features.h:393:
14/usr/include/features-time64.h:26:5: error: "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
15 ^
161 error generated.
17
18Upstream-Status: Submitted [https://reviews.llvm.org/D144514]
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 compiler-rt/lib/sanitizer_common/sanitizer_platform.h | 9 +++++++++
22 1 file changed, 9 insertions(+)
23
24diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
25index 596528155505..8f54ad70999c 100644
26--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
27+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h
28@@ -22,6 +22,15 @@
29 // function declarations into a .S file which doesn't compile.
30 // https://crbug.com/1162741
31 #if __has_include(<features.h>) && !defined(__ANDROID__)
32+// Some sources undefine _FILE_OFFSET_BITS deliberately e.g.
33+// sanitizer_procmaps_solaris.cpp. This is problematic on glibc systems with
34+// 32-bit architectures using 64-bit time_t and users passing _TIME_BITS=64
35+// from build environment, therefore both _FILE_OFFSET_BITS and _TIME_BITS
36+// need to be undefined together since features.h will check for both being 64
37+// if one is set to 64.
38+# if !defined(_FILE_OFFSET_BITS)
39+# undef _TIME_BITS
40+# endif
41 # include <features.h>
42 #endif
43
diff --git a/recipes-devtools/clang/clang/0034-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch b/recipes-devtools/clang/clang/0034-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch
deleted file mode 100644
index 90a6671..0000000
--- a/recipes-devtools/clang/clang/0034-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch
+++ /dev/null
@@ -1,81 +0,0 @@
1From 3d2fdb0ab98f479679231435cb3247cfbf9dfaab Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Thu, 31 Aug 2023 18:14:47 +0200
4Subject: [PATCH] ToolChains/Gnu.cpp: ARMLibDirs search also in lib32
5
6* in some strange multilib configs we build lib32-image where
7 32bit libs are in /usr/lib32 and 64bit in /usr/lib64 but in such
8 setup the clang search for GCC candidate installation doesn't
9 check lib32 directory in sysroot and fails to find the installation
10
11 X86LibDirs was already searching in lib32 for very long time:
12 https://github.com/llvm/llvm-project/commit/621fed5f5a051a0333415aaed75b8f2ed2350dbd
13 but ARMLibDirs didn't include it for some reason.
14
15* if we don't add lib32 for arm in getOSLibDir(), then it will
16 find -lgcc, crtbeginS.o, crtendS.o, but still fail to find
17 -lgcc_s, -lc, Scrt1.o, crti.o, crtn.o
18
19* fixes lib32-compiler-rt build failure:
20
21-- Configuring incomplete, errors occurred!
22CMake Error at TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native/usr/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message):
23 The C compiler
24
25 "TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native/usr/bin/arm-oemllib32-linux-gnueabi/arm-oemllib32-linux-gnueabi-clang"
26
27 is not able to compile a simple test program.
28
29 It fails with the following output:
30
31 Change Dir: TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build/CMakeFiles/CMakeScratch/TryCompile-rWXyQZ
32
33 Run Build Command(s):ninja -v cmTC_84d18 && [1/2] TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native/usr/bin/arm-oemllib32-linux-gnueabi/arm-oemllib32-linux-gnueabi-clang --target=arm-oemllib32-linux-gnueabi --sysroot=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot -target arm-oemllib32-linux-gnueabi -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=softfp -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -funwind-tables -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native= -fPIE -MD -MT CMakeFiles/cmTC_84d18.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_84d18.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_84d18.dir/testCCompiler.c.o -c TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build/CMakeFiles/CMakeScratch/TryCompile-rWXyQZ/testCCompiler.c
34 [2/2] : && TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native/usr/bin/arm-oemllib32-linux-gnueabi/arm-oemllib32-linux-gnueabi-clang --target=arm-oemllib32-linux-gnueabi --sysroot=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot -target arm-oemllib32-linux-gnueabi -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=softfp -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -funwind-tables -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native= -target arm-oemllib32-linux-gnueabi -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=softfp -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -funwind-tables -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native= -Wl,-z,relro,-z,now -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++ -fuse-ld=lld -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native= -Wl,-z,relro,-z,now -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++ -fuse-ld=lld CMakeFiles/cmTC_84d18.dir/testCCompiler.c.o -o cmTC_84d18 && :
35 FAILED: cmTC_84d18
36 : && TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native/usr/bin/arm-oemllib32-linux-gnueabi/arm-oemllib32-linux-gnueabi-clang --target=arm-oemllib32-linux-gnueabi --sysroot=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot -target arm-oemllib32-linux-gnueabi -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=softfp -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -funwind-tables -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native= -target arm-oemllib32-linux-gnueabi -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=softfp -mlittle-endian --dyld-prefix=/usr -Qunused-arguments -funwind-tables -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native= -Wl,-z,relro,-z,now -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++ -fuse-ld=lld -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work-shared/llvm-project-source-16.0.6-r0/git=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/build=/usr/src/debug/lib32-compiler-rt/16.0.6-r0 -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fmacro-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/lib32-recipe-sysroot= -fdebug-prefix-map=TOPDIR/BUILD/work/raspberrypi4_64-oemllib32-linux-gnueabi/lib32-compiler-rt/16.0.6/recipe-sysroot-native= -Wl,-z,relro,-z,now -unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++ -fuse-ld=lld CMakeFiles/cmTC_84d18.dir/testCCompiler.c.o -o cmTC_84d18 && :
37 arm-oemllib32-linux-gnueabi-ld.lld: error: cannot open Scrt1.o: No such file or directory
38 arm-oemllib32-linux-gnueabi-ld.lld: error: cannot open crti.o: No such file or directory
39 arm-oemllib32-linux-gnueabi-ld.lld: error: cannot open crtbeginS.o: No such file or directory
40 arm-oemllib32-linux-gnueabi-ld.lld: error: unable to find library -lgcc
41 arm-oemllib32-linux-gnueabi-ld.lld: error: unable to find library -lgcc_s
42 arm-oemllib32-linux-gnueabi-ld.lld: error: unable to find library -lc
43 arm-oemllib32-linux-gnueabi-ld.lld: error: unable to find library -lgcc
44 arm-oemllib32-linux-gnueabi-ld.lld: error: unable to find library -lgcc_s
45 arm-oemllib32-linux-gnueabi-ld.lld: error: cannot open crtendS.o: No such file or directory
46 arm-oemllib32-linux-gnueabi-ld.lld: error: cannot open crtn.o: No such file or directory
47 clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
48 ninja: build stopped: subcommand failed.
49
50Upstream-Status: Pending
51Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
52---
53 clang/lib/Driver/ToolChains/Gnu.cpp | 2 +-
54 clang/lib/Driver/ToolChains/Linux.cpp | 1 +
55 2 files changed, 2 insertions(+), 1 deletion(-)
56
57diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
58index 98d979ace17b..c5aed9b47123 100644
59--- a/clang/lib/Driver/ToolChains/Gnu.cpp
60+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
61@@ -2479,7 +2479,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
62 static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
63 "aarch64_be-linux-gnu"};
64
65- static const char *const ARMLibDirs[] = {"/lib"};
66+ static const char *const ARMLibDirs[] = {"/lib", "/lib32"};
67 static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
68 static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
69 "armv7hl-redhat-linux-gnueabi",
70diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
71index 699ff18b1240..4ed91b852562 100644
72--- a/clang/lib/Driver/ToolChains/Linux.cpp
73+++ b/clang/lib/Driver/ToolChains/Linux.cpp
74@@ -202,6 +202,7 @@ static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) {
75 // reasoning about oslibdir spellings with the lib dir spellings in the
76 // GCCInstallationDetector, but that is a more significant refactoring.
77 if (Triple.getArch() == llvm::Triple::x86 || Triple.isPPC32() ||
78+ Triple.getArch() == llvm::Triple::arm || Triple.getArch() == llvm::Triple::thumb ||
79 Triple.getArch() == llvm::Triple::sparc)
80 return "lib32";
81
diff --git a/recipes-devtools/clang/clang/0035-compiler-rt-Fix-cmake-check-for-_Float16-and-__bf16.patch b/recipes-devtools/clang/clang/0035-compiler-rt-Fix-cmake-check-for-_Float16-and-__bf16.patch
deleted file mode 100644
index c6115a0..0000000
--- a/recipes-devtools/clang/clang/0035-compiler-rt-Fix-cmake-check-for-_Float16-and-__bf16.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 34a65a1f0ff8bb2d41f32c229dc6b309a7566ecd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 1 Mar 2024 16:47:46 -0800
4Subject: [PATCH] compiler-rt: Fix cmake check for _Float16 and __bf16
5
6When using check_c_source_compiles cmake function, main has to be
7provided, otherwise while compile step will be fine but linking step
8will fail as there will be no main function and test will fail and
9disable building HF builtins into compiler-rt
10
11Fixes configure errors like below
12
13aarch64-yoe-linux-ld.lld: error: undefined symbol: main
14 referenced by start.S:81 (../sysdeps/aarch64/start.S:81)
15 /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/compiler-rt/18.1.0/recipe-sysroot/usr/lib/Scrt1.o:(_start)
16 referenced by start.S:82 (../sysdeps/aarch64/start.S:82)
17 /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/compiler-rt/18.1.0/recipe-sysroot/usr/lib/Scrt1.o:(_start)
18 aarch64-yoe-linux-clang: error: linker command failed with exit code 1 (use -v to see invocation)
19
20Upstream-Status: Submitted [https://github.com/kraj/llvm-project/pull/new/kraj/compiler-rt-float16]
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22---
23 compiler-rt/lib/builtins/CMakeLists.txt | 4 ++--
24 1 file changed, 2 insertions(+), 2 deletions(-)
25
26diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
27index 08495c491f08..bff96ba10bcd 100644
28--- a/compiler-rt/lib/builtins/CMakeLists.txt
29+++ b/compiler-rt/lib/builtins/CMakeLists.txt
30@@ -827,10 +827,10 @@ else ()
31 endif()
32 endif()
33 endif()
34- check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }"
35+ check_c_source_compiles("_Float16 foo(_Float16 x) { return x; } int main(void) { return foo(1.0); }"
36 COMPILER_RT_HAS_${arch}_FLOAT16)
37 append_list_if(COMPILER_RT_HAS_${arch}_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS_${arch})
38- check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }"
39+ check_c_source_compiles("__bf16 foo(__bf16 x) { return x; } int main(void) { return foo(1.0); }"
40 COMPILER_RT_HAS_${arch}_BFLOAT16)
41 # Build BF16 files only when "__bf16" is available.
42 if(COMPILER_RT_HAS_${arch}_BFLOAT16)
diff --git a/recipes-devtools/clang/clang/libunwind.pc.in b/recipes-devtools/clang/clang/libunwind.pc.in
deleted file mode 100644
index a93d676..0000000
--- a/recipes-devtools/clang/clang/libunwind.pc.in
+++ /dev/null
@@ -1,9 +0,0 @@
1prefix=/usr
2exec_prefix=/usr
3libdir=@LIBDIR@
4includedir=/usr/include
5
6Name: libunwind
7Description: libunwind base library
8Version: @VERSION@
9Libs: -lunwind
diff --git a/recipes-devtools/clang/clang/llvm-config b/recipes-devtools/clang/clang/llvm-config
deleted file mode 100644
index 6a0dd54..0000000
--- a/recipes-devtools/clang/clang/llvm-config
+++ /dev/null
@@ -1,52 +0,0 @@
1#!/bin/bash
2#
3# Wrapper script for llvm-config. Supplies the right environment variables
4# for the target and delegates to the native llvm-config for anything else. This
5# is needed because arguments like --ldflags, --cxxflags, etc. are set by the
6# native compile rather than the target compile.
7#
8SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
9NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)"
10export YOCTO_ALTERNATE_EXE_PATH="${YOCTO_ALTERNATE_EXE_PATH:="$(readlink -f "$SCRIPT_DIR/../llvm-config")"}"
11if [ -n "$( echo $base_libdir | sed -n '/lib64/p')" ]; then
12 export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib64"}"
13else
14 export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib"}"
15fi
16if [[ $# == 0 ]]; then
17 exec "$NEXT_LLVM_CONFIG"
18fi
19
20remain=""
21output=""
22for arg in "$@"; do
23 case "$arg" in
24 --cppflags)
25 output="${output} ${CPPFLAGS}"
26 ;;
27 --cflags)
28 output="${output} ${CFLAGS}"
29 ;;
30 --cxxflags)
31 output="${output} ${CXXFLAGS}"
32 ;;
33 --ldflags)
34 output="${output} ${LDFLAGS}"
35 ;;
36 --shared-mode)
37 output="${output} shared"
38 ;;
39 --link-shared)
40 break
41 ;;
42 *)
43 remain="${remain} ${arg}"
44 ;;
45 esac
46done
47
48if [ "${remain}" != "" ]; then
49 output="${output} "$("$NEXT_LLVM_CONFIG" ${remain})
50fi
51
52echo "${output}"
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb
deleted file mode 100644
index 2891a3a..0000000
--- a/recipes-devtools/clang/clang_git.bb
+++ /dev/null
@@ -1,451 +0,0 @@
1# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "LLVM based C/C++ compiler"
5HOMEPAGE = "http://clang.llvm.org/"
6SECTION = "devel"
7
8require clang.inc
9require common-source.inc
10
11INHIBIT_DEFAULT_DEPS = "1"
12
13BUILD_CC:class-nativesdk = "clang"
14BUILD_CXX:class-nativesdk = "clang++"
15BUILD_AR:class-nativesdk = "llvm-ar"
16BUILD_RANLIB:class-nativesdk = "llvm-ranlib"
17BUILD_NM:class-nativesdk = "llvm-nm"
18LDFLAGS:remove:class-nativesdk = "-fuse-ld=lld"
19
20LDFLAGS:append:class-target:riscv32 = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
21LDFLAGS:append:class-target:mips = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
22
23inherit cmake cmake-native pkgconfig python3native python3targetconfig
24
25OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"
26
27def get_clang_experimental_arch(bb, d, arch_var):
28 import re
29 a = d.getVar(arch_var, True)
30 return ""
31
32def get_clang_arch(bb, d, arch_var):
33 import re
34 a = d.getVar(arch_var, True)
35 if re.match('(i.86|athlon|x86.64)$', a): return 'X86'
36 elif re.match('arm$', a): return 'ARM'
37 elif re.match('armeb$', a): return 'ARM'
38 elif re.match('aarch64$', a): return 'AArch64'
39 elif re.match('aarch64_be$', a): return 'AArch64'
40 elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips'
41 elif re.match('riscv32$', a): return 'riscv32'
42 elif re.match('riscv64$', a): return 'riscv64'
43 elif re.match('p(pc|owerpc)(|64)', a): return 'PowerPC'
44 elif re.match('loongarch64$', a): return 'loongarch64'
45 else:
46 bb.note("'%s' is not a primary llvm architecture" % a)
47 return ""
48
49def get_clang_host_arch(bb, d):
50 return get_clang_arch(bb, d, 'HOST_ARCH')
51
52def get_clang_target_arch(bb, d):
53 return get_clang_arch(bb, d, 'TARGET_ARCH')
54
55def get_clang_experimental_target_arch(bb, d):
56 return get_clang_experimental_arch(bb, d, 'TARGET_ARCH')
57
58PACKAGECONFIG_CLANG_COMMON = "eh libedit rtti shared-libs \
59 ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'compiler-rt libcplusplus libomp unwindlib', '', d)} \
60 "
61
62PACKAGECONFIG ??= "compiler-rt libcplusplus lldb-wchar terminfo \
63 ${PACKAGECONFIG_CLANG_COMMON} \
64 ${@bb.utils.filter('DISTRO_FEATURES', 'lto thin-lto', d)} \
65 "
66PACKAGECONFIG:class-native = "clangd \
67 ${PACKAGECONFIG_CLANG_COMMON} \
68 "
69PACKAGECONFIG:class-nativesdk = "clangd \
70 ${PACKAGECONFIG_CLANG_COMMON} \
71 ${@bb.utils.filter('DISTRO_FEATURES', 'lto thin-lto', d)} \
72 "
73
74PACKAGECONFIG[bootstrap] = "-DCLANG_ENABLE_BOOTSTRAP=On -DCLANG_BOOTSTRAP_PASSTHROUGH='${PASSTHROUGH}' -DBOOTSTRAP_LLVM_ENABLE_LTO=Thin -DBOOTSTRAP_LLVM_ENABLE_LLD=ON,,,"
75PACKAGECONFIG[clangd] = "-DCLANG_ENABLE_CLANGD=ON,-DCLANG_ENABLE_CLANGD=OFF,,"
76PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,"
77PACKAGECONFIG[eh] = "-DLLVM_ENABLE_EH=ON,-DLLVM_ENABLE_EH=OFF,,"
78PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,"
79PACKAGECONFIG[libedit] = "-DLLVM_ENABLE_LIBEDIT=ON -DLLDB_ENABLE_LIBEDIT=ON,-DLLVM_ENABLE_LIBEDIT=OFF -DLLDB_ENABLE_LIBEDIT=OFF,libedit libedit-native"
80PACKAGECONFIG[libomp] = "-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp,,"
81PACKAGECONFIG[lldb-lua] = "-DLLDB_ENABLE_LUA=ON,-DLLDB_ENABLE_LUA=OFF,lua"
82PACKAGECONFIG[lldb-wchar] = "-DLLDB_EDITLINE_USE_WCHAR=1,-DLLDB_EDITLINE_USE_WCHAR=0,"
83PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
84PACKAGECONFIG[pfm] = "-DLLVM_ENABLE_LIBPFM=ON,-DLLVM_ENABLE_LIBPFM=OFF,libpfm,"
85PACKAGECONFIG[rtti] = "-DLLVM_ENABLE_RTTI=ON,-DLLVM_ENABLE_RTTI=OFF,,"
86PACKAGECONFIG[shared-libs] = "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON,,,"
87PACKAGECONFIG[split-dwarf] = "-DLLVM_USE_SPLIT_DWARF=ON,-DLLVM_USE_SPLIT_DWARF=OFF,,"
88PACKAGECONFIG[terminfo] = "-DLLVM_ENABLE_TERMINFO=ON -DCOMPILER_RT_TERMINFO_LIB=ON,-DLLVM_ENABLE_TERMINFO=OFF -DCOMPILER_RT_TERMINFO_LIB=OFF,ncurses,"
89PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
90PACKAGECONFIG[unwindlib] = "-DCLANG_DEFAULT_UNWINDLIB=libunwind,-DCLANG_DEFAULT_UNWINDLIB=libgcc,,"
91
92OECMAKE_SOURCEPATH = "${S}/llvm"
93
94OECMAKE_TARGET_COMPILE = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', 'stage2', 'all', d)}"
95OECMAKE_TARGET_INSTALL = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', 'stage2-install', 'install', d)}"
96BINPATHPREFIX = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', '/tools/clang/stage2-bins/NATIVE', '', d)}"
97
98PASSTHROUGH = "\
99CLANG_DEFAULT_RTLIB;CLANG_DEFAULT_CXX_STDLIB;LLVM_BUILD_LLVM_DYLIB;LLVM_LINK_LLVM_DYLIB;\
100LLVM_ENABLE_ASSERTIONS;LLVM_ENABLE_EXPENSIVE_CHECKS;LLVM_ENABLE_PIC;\
101LLVM_BINDINGS_LIST;LLVM_ENABLE_FFI;FFI_INCLUDE_DIR;LLVM_OPTIMIZED_TABLEGEN;\
102LLVM_ENABLE_RTTI;LLVM_ENABLE_EH;LLVM_BUILD_EXTERNAL_COMPILER_RT;CMAKE_SYSTEM_NAME;\
103CMAKE_BUILD_TYPE;BUILD_SHARED_LIBS;LLVM_ENABLE_PROJECTS;LLVM_BINUTILS_INCDIR;\
104LLVM_TARGETS_TO_BUILD;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;PYTHON_EXECUTABLE;\
105PYTHON_LIBRARY;PYTHON_INCLUDE_DIR;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;LLDB_EDITLINE_USE_WCHAR;\
106LLVM_ENABLE_LIBEDIT;LLDB_ENABLE_LIBEDIT;LLDB_PYTHON_RELATIVE_PATH;LLDB_PYTHON_EXE_RELATIVE_PATH;\
107LLDB_PYTHON_EXT_SUFFIX;CMAKE_C_FLAGS_RELEASE;CMAKE_CXX_FLAGS_RELEASE;CMAKE_ASM_FLAGS_RELEASE;\
108CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;CLANG_DEFAULT_UNWINDLIB;\
109CLANG_DEFAULT_OPENMP_RUNTIME;LLVM_ENABLE_PER_TARGET_RUNTIME_DIR;\
110LLVM_BUILD_TOOLS;LLVM_USE_HOST_TOOLS;LLVM_CONFIG_PATH;\
111"
112#
113# Default to build all OE-Core supported target arches (user overridable).
114# Gennerally setting LLVM_TARGETS_TO_BUILD = "" in local.conf is ok in most simple situations
115# where only one target architecture is needed along with just one build arch (usually X86)
116#
117LLVM_TARGETS_TO_BUILD ?= "AMDGPU;AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86;LoongArch"
118
119LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ?= ""
120LLVM_EXPERIMENTAL_TARGETS_TO_BUILD:append = ";${@get_clang_experimental_target_arch(bb, d)}"
121
122HF = ""
123HF:class-target = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
124HF[vardepvalue] = "${HF}"
125
126LLVM_PROJECTS ?= "clang;clang-tools-extra;lld${LLDB}"
127LLDB ?= ";lldb"
128# LLDB support for RISCV/Mips32 does not work yet
129LLDB:riscv32 = ""
130LLDB:riscv64 = ""
131LLDB:mips = ""
132LLDB:mipsel = ""
133LLDB:powerpc = ""
134
135# linux hosts (.so) on Windows .pyd
136SOLIBSDEV:mingw32 = ".pyd"
137
138#CMAKE_VERBOSE = "VERBOSE=1"
139
140EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
141 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
142 -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
143 -DLLVM_ENABLE_PIC=ON \
144 -DCLANG_DEFAULT_PIE_ON_LINUX=ON \
145 -DLLVM_BINDINGS_LIST='' \
146 -DLLVM_ENABLE_FFI=ON \
147 -DLLVM_ENABLE_ZSTD=ON \
148 -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
149 -DLLVM_OPTIMIZED_TABLEGEN=ON \
150 -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
151 -DCMAKE_SYSTEM_NAME=Linux \
152 -DCMAKE_BUILD_TYPE=Release \
153 -DCMAKE_CXX_FLAGS_RELEASE='${CXXFLAGS} -DNDEBUG -g0' \
154 -DCMAKE_C_FLAGS_RELEASE='${CFLAGS} -DNDEBUG -g0' \
155 -DBUILD_SHARED_LIBS=OFF \
156 -DLLVM_ENABLE_PROJECTS='${LLVM_PROJECTS}' \
157 -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR} \
158 -DLLVM_VERSION_SUFFIX='${VER_SUFFIX}' \
159 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
160 -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD}' \
161 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}' \
162"
163
164EXTRA_OECMAKE:append:class-native = "\
165 -DPYTHON_EXECUTABLE='${PYTHON}' \
166"
167EXTRA_OECMAKE:append:class-nativesdk = "\
168 -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \
169 -DLLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON} \
170 -DLLDB_PYTHON_EXT_SUFFIX=${SOLIBSDEV} \
171 -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain-native.cmake' \
172 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
173 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
174 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
175 -DCMAKE_STRIP=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-strip \
176 -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \
177 -DLLVM_HEADERS_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-min-tblgen \
178 -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \
179 -DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \
180 -DLLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON} \
181 -DLLDB_PYTHON_EXT_SUFFIX=${SOLIBSDEV} \
182 -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \
183 -DPYTHON_EXECUTABLE='${PYTHON}' \
184"
185EXTRA_OECMAKE:append:class-target = "\
186 -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \
187 -DLLVM_HEADERS_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-min-tblgen \
188 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
189 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
190 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
191 -DCMAKE_STRIP=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-strip \
192 -DLLVM_TARGET_ARCH=${@get_clang_target_arch(bb, d)} \
193 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_SYS}${HF} \
194 -DLLVM_HOST_TRIPLE=${TARGET_SYS}${HF} \
195 -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \
196 -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \
197 -DLLVM_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
198 -DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \
199 -DLLDB_PYTHON_EXE_RELATIVE_PATH=${bindir} \
200 -DLLDB_PYTHON_EXT_SUFFIX=${SOLIBSDEV} \
201"
202
203DEPENDS = "binutils zlib zstd libffi libxml2 libxml2-native ninja-native swig-native"
204DEPENDS:append:class-nativesdk = " clang-crosssdk-${SDK_ARCH} virtual/${TARGET_PREFIX}binutils nativesdk-python3"
205DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} python3 compiler-rt libcxx"
206
207RRECOMMENDS:${PN} = "binutils"
208RRECOMMENDS:${PN}:append:class-target = " libcxx-dev"
209
210# patch out build host paths for reproducibility
211do_compile:prepend:class-target() {
212 sed -i -e "s,${STAGING_DIR_NATIVE},,g" \
213 -e "s,${STAGING_DIR_TARGET},,g" \
214 -e "s,${S},,g" \
215 -e "s,${B},,g" \
216 ${B}/tools/llvm-config/BuildVariables.inc
217}
218
219do_install:append() {
220 rm -rf ${D}${libdir}/python*/site-packages/six.py
221}
222
223do_install:append:class-target () {
224 # Allow bin path to change based on YOCTO_ALTERNATE_EXE_PATH
225 sed -i 's;${_IMPORT_PREFIX}/bin;${_IMPORT_PREFIX_BIN};g' ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake
226
227 # Insert function to populate Import Variables
228 sed -i "4i\
229if(DEFINED ENV{YOCTO_ALTERNATE_EXE_PATH})\n\
230 execute_process(COMMAND \"llvm-config\" \"--bindir\" OUTPUT_VARIABLE _IMPORT_PREFIX_BIN OUTPUT_STRIP_TRAILING_WHITESPACE)\n\
231else()\n\
232 set(_IMPORT_PREFIX_BIN \"\${_IMPORT_PREFIX}/bin\")\n\
233endif()\n" ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake
234
235 if [ -n "${LLVM_LIBDIR_SUFFIX}" ]; then
236 mkdir -p ${D}${nonarch_libdir}
237 mv ${D}${libdir}/clang ${D}${nonarch_libdir}/clang
238 ln -rs ${D}${nonarch_libdir}/clang ${D}${libdir}/clang
239 rmdir --ignore-fail-on-non-empty ${D}${libdir}
240 fi
241 for t in clang clang++ llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \
242 llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov; do
243 ln -sf $t ${D}${bindir}/${TARGET_PREFIX}$t
244 done
245
246 # reproducibility
247 sed -i -e 's,${B},,g' ${D}${libdir}/cmake/llvm/LLVMConfig.cmake
248}
249
250do_install:append:class-native () {
251 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
252 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer
253 fi
254 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-pseudo-gen ${D}${bindir}/clang-pseudo-gen
255 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen
256 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
257 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/lldb-tblgen ${D}${bindir}/lldb-tblgen
258 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/llvm-min-tblgen ${D}${bindir}/llvm-min-tblgen
259 for f in `find ${D}${bindir} -executable -type f -not -type l`; do
260 test -n "`file -b $f|grep -i ELF`" && ${STRIP} $f
261 echo "stripped $f"
262 done
263 ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV}
264 ln -sf llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
265 ln -sf llvm-config ${D}${bindir}/llvm-config${PV}
266}
267
268do_install:append:class-nativesdk () {
269 sed -i -e "s|${B}/./bin/||g" ${D}${libdir}/cmake/llvm/LLVMConfig.cmake
270 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
271 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer
272 fi
273 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
274 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-pseudo-gen ${D}${bindir}/clang-pseudo-gen
275 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen
276 for f in `find ${D}${bindir} -executable -type f -not -type l`; do
277 test -n "`file -b $f|grep -i ELF`" && ${STRIP} $f
278 done
279 ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV}
280 ln -sf llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
281 ln -sf llvm-config ${D}${bindir}/llvm-config${PV}
282 rm -rf ${D}${datadir}/llvm/cmake
283 rm -rf ${D}${datadir}/llvm
284}
285
286PACKAGES =+ "${PN}-libllvm ${PN}-lldb-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools \
287 libclang lldb lldb-server liblldb llvm-linker-tools"
288
289BBCLASSEXTEND = "native nativesdk"
290
291RDEPENDS:lldb += "${PN}-lldb-python lldb-server"
292
293RDEPENDS:${PN}-tools += "\
294 perl-module-digest-md5 \
295 perl-module-file-basename \
296 perl-module-file-copy \
297 perl-module-file-find \
298 perl-module-file-path \
299 perl-module-findbin \
300 perl-module-hash-util \
301 perl-module-sys-hostname \
302 perl-module-term-ansicolor \
303"
304
305RRECOMMENDS:${PN}-tidy += "${PN}-tools"
306
307FILES:llvm-linker-tools = "${libdir}/LLVMgold* ${libdir}/libLTO.so.* ${libdir}/LLVMPolly*"
308
309FILES:${PN}-libclang-cpp = "${libdir}/libclang-cpp.so.*"
310
311FILES:${PN}-lldb-python = "${libdir}/python*/site-packages/lldb/*"
312
313FILES:${PN}-tidy = "${bindir}/*clang-tidy*"
314FILES:${PN}-format = "${bindir}/*clang-format*"
315
316FILES:${PN}-tools = "${bindir}/analyze-build \
317 ${bindir}/c-index-test \
318 ${bindir}/clang-apply-replacements \
319 ${bindir}/clang-change-namespace \
320 ${bindir}/clang-check \
321 ${bindir}/clang-doc \
322 ${bindir}/clang-extdef-mapping \
323 ${bindir}/clang-include-fixer \
324 ${bindir}/clang-linker-wrapper \
325 ${bindir}/clang-move \
326 ${bindir}/clang-nvlink-wrapper \
327 ${bindir}/clang-offload-bundler \
328 ${bindir}/clang-offload-packager \
329 ${bindir}/clang-pseudo \
330 ${bindir}/clang-query \
331 ${bindir}/clang-refactor \
332 ${bindir}/clang-rename \
333 ${bindir}/clang-reorder-fields \
334 ${bindir}/clang-repl \
335 ${bindir}/clang-scan-deps \
336 ${bindir}/diagtool \
337 ${bindir}/find-all-symbols \
338 ${bindir}/hmaptool \
339 ${bindir}/hwasan_symbolize \
340 ${bindir}/intercept-build \
341 ${bindir}/modularize \
342 ${bindir}/pp-trace \
343 ${bindir}/sancov \
344 ${bindir}/scan-build \
345 ${bindir}/scan-build-py \
346 ${bindir}/scan-view \
347 ${bindir}/split-file \
348 ${libdir}/libscanbuild/* \
349 ${libdir}/libear/* \
350 ${libexecdir}/analyze-c++ \
351 ${libexecdir}/analyze-cc \
352 ${libexecdir}/c++-analyzer \
353 ${libexecdir}/ccc-analyzer \
354 ${libexecdir}/intercept-c++ \
355 ${libexecdir}/intercept-cc \
356 ${datadir}/scan-build/* \
357 ${datadir}/scan-view/* \
358 ${datadir}/opt-viewer/* \
359 ${datadir}/clang/* \
360"
361
362FILES:${PN} += "\
363 ${bindir}/clang-cl \
364 ${libdir}/BugpointPasses.so \
365 ${libdir}/LLVMHello.so \
366 ${libdir}/*Plugin.so \
367 ${libdir}/${BPN} \
368 ${nonarch_libdir}/${BPN}/*/include/ \
369"
370
371FILES:lldb = "\
372 ${bindir}/lldb \
373 ${bindir}/lldb-argdumper \
374 ${bindir}/lldb-instr \
375 ${bindir}/lldb-vscode \
376"
377
378FILES:lldb-server = "\
379 ${bindir}/lldb-server \
380"
381
382FILES:liblldb = "\
383 ${libdir}/liblldbIntelFeatures.so.* \
384 ${libdir}/liblldb.so.* \
385"
386
387FILES:${PN}-libllvm =+ "\
388 ${libdir}/libLLVM.so.${MAJOR_VER}.${MINOR_VER} \
389 ${libdir}/libLLVM-${MAJOR_VER}.so \
390 ${libdir}/libRemarks.so.* \
391"
392
393FILES:libclang = "\
394 ${libdir}/libclang.so.* \
395"
396
397FILES:${PN}-dev += "\
398 ${datadir}/llvm/cmake \
399 ${libdir}/cmake \
400 ${nonarch_libdir}/libear \
401 ${nonarch_libdir}/${BPN}/*.la \
402"
403
404FILES:${PN}-staticdev += "${nonarch_libdir}/${BPN}/*.a"
405
406FILES:${PN}-staticdev:remove = "${libdir}/${BPN}/*.a"
407FILES:${PN}-dev:remove = "${libdir}/${BPN}/*.la"
408FILES:${PN}:remove = "${libdir}/${BPN}/*"
409
410
411INSANE_SKIP:${PN} += "already-stripped"
412#INSANE_SKIP:${PN}-dev += "dev-elf"
413INSANE_SKIP:${PN}-lldb-python += "dev-so dev-deps"
414INSANE_SKIP:${MLPREFIX}liblldb = "dev-so"
415INSANE_SKIP:${PN}-libllvm = "dev-so"
416
417#Avoid SSTATE_SCAN_COMMAND running sed over llvm-config.
418SSTATE_SCAN_FILES:remove = "*-config"
419
420TOOLCHAIN = "clang"
421TOOLCHAIN:class-native = "gcc"
422TOOLCHAIN:class-nativesdk = "clang"
423COMPILER_RT:class-nativesdk:toolchain-clang:runtime-llvm = "-rtlib=libgcc --unwindlib=libgcc"
424LIBCPLUSPLUS:class-nativesdk:toolchain-clang:runtime-llvm = "-stdlib=libstdc++"
425
426SYSROOT_DIRS:append:class-target = " ${nonarch_libdir}"
427
428SYSROOT_PREPROCESS_FUNCS:append:class-target = " clang_sysroot_preprocess"
429
430clang_sysroot_preprocess() {
431 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
432 install -m 0755 ${S}/../llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
433 ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
434 # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to
435 install -d ${SYSROOT_DESTDIR}${bindir}
436
437 binaries="lld diagtool clang-${MAJOR_VER} clang-format clang-offload-packager
438 clang-offload-bundler clang-scan-deps clang-repl
439 clang-rename clang-refactor clang-check clang-extdef-mapping clang-apply-replacements
440 clang-reorder-fields clang-tidy clang-change-namespace clang-doc clang-include-fixer
441 find-all-symbols clang-move clang-query pp-trace clang-pseudo modularize"
442
443 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
444 binaries="${binaries} clangd"
445 fi
446
447 for f in ${binaries}
448 do
449 install -m 755 ${D}${bindir}/$f ${SYSROOT_DESTDIR}${bindir}/
450 done
451}
diff --git a/recipes-devtools/clang/common-source.inc b/recipes-devtools/clang/common-source.inc
deleted file mode 100644
index cd95453..0000000
--- a/recipes-devtools/clang/common-source.inc
+++ /dev/null
@@ -1,17 +0,0 @@
1do_fetch() {
2 :
3}
4do_fetch[noexec] = "1"
5deltask do_unpack
6deltask do_patch
7
8SRC_URI = ""
9
10do_configure[depends] += "llvm-project-source-${PV}:do_patch"
11do_populate_lic[depends] += "llvm-project-source-${PV}:do_unpack"
12do_create_spdx[depends] += "llvm-project-source-${PV}:do_patch"
13
14# spdx shared workdir detection fails as not WORKDIR is altered but S and B
15# return always true to fix that
16def is_work_shared_spdx(d):
17 return True
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc
deleted file mode 100644
index a8a9929..0000000
--- a/recipes-devtools/clang/common.inc
+++ /dev/null
@@ -1,57 +0,0 @@
1FILESEXTRAPATHS =. "${FILE_DIRNAME}/clang:"
2
3LIC_FILES_CHKSUM = "file://llvm/LICENSE.TXT;md5=${LLVMMD5SUM} \
4 file://clang/LICENSE.TXT;md5=${CLANGMD5SUM} \
5"
6LICENSE = "Apache-2.0-with-LLVM-exception"
7
8BASEURI ??= "${LLVM_GIT}/llvm-project.git;protocol=${LLVM_GIT_PROTOCOL};branch=${BRANCH}"
9SRC_URI = "\
10 ${BASEURI} \
11 file://llvm-config \
12 file://libunwind.pc.in \
13 file://0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \
14 file://0002-compiler-rt-support-a-new-embedded-linux-target.patch \
15 file://0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \
16 file://0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \
17 file://0005-llvm-allow-env-override-of-exe-and-libdir-path.patch \
18 file://0006-clang-driver-Check-sysroot-for-ldso-path.patch \
19 file://0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch \
20 file://0008-clang-Prepend-trailing-to-sysroot.patch \
21 file://0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch \
22 file://0010-clang-Define-releative-gcc-installation-dir.patch \
23 file://0011-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \
24 file://0012-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \
25 file://0013-Check-for-atomic-double-intrinsics.patch \
26 file://0014-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \
27 file://0015-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \
28 file://0016-clang-Fix-resource-dir-location-for-cross-toolchains.patch \
29 file://0017-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch \
30 file://0018-clang-Use-python3-in-python-scripts.patch \
31 file://0019-For-x86_64-set-Yocto-based-GCC-install-search-path.patch \
32 file://0020-llvm-Do-not-use-find_library-for-ncurses.patch \
33 file://0021-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch \
34 file://0022-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch \
35 file://0023-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch \
36 file://0024-libunwind-Added-unw_backtrace-method.patch \
37 file://0025-clang-Do-not-use-install-relative-libc-headers.patch \
38 file://0027-Fix-lib-paths-for-OpenEmbedded-Host.patch \
39 file://0028-Correct-library-search-path-for-OpenEmbedded-Host.patch \
40 file://0029-lldb-Link-with-libatomic-on-x86.patch \
41 file://0030-compiler-rt-Enable-__int128-for-ppc32.patch \
42 file://0031-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch \
43 file://0032-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch \
44 file://0033-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch \
45 file://0034-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch \
46 file://0035-compiler-rt-Fix-cmake-check-for-_Float16-and-__bf16.patch \
47 "
48# Fallback to no-PIE if not set
49GCCPIE ??= ""
50
51S = "${TMPDIR}/work-shared/llvm-project-source-${PV}-${PR}/git"
52B = "${WORKDIR}/llvm-project-source-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
53
54# We need to ensure that for the shared work directory, the do_patch signatures match
55# The real WORKDIR location isn't a dependency for the shared workdir.
56src_patches[vardepsexclude] = "WORKDIR"
57should_apply[vardepsexclude] += "PN"
diff --git a/recipes-devtools/clang/compiler-rt-sanitizers_git.bb b/recipes-devtools/clang/compiler-rt-sanitizers_git.bb
deleted file mode 100644
index 06c0e06..0000000
--- a/recipes-devtools/clang/compiler-rt-sanitizers_git.bb
+++ /dev/null
@@ -1,116 +0,0 @@
1# Copyright (C) 2021 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "LLVM based C/C++ compiler Runtime"
5HOMEPAGE = "http://compiler-rt.llvm.org/"
6SECTION = "base"
7
8require clang.inc
9require common-source.inc
10
11inherit cmake pkgconfig python3native
12
13
14LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=d846d1d65baf322d4c485d6ee54e877a"
15
16TUNE_CCARGS:remove = "-no-integrated-as"
17
18DEPENDS += "ninja-native virtual/crypt compiler-rt"
19DEPENDS:append:class-native = " clang-native libxcrypt-native"
20DEPENDS:append:class-nativesdk = " clang-native clang-crosssdk-${SDK_ARCH} nativesdk-libxcrypt"
21
22PACKAGECONFIG ??= ""
23PACKAGECONFIG[crt] = "-DCOMPILER_RT_BUILD_CRT:BOOL=ON,-DCOMPILER_RT_BUILD_CRT:BOOL=OFF"
24PACKAGECONFIG[static-libcxx] = "-DSANITIZER_USE_STATIC_CXX_ABI=ON -DSANITIZER_USE_STATIC_LLVM_UNWINDER=ON -DCOMPILER_RT_ENABLE_STATIC_UNWINDER=ON,,"
25
26HF = ""
27HF:class-target = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
28HF[vardepvalue] = "${HF}"
29
30CXXFLAGS:append:libc-musl = " -D_LARGEFILE64_SOURCE"
31
32OECMAKE_TARGET_COMPILE = "compiler-rt"
33OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers"
34OECMAKE_SOURCEPATH = "${S}/llvm"
35EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
36 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
37 -DCOMPILER_RT_STANDALONE_BUILD=OFF \
38 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
39 -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
40 -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \
41 -DCOMPILER_RT_BUILD_BUILTINS=OFF \
42 -DCOMPILER_RT_INCLUDE_TESTS=OFF \
43 -DSANITIZER_CXX_ABI_LIBNAME=${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "libc++", "libstdc++", d)} \
44 -DCOMPILER_RT_BUILD_XRAY=ON \
45 -DCOMPILER_RT_BUILD_SANITIZERS=ON \
46 -DCOMPILER_RT_BUILD_LIBFUZZER=ON \
47 -DCOMPILER_RT_BUILD_PROFILE=ON \
48 -DCOMPILER_RT_BUILD_MEMPROF=ON \
49 -DLLVM_ENABLE_PROJECTS='compiler-rt' \
50 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
51 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
52 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
53 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
54"
55
56EXTRA_OECMAKE:append:class-nativesdk = "\
57 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
58 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
59"
60
61EXTRA_OECMAKE:append:class-target = "\
62 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
63"
64
65EXTRA_OECMAKE:append:libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON "
66EXTRA_OECMAKE:append:powerpc = " -DCOMPILER_RT_DEFAULT_TARGET_ARCH=powerpc "
67
68do_install:append () {
69 if [ -n "${LLVM_LIBDIR_SUFFIX}" ]; then
70 mkdir -p ${D}${nonarch_libdir}/clang
71 mv ${D}${libdir}/clang/${MAJOR_VER} ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}
72 rmdir --ignore-fail-on-non-empty ${D}${libdir}
73 else
74 mv ${D}${libdir}/clang/${MAJOR_VER} ${D}${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}
75 fi
76 # Already shipped with compile-rt Orc support
77 rm -rf ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/liborc_rt-*.a
78 rm -rf ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/include/orc/
79}
80
81FILES_SOLIBSDEV = ""
82FILES:${PN} += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/lib*${SOLIBSDEV} \
83 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/*.txt \
84 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/share/*.txt"
85FILES:${PN}-staticdev += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
86FILES:${PN}-dev += "${datadir} ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms \
87 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/include \
88 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/clang_rt.crt*.o \
89 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/libclang_rt.asan-preinit*.a"
90INSANE_SKIP:${PN} = "dev-so libdir"
91INSANE_SKIP:${PN}-dbg = "libdir"
92
93#PROVIDES:append:class-target = "\
94# virtual/${TARGET_PREFIX}compilerlibs \
95# libgcc \
96# libgcc-initial \
97# libgcc-dev \
98# libgcc-initial-dev \
99# "
100#
101
102RDEPENDS:${PN}-dev += "${PN}-staticdev"
103
104BBCLASSEXTEND = "native nativesdk"
105
106ALLOW_EMPTY:${PN} = "1"
107ALLOW_EMPTY:${PN}-dev = "1"
108
109TOOLCHAIN:forcevariable = "clang"
110SYSROOT_DIRS:append:class-target = " ${nonarch_libdir}"
111
112# riscv and x86_64 Sanitizers work on musl too
113COMPATIBLE_HOST:libc-musl:x86-64 = "(.*)"
114COMPATIBLE_HOST:libc-musl:riscv64 = "(.*)"
115COMPATIBLE_HOST:libc-musl:riscv32 = "(.*)"
116COMPATIBLE_HOST:libc-musl = "null"
diff --git a/recipes-devtools/clang/compiler-rt_git.bb b/recipes-devtools/clang/compiler-rt_git.bb
deleted file mode 100644
index dad6fbd..0000000
--- a/recipes-devtools/clang/compiler-rt_git.bb
+++ /dev/null
@@ -1,129 +0,0 @@
1# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "LLVM based C/C++ compiler Runtime"
5HOMEPAGE = "http://compiler-rt.llvm.org/"
6SECTION = "base"
7
8require clang.inc
9require common-source.inc
10
11inherit cmake cmake-native pkgconfig python3native
12
13
14LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=d846d1d65baf322d4c485d6ee54e877a"
15
16LIBCPLUSPLUS = ""
17COMPILER_RT = ""
18
19TUNE_CCARGS:remove = "-no-integrated-as"
20
21INHIBIT_DEFAULT_DEPS = "1"
22
23DEPENDS += "ninja-native libgcc"
24DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc gcc-runtime"
25DEPENDS:append:class-nativesdk = " clang-native clang-crosssdk-${SDK_ARCH} nativesdk-gcc-runtime"
26DEPENDS:append:class-native = " clang-native"
27
28# Trick clang.bbclass into not creating circular dependencies
29UNWINDLIB:class-nativesdk = "--unwindlib=libgcc"
30COMPILER_RT:class-nativesdk:toolchain-clang:runtime-llvm = "-rtlib=libgcc --unwindlib=libgcc"
31LIBCPLUSPLUS:class-nativesdk:toolchain-clang:runtime-llvm = "-stdlib=libstdc++"
32
33CXXFLAGS += "-stdlib=libstdc++"
34LDFLAGS += "-unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++"
35BUILD_CXXFLAGS += "-stdlib=libstdc++"
36BUILD_LDFLAGS += "-unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++"
37BUILD_CPPFLAGS:remove = "-stdlib=libc++"
38BUILD_LDFLAGS:remove = "-stdlib=libc++ -lc++abi"
39
40BUILD_CC:toolchain-clang = "${CCACHE}clang"
41BUILD_CXX:toolchain-clang = "${CCACHE}clang++"
42BUILD_CPP:toolchain-clang = "${CCACHE}clang -E"
43BUILD_CCLD:toolchain-clang = "${CCACHE}clang"
44BUILD_RANLIB:toolchain-clang = "llvm-ranlib"
45BUILD_AR:toolchain-clang = "llvm-ar"
46BUILD_NM:toolchain-clang = "llvm-nm"
47
48PACKAGECONFIG ??= ""
49PACKAGECONFIG[crt] = "-DCOMPILER_RT_BUILD_CRT:BOOL=ON,-DCOMPILER_RT_BUILD_CRT:BOOL=OFF"
50PACKAGECONFIG[profile] ="-DCOMPILER_RT_BUILD_PROFILE=ON,-DCOMPILER_RT_BUILD_PROFILE=OFF"
51
52HF = ""
53HF:class-target = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
54HF[vardepvalue] = "${HF}"
55
56OECMAKE_TARGET_COMPILE = "compiler-rt"
57OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers"
58OECMAKE_SOURCEPATH = "${S}/llvm"
59EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
60 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
61 -DCOMPILER_RT_STANDALONE_BUILD=OFF \
62 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
63 -DCOMPILER_RT_INCLUDE_TESTS=OFF \
64 -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \
65 -DCOMPILER_RT_BUILD_XRAY=OFF \
66 -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
67 -DCOMPILER_RT_BUILD_MEMPROF=OFF \
68 -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
69 -DLLVM_ENABLE_PROJECTS='compiler-rt' \
70 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
71"
72EXTRA_OECMAKE:append:class-target = "\
73 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
74 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
75 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
76 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
77"
78
79EXTRA_OECMAKE:append:class-nativesdk = "\
80 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
81 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
82 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
83 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
84 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
85"
86EXTRA_OECMAKE:append:powerpc = " -DCOMPILER_RT_DEFAULT_TARGET_ARCH=powerpc "
87
88do_install:append () {
89 if [ -n "${LLVM_LIBDIR_SUFFIX}" ]; then
90 mkdir -p ${D}${nonarch_libdir}/clang
91 mv ${D}${libdir}/clang/${MAJOR_VER} ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}
92 rmdir --ignore-fail-on-non-empty ${D}${libdir}/clang ${D}${libdir}
93 else
94 mv ${D}${libdir}/clang/${MAJOR_VER} ${D}${libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}
95 fi
96}
97
98FILES_SOLIBSDEV = ""
99
100FILES:${PN} += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/lib*${SOLIBSDEV} \
101 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/*.txt \
102 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/share/*.txt"
103FILES:${PN}-staticdev += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
104FILES:${PN}-dev += "${datadir} ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms \
105 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/include \
106 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/clang_rt.crt*.o \
107 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/libclang_rt.asan-preinit*.a"
108
109INSANE_SKIP:${PN} = "dev-so libdir"
110INSANE_SKIP:${PN}-dbg = "libdir"
111
112#PROVIDES:append:class-target = "\
113# virtual/${TARGET_PREFIX}compilerlibs \
114# libgcc \
115# libgcc-initial \
116# libgcc-dev \
117# libgcc-initial-dev \
118# "
119#
120
121RDEPENDS:${PN}-dev += "${PN}-staticdev"
122
123BBCLASSEXTEND = "native nativesdk"
124
125ALLOW_EMPTY:${PN} = "1"
126ALLOW_EMPTY:${PN}-dev = "1"
127
128TOOLCHAIN:forcevariable = "clang"
129SYSROOT_DIRS:append:class-target = " ${nonarch_libdir}"
diff --git a/recipes-devtools/clang/libclc_git.bb b/recipes-devtools/clang/libclc_git.bb
deleted file mode 100644
index 2c4ed0a..0000000
--- a/recipes-devtools/clang/libclc_git.bb
+++ /dev/null
@@ -1,48 +0,0 @@
1DESCRIPTION = "LLVM based OpenCL runtime support library"
2HOMEPAGE = "http://libclc.llvm.org/"
3SECTION = "libs"
4
5require clang.inc
6require common-source.inc
7
8TOOLCHAIN = "clang"
9
10LIC_FILES_CHKSUM = "file://libclc/LICENSE.TXT;md5=7cc795f6cbb2d801d84336b83c8017db"
11
12inherit cmake pkgconfig python3native qemu
13
14DEPENDS += "qemu-native clang spirv-tools spirv-llvm-translator spirv-llvm-translator-native ncurses"
15
16OECMAKE_SOURCEPATH = "${S}/libclc"
17
18EXTRA_OECMAKE += " \
19 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
20 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
21 -DCMAKE_CROSSCOMPILING_EMULATOR=${WORKDIR}/qemuwrapper \
22 -DLLVM_CLANG=${STAGING_BINDIR_NATIVE}/clang \
23 -DLLVM_AS=${STAGING_BINDIR_NATIVE}/llvm-as \
24 -DLLVM_LINK=${STAGING_BINDIR_NATIVE}/llvm-link \
25 -DLLVM_OPT=${STAGING_BINDIR_NATIVE}/opt \
26 -DLLVM_SPIRV=${STAGING_BINDIR_NATIVE}/llvm-spirv \
27 -Dclc_comp_in:FILEPATH=${OECMAKE_SOURCEPATH}/cmake/CMakeCLCCompiler.cmake.in \
28 -Dll_comp_in:FILEPATH=${OECMAKE_SOURCEPATH}/cmake/CMakeLLAsmCompiler.cmake.in \
29 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
30 "
31
32do_configure:prepend () {
33 # Write out a qemu wrapper that will be used by cmake
34 # so that it can run target helper binaries through that.
35 qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_DIR_HOST}${base_libdir}')])}"
36 cat > ${WORKDIR}/qemuwrapper << EOF
37#!/bin/sh
38$qemu_binary "\$@"
39EOF
40 chmod +x ${WORKDIR}/qemuwrapper
41}
42
43FILES:${PN} += "${datadir}/clc"
44
45BBCLASSEXTEND = "native nativesdk"
46
47export YOCTO_ALTERNATE_EXE_PATH
48export YOCTO_ALTERNATE_LIBDIR
diff --git a/recipes-devtools/clang/libcxx_git.bb b/recipes-devtools/clang/libcxx_git.bb
deleted file mode 100644
index 9d4f033..0000000
--- a/recipes-devtools/clang/libcxx_git.bb
+++ /dev/null
@@ -1,116 +0,0 @@
1# Copyright (C) 2015 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "libc++ is a new implementation of the C++ standard library, targeting C++11"
5HOMEPAGE = "http://libcxx.llvm.org/"
6SECTION = "base"
7
8require clang.inc
9require common-source.inc
10
11inherit cmake cmake-native python3native
12
13PACKAGECONFIG ??= "compiler-rt exceptions ${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "unwind unwind-shared", "", d)}"
14PACKAGECONFIG:append:armv5 = " no-atomics"
15PACKAGECONFIG:remove:class-native = "compiler-rt"
16PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON,-DLIBCXXABI_USE_LLVM_UNWINDER=OFF,,"
17PACKAGECONFIG[exceptions] = "-DLIBCXXABI_ENABLE_EXCEPTIONS=ON -DDLIBCXX_ENABLE_EXCEPTIONS=ON,-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF -DLIBCXX_ENABLE_EXCEPTIONS=OFF -DCMAKE_REQUIRED_FLAGS='-fno-exceptions',"
18PACKAGECONFIG[no-atomics] = "-D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF -DCMAKE_SHARED_LINKER_FLAGS='-latomic',,"
19PACKAGECONFIG[compiler-rt] = "-DLIBCXX_USE_COMPILER_RT=ON -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBUNWIND_USE_COMPILER_RT=ON,,compiler-rt"
20PACKAGECONFIG[unwind-shared] = "-DLIBUNWIND_ENABLE_SHARED=ON,-DLIBUNWIND_ENABLE_SHARED=OFF,,"
21
22DEPENDS += "ninja-native"
23DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs"
24DEPENDS:append:class-nativesdk = " clang-crosssdk-${SDK_ARCH} nativesdk-compiler-rt"
25DEPENDS:append:class-native = " clang-native"
26
27LIBCPLUSPLUS = ""
28COMPILER_RT ?= "-rtlib=compiler-rt"
29
30# Trick clang.bbclass into not creating circular dependencies
31UNWINDLIB:class-nativesdk = "--unwindlib=libgcc"
32COMPILER_RT:class-nativesdk = "-rtlib=libgcc --unwindlib=libgcc"
33LIBCPLUSPLUS:class-nativesdk = "-stdlib=libstdc++"
34
35CC:append:toolchain-clang:class-native = " -unwindlib=libgcc -rtlib=libgcc"
36CC:append:toolchain-clang:class-nativesdk = " -unwindlib=libgcc -rtlib=libgcc"
37
38CXXFLAGS += "-stdlib=libstdc++"
39LDFLAGS += "-unwindlib=libgcc -stdlib=libstdc++"
40BUILD_CXXFLAGS += "-stdlib=libstdc++"
41BUILD_LDFLAGS += "-unwindlib=libgcc -rtlib=libgcc -stdlib=libstdc++"
42BUILD_CPPFLAGS:remove = "-stdlib=libc++"
43BUILD_LDFLAGS:remove = "-stdlib=libc++ -lc++abi"
44
45INHIBIT_DEFAULT_DEPS = "1"
46
47LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da3953 \
48 file://libcxxabi/LICENSE.TXT;md5=7b9334635b542c56868400a46b272b1e \
49 file://libunwind/LICENSE.TXT;md5=f66970035d12f196030658b11725e1a1 \
50"
51
52OECMAKE_TARGET_COMPILE = "cxxabi cxx"
53OECMAKE_TARGET_INSTALL = "install-cxx install-cxxabi ${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "install-unwind", "", d)}"
54
55OECMAKE_SOURCEPATH = "${S}/llvm"
56EXTRA_OECMAKE += "\
57 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
58 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
59 -DCMAKE_CROSSCOMPILING=ON \
60 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
61 -DLLVM_ENABLE_RTTI=ON \
62 -DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON \
63 -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
64 -DLIBCXXABI_INCLUDE_TESTS=OFF \
65 -DLIBCXXABI_ENABLE_SHARED=ON \
66 -DLIBCXXABI_LIBCXX_INCLUDES=${S}/libcxx/include \
67 -DLIBCXX_CXX_ABI=libcxxabi \
68 -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${S}/libcxxabi/include \
69 -DLIBCXX_CXX_ABI_LIBRARY_PATH=${B}/lib${LLVM_LIBDIR_SUFFIX} \
70 -S ${S}/runtimes \
71 -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \
72 -DLLVM_RUNTIME_TARGETS=${HOST_SYS} \
73 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
74 -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
75"
76
77EXTRA_OECMAKE:append:class-target = " \
78 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${AR} \
79 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${NM} \
80 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${RANLIB} \
81 -DLLVM_DEFAULT_TARGET_TRIPLE=${HOST_SYS} \
82 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
83"
84
85EXTRA_OECMAKE:append:class-nativesdk = " \
86 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${AR} \
87 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${NM} \
88 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${RANLIB} \
89 -DLLVM_DEFAULT_TARGET_TRIPLE=${HOST_SYS} \
90"
91
92EXTRA_OECMAKE:append:libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON "
93
94CXXFLAGS:append:armv5 = " -mfpu=vfp2"
95
96ALLOW_EMPTY:${PN} = "1"
97
98PROVIDES:append:runtime-llvm = " libunwind"
99
100do_install:append() {
101 if ${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "true", "false", d)}
102 then
103 for f in libunwind.h __libunwind_config.h unwind.h unwind_itanium.h unwind_arm_ehabi.h
104 do
105 install -Dm 0644 ${S}/libunwind/include/$f ${D}${includedir}/$f
106 done
107 install -d ${D}${libdir}/pkgconfig
108 sed -e 's,@LIBDIR@,${libdir},g;s,@VERSION@,${PV},g' ${S}/../libunwind.pc.in > ${D}${libdir}/pkgconfig/libunwind.pc
109 fi
110}
111
112PACKAGES:append:runtime-llvm = " libunwind"
113FILES:libunwind:runtime-llvm = "${libdir}/libunwind.so.*"
114
115BBCLASSEXTEND = "native nativesdk"
116TOOLCHAIN:forcevariable = "clang"
diff --git a/recipes-devtools/clang/llvm-project-source.bb b/recipes-devtools/clang/llvm-project-source.bb
deleted file mode 100644
index 78664c5..0000000
--- a/recipes-devtools/clang/llvm-project-source.bb
+++ /dev/null
@@ -1,10 +0,0 @@
1# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SUMMARY = "This is the canonical git mirror of the LLVM subversion repository."
5HOMEPAGE = "https://github.com/llvm/llvm-project"
6
7require llvm-project-source.inc
8require clang.inc
9
10EXCLUDE_FROM_WORLD = "1"
diff --git a/recipes-devtools/clang/llvm-project-source.inc b/recipes-devtools/clang/llvm-project-source.inc
deleted file mode 100644
index 103373a..0000000
--- a/recipes-devtools/clang/llvm-project-source.inc
+++ /dev/null
@@ -1,96 +0,0 @@
1deltask do_configure
2deltask do_compile
3deltask do_install
4deltask do_populate_sysroot
5deltask do_populate_lic
6RM_WORK_EXCLUDE += "${PN}"
7
8inherit nopackages
9
10PN = "llvm-project-source-${PV}"
11WORKDIR = "${TMPDIR}/work-shared/llvm-project-source-${PV}-${PR}"
12SSTATE_SWSPEC = "sstate:llvm-project-source::${PV}:${PR}::${SSTATE_VERSION}:"
13
14STAMP = "${STAMPS_DIR}/work-shared/llvm-project-source-${PV}-${PR}"
15STAMPCLEAN = "${STAMPS_DIR}/work-shared/llvm-project-source-${PV}-*"
16
17INHIBIT_DEFAULT_DEPS = "1"
18DEPENDS = ""
19PACKAGES = ""
20TARGET_ARCH = "allarch"
21TARGET_AS_ARCH = "none"
22TARGET_CC_ARCH = "none"
23TARGET_LD_ARCH = "none"
24TARGET_OS = "linux"
25baselib = "lib"
26PACKAGE_ARCH = "all"
27
28# space separated list of additional distro vendor values we want to support e.g.
29# "yoe webos" or "-yoe -webos" '-' is optional
30CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR} ${SDK_VENDOR}"
31# Extra OE DISTRO that want to support as build host. space separated list of additional distro.
32# ":" separated the ID in "/etc/os-release" and the triple for finding gcc on this OE DISTRO.
33# eg: "poky:poky wrlinux:wrs"
34CLANG_EXTRA_OE_DISTRO ?= "poky:poky"
35# Match with MULTILIB_GLOBAL_VARIANTS
36MULTILIB_VARIANTS = "lib32 lib64 libx32"
37python add_distro_vendor() {
38 import subprocess
39 case = ""
40 triple = ""
41 vendors = d.getVar('CLANG_EXTRA_OE_VENDORS')
42 multilib_variants = (d.getVar("MULTILIB_VARIANTS") or "").split()
43 vendors_to_add = []
44 for vendor in vendors.split():
45 # convert -yoe into yoe
46 vendor = vendor.lstrip('-')
47 # generate possible multilib vendor names for yoe
48 # such as yoemllib32
49 vendors_to_add.extend([vendor + 'ml' + variant for variant in multilib_variants])
50 # skip oe since already part of the cpp file
51 if vendor != "oe":
52 vendors_to_add.append(vendor)
53
54 for vendor_to_add in vendors_to_add:
55 case += '\\n .Case("' + vendor_to_add + '", Triple::OpenEmbedded)'
56 triple += ' "x86_64-' + vendor_to_add + '-linux",'
57
58 bb.note("Adding support following TARGET_VENDOR values")
59 bb.note(str(vendors_to_add))
60 bb.note("in llvm/lib/TargetParser/Triple.cpp and ${S}/clang/lib/Driver/ToolChains/Gnu.cpp")
61 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_TRIPLES#%s#g' ${S}/clang/lib/Driver/ToolChains/Gnu.cpp" % (triple))
62 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
63 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_CASES#%s#g' -i ${S}/llvm/lib/TargetParser/Triple.cpp" % (case))
64 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
65
66
67 case = ""
68 triple = ""
69 name = ""
70 check = ""
71 oe_names = ""
72 distros = d.getVar('CLANG_EXTRA_OE_DISTRO')
73 for distro in distros.split():
74 distro_id = distro.split(":")[0].replace('-','_')
75 distro_triple = distro.split(":")[1]
76 case += '\\n .Case("' + distro_id + '", Distro::' + distro_id.upper() + ')'
77 triple += '\\n if (Distro.Is' + distro_id.upper() + '())\\n return "x86_64-' + distro_triple + '-linux",'
78 name += '\\n '+ distro_id.upper() + ','
79 check += '\\nbool Is' + distro_id.upper() + '() const { return DistroVal == ' + distro_id.upper() + '; }'
80 oe_names += distro_id.upper() + ' ||'
81
82 check += '\\nbool IsOpenEmbedded() const { return DistroVal == ' + oe_names[0:-3] + '; }'
83
84 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_NAME#%s#g' ${S}/clang/include/clang/Driver/Distro.h" % (name))
85 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
86 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_CHECK#%s#g' ${S}/clang/include/clang/Driver/Distro.h" % (check))
87 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
88 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_TRIPLES#%s#g' ${S}/clang/lib/Driver/ToolChains/Linux.cpp" % (triple))
89 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
90 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_CASES#%s#g' -i ${S}/clang/lib/Driver/Distro.cpp" % (case))
91 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
92}
93
94do_patch[vardepsexclude] = "MULTILIBS"
95do_patch[postfuncs] += "add_distro_vendor"
96do_create_spdx[depends] += "${PN}:do_patch"
diff --git a/recipes-devtools/clang/nativesdk-clang-glue.bb b/recipes-devtools/clang/nativesdk-clang-glue.bb
deleted file mode 100644
index 4e0c6fa..0000000
--- a/recipes-devtools/clang/nativesdk-clang-glue.bb
+++ /dev/null
@@ -1,35 +0,0 @@
1# Copyright (C) 2014 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "SDK Cross compiler wrappers for LLVM based C/C++ compiler"
5HOMEPAGE = "http://clang.llvm.org/"
6LICENSE = "Apache-2.0-with-LLVM-exception"
7LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab"
8SECTION = "devel"
9
10inherit nativesdk
11DEPENDS += "nativesdk-clang"
12
13do_install() {
14 install -d ${D}${prefix_nativesdk}
15 cd ${D}${prefix_nativesdk}
16 ln -s ..${libdir} .
17 ln -s ..${includedir} .
18 cd ..
19 ln -s .${base_libdir} .
20}
21
22sysroot_stage_all () {
23 sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
24}
25
26FILES:${PN} += "${prefix_nativesdk} ${base_libdir_nativesdk}"
27FILES:${PN}-dbg = ""
28
29deltask do_configure
30deltask do_compile
31deltask do_patch
32deltask do_fetch
33deltask do_unpack
34deltask do_create_spdx
35deltask do_create_runtime_spdx
diff --git a/recipes-devtools/clang/openmp_git.bb b/recipes-devtools/clang/openmp_git.bb
deleted file mode 100644
index 865dbe6..0000000
--- a/recipes-devtools/clang/openmp_git.bb
+++ /dev/null
@@ -1,64 +0,0 @@
1# Copyright (C) 2017 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "LLVM based C/C++ compiler Runtime"
5HOMEPAGE = "https://openmp.llvm.org/"
6SECTION = "libs"
7
8require clang.inc
9require common-source.inc
10
11TOOLCHAIN = "clang"
12
13LIC_FILES_CHKSUM = "file://openmp/LICENSE.TXT;md5=d75288d1ce0450b28b8d58a284c09c79"
14
15inherit cmake pkgconfig perlnative python3native python3targetconfig
16
17DEPENDS += "elfutils libffi clang"
18
19EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
20 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
21 -DOPENMP_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
22 -DOPENMP_STANDALONE_BUILD=ON \
23 -DCLANG_TOOL=${STAGING_BINDIR_NATIVE}/clang \
24 -DLINK_TOOL=${STAGING_BINDIR_NATIVE}/llvm-link \
25 -DOPT_TOOL=${STAGING_BINDIR_NATIVE}/opt \
26 -DOPENMP_LLVM_LIT_EXECUTABLE=${STAGING_BINDIR_NATIVE}/llvm-lit \
27 -DEXTRACT_TOOL=${STAGING_BINDIR_NATIVE}/llvm-extract \
28 -DPACKAGER_TOOL=${STAGING_BINDIR_NATIVE}/clang-offload-packager \
29 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
30 "
31
32OECMAKE_SOURCEPATH = "${S}/openmp"
33
34PACKAGECONFIG ?= "ompt-tools offloading-plugin"
35
36PACKAGECONFIG:remove:arm = "ompt-tools offloading-plugin"
37PACKAGECONFIG:remove:powerpc = "ompt-tools offloading-plugin"
38
39PACKAGECONFIG:append:mipsarcho32 = " no-atomics"
40
41PACKAGECONFIG[ompt-tools] = "-DOPENMP_ENABLE_OMPT_TOOLS=ON,-DOPENMP_ENABLE_OMPT_TOOLS=OFF,"
42PACKAGECONFIG[aliases] = "-DLIBOMP_INSTALL_ALIASES=ON,-DLIBOMP_INSTALL_ALIASES=OFF,"
43PACKAGECONFIG[offloading-plugin] = ",,elfutils libffi,libelf libffi"
44PACKAGECONFIG[no-atomics] = "-DLIBOMP_HAVE_BUILTIN_ATOMIC=OFF -DLIBOMP_LIBFLAGS='-latomic',,"
45
46PACKAGES += "${PN}-libomptarget ${PN}-gdb-plugin"
47FILES_SOLIBSDEV = ""
48FILES:${PN} += "${libdir}/lib*${SOLIBSDEV}"
49FILES:${PN}-libomptarget = "${libdir}/libomptarget-*.bc"
50FILES:${PN}-gdb-plugin = "${datadir}/gdb/python/ompd"
51
52RDEPENDS:${PN}-gdb-plugin += "python3-core"
53
54INSANE_SKIP:${PN} = "dev-so"
55# Currently the static libraries contain buildpaths
56INSANE_SKIP:${PN}-staticdev += "buildpaths"
57
58COMPATIBLE_HOST:mips64 = "null"
59COMPATIBLE_HOST:riscv32 = "null"
60COMPATIBLE_HOST:powerpc = "null"
61
62BBCLASSEXTEND = "native nativesdk"
63
64CVE_STATUS[CVE-2022-26345] = "cpe-incorrect: specific to the Intel distribution before 2022.1"
diff --git a/recipes-devtools/include-what-you-use/include-what-you-use_0.23.bb b/recipes-devtools/include-what-you-use/include-what-you-use_0.23.bb
new file mode 100644
index 0000000..7c4392f
--- /dev/null
+++ b/recipes-devtools/include-what-you-use/include-what-you-use_0.23.bb
@@ -0,0 +1,24 @@
1SUMMARY = "Include What You Use (IWYU) - Clang based checker for C/C++ header includes"
2DESCRIPTION = "For every symbol (type, function, variable, or macro) that you \
3 use in foo.cc (or foo.cpp), either foo.cc or foo.h should \
4 include a .h file that exports the declaration of that symbol."
5HOMEPAGE = "https://include-what-you-use.org"
6BUGTRACKER = "https://github.com/include-what-you-use/include-what-you-use/issues"
7LICENSE = "NCSA"
8LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=3bb66a14534286912cd6f26649b5c60a \
9 file://iwyu-check-license-header.py;md5=7bdb749831163fbe9232b3cb7186116f"
10
11DEPENDS = "clang"
12
13SRC_URI = "git://github.com/include-what-you-use/include-what-you-use.git;protocol=https;branch=master"
14SRCREV = "fa1094c0b3848f82244778bc6153cc84f8a890f6"
15
16PV .= "+git"
17
18inherit cmake python3native
19
20EXTRA_OECMAKE = "-DIWYU_RESOURCE_RELATIVE_TO=iwyu"
21
22FILES:${PN} += "${datadir}/${BPN}"
23
24BBCLASSEXTEND = "nativesdk"
diff --git a/recipes-devtools/python/python3-cffi_%.bbappend b/recipes-devtools/python/python3-cffi_%.bbappend
new file mode 100644
index 0000000..0628a90
--- /dev/null
+++ b/recipes-devtools/python/python3-cffi_%.bbappend
@@ -0,0 +1,5 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2
3# tests need compiler on target and they need the compiler which was
4# used to build python
5RDEPENDS:${PN}-ptest:append:toolchain-clang = " clang"
diff --git a/recipes-devtools/rust/rust-llvm/0001-sancov-Switch-to-OptTable-from-llvm-cl.patch b/recipes-devtools/rust/rust-llvm/0001-sancov-Switch-to-OptTable-from-llvm-cl.patch
deleted file mode 100644
index e713dfa..0000000
--- a/recipes-devtools/rust/rust-llvm/0001-sancov-Switch-to-OptTable-from-llvm-cl.patch
+++ /dev/null
@@ -1,352 +0,0 @@
1From a8016e296e6ec161897e7421c5efbc25a6aa3a9f Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9s=20Villegas?= <andresvi@google.com>
3Date: Tue, 25 Jul 2023 23:38:09 +0000
4Subject: [PATCH] [sancov] Switch to OptTable from llvm::cl
5
6Switch the parse of command line options from llvm::cl to OptTable.
7
8The motivation for this change is to continue adding llvm based tools
9to the llvm driver multicall. For more information about the proposal
10and motivation, please see https://discourse.llvm.org/t/rfc-llvm-busybox-proposal/58494
11
12Reviewed By: leonardchan
13
14Drop this patch when upgrading llvm in rust to 18.x or newer
15
16Upstream-Status: Backport [https://github.com/llvm/llvm-project/commit/a8016e296e6ec161897e7421c5efbc25a6aa3a9f]
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18Differential Revision: https://reviews.llvm.org/D155119
19---
20 llvm/tools/sancov/CMakeLists.txt | 8 ++
21 llvm/tools/sancov/Opts.td | 58 +++++++++
22 llvm/tools/sancov/sancov.cpp | 194 +++++++++++++++++++++----------
23 3 files changed, 196 insertions(+), 64 deletions(-)
24 create mode 100644 llvm/tools/sancov/Opts.td
25
26--- a/tools/sancov/CMakeLists.txt
27+++ b/tools/sancov/CMakeLists.txt
28@@ -5,11 +5,19 @@ set(LLVM_LINK_COMPONENTS
29 MC
30 MCDisassembler
31 Object
32+ Option
33 Support
34 Symbolize
35 TargetParser
36 )
37
38+set(LLVM_TARGET_DEFINITIONS Opts.td)
39+tablegen(LLVM Opts.inc -gen-opt-parser-defs)
40+add_public_tablegen_target(SancovOptsTableGen)
41+
42 add_llvm_tool(sancov
43 sancov.cpp
44+
45+ DEPENDS
46+ SancovOptsTableGen
47 )
48--- /dev/null
49+++ b/tools/sancov/Opts.td
50@@ -0,0 +1,58 @@
51+include "llvm/Option/OptParser.td"
52+
53+class F<string name, string help> : Flag<["-", "--"], name>, HelpText<help>;
54+
55+multiclass B<string name, string help1, string help2> {
56+ def NAME: Flag<["-", "--"], name>, HelpText<help1>;
57+ def no_ # NAME: Flag<["-", "--"], "no-" # name>, HelpText<help2>;
58+}
59+
60+multiclass Eq<string name, string help> {
61+ def NAME #_EQ : Joined<["-", "--"], name #"=">,
62+ HelpText<help>;
63+ def : Separate<["-", "--"], name>, Alias<!cast<Joined>(NAME #_EQ)>;
64+}
65+
66+def generic_grp : OptionGroup<"Genric Options">, HelpText<"Generic Options">;
67+def help : F<"help", "Display this help">, Group<generic_grp>;
68+def : Flag<["-"], "h">, Alias<help>, HelpText<"Alias for --help">, Group<generic_grp>;
69+def version : F<"version", "Display the version">, Group<generic_grp>;
70+def : Flag<["-"], "v">, Alias<version>, HelpText<"Alias for --version">, Group<generic_grp>;
71+
72+def action_grp : OptionGroup<"Action">, HelpText<"Action (required)">;
73+def print : F<"print", "Print coverage addresses">,
74+ Group<action_grp>;
75+def printCoveragePcs : F<"print-coverage-pcs", "Print coverage instrumentation points addresses.">,
76+ Group<action_grp>;
77+def coveredFunctions : F<"covered-functions", "Print all covered funcions.">,
78+ Group<action_grp>;
79+def notCoveredFunctions : F<"not-covered-functions", "Print all not covered funcions.">,
80+ Group<action_grp>;
81+def printCoverageStats : F<"print-coverage-stats", "Print coverage statistics.">,
82+ Group<action_grp>;
83+def htmlReport : F<"html-report", "REMOVED. Use -symbolize & coverage-report-server.py.">,
84+ Group<action_grp>;
85+def symbolize : F<"symbolize", "Produces a symbolized JSON report from binary report.">,
86+ Group<action_grp>;
87+def merge : F<"merge", "Merges reports.">,
88+ Group<action_grp>;
89+
90+defm demangle : B<"demangle", "Demangle function names", "Do not demangle function names">;
91+defm skipDeadFiles : B<"skip-dead-files", "Do not list dead source files in reports",
92+ "List dead source files in reports">;
93+defm useDefaultIgnoreList :
94+ B<"use_default_ignorelist", "Use the default ignore list", "Don't use the default ignore list">,
95+ Flags<[HelpHidden]>;
96+
97+// Compatibility aliases
98+def : Flag<["-"], "demangle=0">, Alias<no_demangle>, HelpText<"Alias for --no-demangle">;
99+def : Flag<["-"], "skip-dead-files=0">, Alias<no_skipDeadFiles>, HelpText<"Alias for --no-skip-dead-files">;
100+def : Flag<["-"], "use_default_ignorelist=0">, Alias<no_useDefaultIgnoreList>, HelpText<"Alias for --no-use_default_ignore_list">;
101+
102+defm stripPathPrefix
103+ : Eq<"strip_path_prefix", "Strip this prefix from files paths in reports">,
104+ MetaVarName<"<string>">;
105+
106+defm ignorelist
107+ : Eq<"ignorelist", "Ignorelist file (sanitizer ignorelist format)">,
108+ MetaVarName<"<string>">;
109--- a/tools/sancov/sancov.cpp
110+++ b/tools/sancov/sancov.cpp
111@@ -29,6 +29,8 @@
112 #include "llvm/Object/COFF.h"
113 #include "llvm/Object/MachO.h"
114 #include "llvm/Object/ObjectFile.h"
115+#include "llvm/Option/ArgList.h"
116+#include "llvm/Option/Option.h"
117 #include "llvm/Support/Casting.h"
118 #include "llvm/Support/CommandLine.h"
119 #include "llvm/Support/Errc.h"
120@@ -55,9 +57,44 @@ using namespace llvm;
121
122 namespace {
123
124-// --------- COMMAND LINE FLAGS ---------
125+// Command-line option boilerplate.
126+namespace {
127+using namespace llvm::opt;
128+enum ID {
129+ OPT_INVALID = 0, // This is not an option ID.
130+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
131+ HELPTEXT, METAVAR, VALUES) \
132+ OPT_##ID,
133+#include "Opts.inc"
134+#undef OPTION
135+};
136
137-cl::OptionCategory Cat("sancov Options");
138+#define PREFIX(NAME, VALUE) \
139+ static constexpr StringLiteral NAME##_init[] = VALUE; \
140+ static constexpr ArrayRef<StringLiteral> NAME(NAME##_init, \
141+ std::size(NAME##_init) - 1);
142+#include "Opts.inc"
143+#undef PREFIX
144+
145+static constexpr opt::OptTable::Info InfoTable[] = {
146+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
147+ HELPTEXT, METAVAR, VALUES) \
148+ { \
149+ PREFIX, NAME, HELPTEXT, \
150+ METAVAR, OPT_##ID, opt::Option::KIND##Class, \
151+ PARAM, FLAGS, OPT_##GROUP, \
152+ OPT_##ALIAS, ALIASARGS, VALUES},
153+#include "Opts.inc"
154+#undef OPTION
155+};
156+
157+class SancovOptTable : public opt::GenericOptTable {
158+public:
159+ SancovOptTable() : GenericOptTable(InfoTable) {}
160+};
161+} // namespace
162+
163+// --------- COMMAND LINE FLAGS ---------
164
165 enum ActionType {
166 CoveredFunctionsAction,
167@@ -70,53 +107,13 @@ enum ActionType {
168 SymbolizeAction
169 };
170
171-cl::opt<ActionType> Action(
172- cl::desc("Action (required)"), cl::Required,
173- cl::values(
174- clEnumValN(PrintAction, "print", "Print coverage addresses"),
175- clEnumValN(PrintCovPointsAction, "print-coverage-pcs",
176- "Print coverage instrumentation points addresses."),
177- clEnumValN(CoveredFunctionsAction, "covered-functions",
178- "Print all covered funcions."),
179- clEnumValN(NotCoveredFunctionsAction, "not-covered-functions",
180- "Print all not covered funcions."),
181- clEnumValN(StatsAction, "print-coverage-stats",
182- "Print coverage statistics."),
183- clEnumValN(HtmlReportAction, "html-report",
184- "REMOVED. Use -symbolize & coverage-report-server.py."),
185- clEnumValN(SymbolizeAction, "symbolize",
186- "Produces a symbolized JSON report from binary report."),
187- clEnumValN(MergeAction, "merge", "Merges reports.")),
188- cl::cat(Cat));
189-
190-static cl::list<std::string>
191- ClInputFiles(cl::Positional, cl::OneOrMore,
192- cl::desc("<action> <binary files...> <.sancov files...> "
193- "<.symcov files...>"),
194- cl::cat(Cat));
195-
196-static cl::opt<bool> ClDemangle("demangle", cl::init(true),
197- cl::desc("Print demangled function name"),
198- cl::cat(Cat));
199-
200-static cl::opt<bool>
201- ClSkipDeadFiles("skip-dead-files", cl::init(true),
202- cl::desc("Do not list dead source files in reports"),
203- cl::cat(Cat));
204-
205-static cl::opt<std::string>
206- ClStripPathPrefix("strip_path_prefix", cl::init(""),
207- cl::desc("Strip this prefix from file paths in reports"),
208- cl::cat(Cat));
209-
210-static cl::opt<std::string>
211- ClIgnorelist("ignorelist", cl::init(""),
212- cl::desc("Ignorelist file (sanitizer ignorelist format)"),
213- cl::cat(Cat));
214-
215-static cl::opt<bool> ClUseDefaultIgnorelist(
216- "use_default_ignorelist", cl::init(true), cl::Hidden,
217- cl::desc("Controls if default ignorelist should be used"), cl::cat(Cat));
218+static ActionType Action;
219+static std::vector<std::string> ClInputFiles;
220+static bool ClDemangle;
221+static bool ClSkipDeadFiles;
222+static bool ClUseDefaultIgnorelist;
223+static std::string ClStripPathPrefix;
224+static std::string ClIgnorelist;
225
226 static const char *const DefaultIgnorelistStr = "fun:__sanitizer_.*\n"
227 "src:/usr/include/.*\n"
228@@ -699,8 +696,7 @@ findSanitizerCovFunctions(const object::
229 // Ported from
230 // compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h:GetPreviousInstructionPc
231 // GetPreviousInstructionPc.
232-static uint64_t getPreviousInstructionPc(uint64_t PC,
233- Triple TheTriple) {
234+static uint64_t getPreviousInstructionPc(uint64_t PC, Triple TheTriple) {
235 if (TheTriple.isARM())
236 return (PC - 3) & (~1);
237 if (TheTriple.isMIPS() || TheTriple.isSPARC())
238@@ -1145,31 +1141,101 @@ readSymbolizeAndMergeCmdArguments(std::v
239
240 } // namespace
241
242+static void parseArgs(int Argc, char **Argv) {
243+ SancovOptTable Tbl;
244+ llvm::BumpPtrAllocator A;
245+ llvm::StringSaver Saver{A};
246+ opt::InputArgList Args =
247+ Tbl.parseArgs(Argc, Argv, OPT_UNKNOWN, Saver, [&](StringRef Msg) {
248+ llvm::errs() << Msg << '\n';
249+ std::exit(1);
250+ });
251+
252+ if (Args.hasArg(OPT_help)) {
253+ Tbl.printHelp(
254+ llvm::outs(),
255+ "sancov [options] <action> <binary files...> <.sancov files...> "
256+ "<.symcov files...>",
257+ "Sanitizer Coverage Processing Tool (sancov)\n\n"
258+ " This tool can extract various coverage-related information from: \n"
259+ " coverage-instrumented binary files, raw .sancov files and their "
260+ "symbolized .symcov version.\n"
261+ " Depending on chosen action the tool expects different input files:\n"
262+ " -print-coverage-pcs - coverage-instrumented binary files\n"
263+ " -print-coverage - .sancov files\n"
264+ " <other actions> - .sancov files & corresponding binary "
265+ "files, .symcov files\n");
266+ std::exit(0);
267+ }
268+
269+ if (Args.hasArg(OPT_version)) {
270+ cl::PrintVersionMessage();
271+ std::exit(0);
272+ }
273+
274+ if (Args.hasMultipleArgs(OPT_action_grp)) {
275+ fail("Only one action option is allowed");
276+ }
277+
278+ for (const opt::Arg *A : Args.filtered(OPT_INPUT)) {
279+ ClInputFiles.emplace_back(A->getValue());
280+ }
281+
282+ if (const llvm::opt::Arg *A = Args.getLastArg(OPT_action_grp)) {
283+ switch (A->getOption().getID()) {
284+ case OPT_print:
285+ Action = ActionType::PrintAction;
286+ break;
287+ case OPT_printCoveragePcs:
288+ Action = ActionType::PrintCovPointsAction;
289+ break;
290+ case OPT_coveredFunctions:
291+ Action = ActionType::CoveredFunctionsAction;
292+ break;
293+ case OPT_notCoveredFunctions:
294+ Action = ActionType::NotCoveredFunctionsAction;
295+ break;
296+ case OPT_printCoverageStats:
297+ Action = ActionType::StatsAction;
298+ break;
299+ case OPT_htmlReport:
300+ Action = ActionType::HtmlReportAction;
301+ break;
302+ case OPT_symbolize:
303+ Action = ActionType::SymbolizeAction;
304+ break;
305+ case OPT_merge:
306+ Action = ActionType::MergeAction;
307+ break;
308+ default:
309+ fail("Invalid Action");
310+ }
311+ }
312+
313+ ClDemangle = Args.hasFlag(OPT_demangle, OPT_no_demangle, true);
314+ ClSkipDeadFiles = Args.hasFlag(OPT_skipDeadFiles, OPT_no_skipDeadFiles, true);
315+ ClUseDefaultIgnorelist =
316+ Args.hasFlag(OPT_useDefaultIgnoreList, OPT_no_useDefaultIgnoreList, true);
317+
318+ ClStripPathPrefix = Args.getLastArgValue(OPT_stripPathPrefix_EQ);
319+ ClIgnorelist = Args.getLastArgValue(OPT_ignorelist_EQ);
320+}
321+
322 int main(int Argc, char **Argv) {
323 llvm::InitLLVM X(Argc, Argv);
324- cl::HideUnrelatedOptions(Cat);
325
326 llvm::InitializeAllTargetInfos();
327 llvm::InitializeAllTargetMCs();
328 llvm::InitializeAllDisassemblers();
329
330- cl::ParseCommandLineOptions(Argc, Argv,
331- "Sanitizer Coverage Processing Tool (sancov)\n\n"
332- " This tool can extract various coverage-related information from: \n"
333- " coverage-instrumented binary files, raw .sancov files and their "
334- "symbolized .symcov version.\n"
335- " Depending on chosen action the tool expects different input files:\n"
336- " -print-coverage-pcs - coverage-instrumented binary files\n"
337- " -print-coverage - .sancov files\n"
338- " <other actions> - .sancov files & corresponding binary "
339- "files, .symcov files\n"
340- );
341+ parseArgs(Argc, Argv);
342
343 // -print doesn't need object files.
344 if (Action == PrintAction) {
345 readAndPrintRawCoverage(ClInputFiles, outs());
346 return 0;
347- } else if (Action == PrintCovPointsAction) {
348+ }
349+ if (Action == PrintCovPointsAction) {
350 // -print-coverage-points doesn't need coverage files.
351 for (const std::string &ObjFile : ClInputFiles) {
352 printCovPoints(ObjFile, outs());
diff --git a/recipes-devtools/rust/rust-llvm_%.bbappend b/recipes-devtools/rust/rust-llvm_%.bbappend
index 952387e..cc5c255 100644
--- a/recipes-devtools/rust/rust-llvm_%.bbappend
+++ b/recipes-devtools/rust/rust-llvm_%.bbappend
@@ -1,6 +1,3 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" 1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2 2
3inherit clang-native 3TOOLCHAIN_NATIVE ?= "clang"
4
5# fix build with clang-18
6SRC_URI:append:runtime-llvm = " file://0001-sancov-Switch-to-OptTable-from-llvm-cl.patch"
diff --git a/recipes-devtools/rust/rust_%.bbappend b/recipes-devtools/rust/rust_%.bbappend
index 4d7022f..cc5c255 100644
--- a/recipes-devtools/rust/rust_%.bbappend
+++ b/recipes-devtools/rust/rust_%.bbappend
@@ -1,4 +1,3 @@
1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" 1FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2 2
3inherit clang-native 3TOOLCHAIN_NATIVE ?= "clang"
4
diff --git a/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator_git.bb b/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator_git.bb
deleted file mode 100644
index 78f025b..0000000
--- a/recipes-devtools/spirv-llvm-translator/spirv-llvm-translator_git.bb
+++ /dev/null
@@ -1,36 +0,0 @@
1LICENSE = "NCSA"
2LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=47e311aa9caedd1b3abf098bd7814d1d"
3
4BRANCH = "main"
5SRC_URI = "git://github.com/KhronosGroup/SPIRV-LLVM-Translator;protocol=https;branch=${BRANCH} \
6 git://github.com/KhronosGroup/SPIRV-Headers;protocol=https;destsuffix=git/SPIRV-Headers;name=headers;branch=main \
7 "
8
9PV = "18.0.0+git"
10SRCREV = "0e87aefecf7c5006e315427189bff87878e392c1"
11SRCREV_headers = "d3c2a6fa95ad463ca8044d7fc45557db381a6a64"
12
13SRCREV_FORMAT = "default_headers"
14
15S = "${WORKDIR}/git"
16
17DEPENDS = "spirv-tools clang"
18
19inherit cmake pkgconfig python3native
20
21# Specify any options you want to pass to cmake using EXTRA_OECMAKE:
22# for CMAKE_SHARED_LIBS=OFF see https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/1868
23EXTRA_OECMAKE = "\
24 -DBASE_LLVM_VERSION=${LLVMVERSION} \
25 -DBUILD_SHARED_LIBS=OFF \
26 -DCMAKE_BUILD_TYPE=Release \
27 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
28 -DCMAKE_SKIP_RPATH=ON \
29 -DLLVM_EXTERNAL_LIT=lit \
30 -DLLVM_INCLUDE_TESTS=ON \
31 -Wno-dev \
32 -DCCACHE_ALLOWED=FALSE \
33 -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${S}/SPIRV-Headers \
34"
35
36BBCLASSEXTEND = "native nativesdk"
diff --git a/scripts/devtool-clang.sh b/scripts/devtool-clang.sh
new file mode 100755
index 0000000..be8359a
--- /dev/null
+++ b/scripts/devtool-clang.sh
@@ -0,0 +1,48 @@
1#!/usr/bin/env sh
2# Clone the repository first if not already done locally
3# git clone https://github.com/kraj/llvm-project -b oe/main /mnt/b/yoe/master/workspace/sources/llvm-project
4#
5# if local repository exists then make a clone/copy
6# git clone /home/kraj/work/llvm-project /mnt/b/yoe/master/workspace/sources/llvm-project
7#
8layerloc="$(dirname "$0")/../conf/layer.conf"
9workspace="$(dirname "$0")/../../../workspace"
10
11# Change target and SDK host as needed
12target=riscv64
13sdkhost=x86_64
14
15origver=$(grep "LLVMVERSION =" < "$layerloc" | awk '{print $3}' | tr -d '"')
16
17major=$(grep -e "set(LLVM_VERSION_MAJOR [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//")
18minor=$(grep -e "set(LLVM_VERSION_MINOR [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//")
19patch=$(grep -e "set(LLVM_VERSION_PATCH [0-9]" < "$workspace"/sources/llvm-project/cmake/Modules/LLVMVersion.cmake| cut -d ' ' -f 4 | sed "s/)//")
20
21recipes="\
22llvm-project-source-$origver \
23clang \
24clang-cross-$target \
25clang-crosssdk-$sdkhost \
26clang-cross-canadian-$target \
27nativesdk-clang-glue \
28compiler-rt \
29compiler-rt-sanitizers \
30libclc \
31libcxx \
32openmp \
33"
34
35for recipe in $recipes; do
36 devtool modify -n "$recipe" "$workspace/sources/llvm-project"
37 sed -i "/pn-$recipe /p;s/pn-$recipe /pn-nativesdk-$recipe /g" "$workspace"/appends/"$recipe"*.bbappend
38 sed -i "/pn-$recipe /p;s/pn-$recipe /pn-$recipe-native /g" "$workspace"/appends/"$recipe"*.bbappend
39done
40
41for f in "$workspace"/appends/*.bbappend; do
42 { echo "MAJOR_VER = \"$major\"" ; echo "MINOR_VER = \"$minor\"" ; echo "PATCH_VER = \"$patch\"" ; } >> "$f"
43done
44
45sed -i -e "s/$origver/$major.$minor.$patch/g" "$workspace"/appends/llvm-project-source.bbappend
46sed -i -e "s/:pn-clang-cross-$target//g" "$workspace"/appends/clang-cross_git.bbappend
47sed -i -e "s/:pn-clang-cross-canadian-$target//g" "$workspace"/appends/clang-cross-canadian_git.bbappend
48sed -i -e "s/:pn-clang-crosssdk-$sdkhost//g" "$workspace"/appends/clang-crosssdk_git.bbappend