summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2025-04-17 18:25:18 -0700
committerKhem Raj <raj.khem@gmail.com>2025-05-05 10:24:26 -0700
commitb6d7ecd8905b0a41c9f06c017d16851c784f02cc (patch)
tree65926761f78e4a883cdcd7eadeeb4a35faa92c12
parentc378a777aefd192eae797ef633de817e29426667 (diff)
downloadmeta-clang-b6d7ecd8905b0a41c9f06c017d16851c784f02cc.tar.gz
clang: Delete recipes
They are in core layer now Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--recipes-devtools/clang/clang-cross-canadian_git.bb36
-rw-r--r--recipes-devtools/clang/clang-cross_git.bb39
-rw-r--r--recipes-devtools/clang/clang-crosssdk_git.bb34
-rw-r--r--recipes-devtools/clang/clang.inc24
-rw-r--r--recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch60
-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-cmake-Fix-configure-for-packages-using-find_package.patch117
-rw-r--r--recipes-devtools/clang/clang/0015-clang-Fix-resource-dir-location-for-cross-toolchains.patch50
-rw-r--r--recipes-devtools/clang/clang/0016-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch79
-rw-r--r--recipes-devtools/clang/clang/0017-clang-Use-python3-in-python-scripts.patch35
-rw-r--r--recipes-devtools/clang/clang/0018-For-x86_64-set-Yocto-based-GCC-install-search-path.patch70
-rw-r--r--recipes-devtools/clang/clang/0019-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch32
-rw-r--r--recipes-devtools/clang/clang/0020-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch68
-rw-r--r--recipes-devtools/clang/clang/0021-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch28
-rw-r--r--recipes-devtools/clang/clang/0022-libunwind-Added-unw_backtrace-method.patch56
-rw-r--r--recipes-devtools/clang/clang/0023-clang-Do-not-use-install-relative-libc-headers.patch34
-rw-r--r--recipes-devtools/clang/clang/0024-Fix-lib-paths-for-OpenEmbedded-Host.patch79
-rw-r--r--recipes-devtools/clang/clang/0025-Correct-library-search-path-for-OpenEmbedded-Host.patch84
-rw-r--r--recipes-devtools/clang/clang/0026-lldb-Link-with-libatomic-on-x86.patch33
-rw-r--r--recipes-devtools/clang/clang/0027-compiler-rt-Enable-__int128-for-ppc32.patch73
-rw-r--r--recipes-devtools/clang/clang/0028-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch62
-rw-r--r--recipes-devtools/clang/clang/0029-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch46
-rw-r--r--recipes-devtools/clang/clang/0030-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch43
-rw-r--r--recipes-devtools/clang/clang/0031-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch81
-rw-r--r--recipes-devtools/clang/clang/0032-clang-llvm-Add-OE-specific-ABI-triple-for-N32-ABI.patch78
-rw-r--r--recipes-devtools/clang/clang/0033-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch93
-rw-r--r--recipes-devtools/clang/clang/0034-scan-build-py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch92
-rw-r--r--recipes-devtools/clang/clang/0035-compiler-rt-Do-not-pass-target-to-clang-compiler.patch29
-rw-r--r--recipes-devtools/clang/clang/0036-Fix-build-on-ppc64-musl.patch97
-rw-r--r--recipes-devtools/clang/clang/0037-clangd-Add-a-build-option-to-disable-building-dexp.patch84
-rw-r--r--recipes-devtools/clang/clang_git.bb499
-rw-r--r--recipes-devtools/clang/common-source.inc17
-rw-r--r--recipes-devtools/clang/common.inc71
-rw-r--r--recipes-devtools/clang/compiler-rt-sanitizers_git.bb129
-rw-r--r--recipes-devtools/clang/compiler-rt_git.bb130
-rw-r--r--recipes-devtools/clang/libclc_git.bb38
-rw-r--r--recipes-devtools/clang/libcxx_git.bb117
-rw-r--r--recipes-devtools/clang/llvm-project-source.bb12
-rw-r--r--recipes-devtools/clang/llvm-project-source.inc99
-rw-r--r--recipes-devtools/clang/nativesdk-clang-glue.bb36
-rw-r--r--recipes-devtools/clang/openmp_git.bb67
52 files changed, 0 insertions, 3792 deletions
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 81935b2..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
4SUMMARY = "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/nativesdk-cross-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 505f3b1..0000000
--- a/recipes-devtools/clang/clang-cross_git.bb
+++ /dev/null
@@ -1,39 +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
4SUMMARY = "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/cross-binutils"
15
16#INHIBIT_PACKAGE_STRIP = "1"
17INHIBIT_SYSROOT_STRIP = "1"
18do_install() {
19 install -d ${D}${bindir}
20 for tool in clang-tidy lld ld.lld llvm-profdata \
21 llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \
22 llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov
23 do
24 ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool
25 done
26 install -m 0755 ${STAGING_BINDIR_NATIVE}/clang ${D}${bindir}/${TARGET_PREFIX}clang
27 install -m 0755 ${STAGING_BINDIR_NATIVE}/clang ${D}${bindir}/${TARGET_PREFIX}clang++
28}
29SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-lld *-ld.lld \
30 *-llvm-nm *-llvm-ar *-llvm-as *-llvm-ranlib *-llvm-strip \
31 *-llvm-objcopy *-llvm-objdump *-llvm-readelf *-llvm-addr2line \
32 *-llvm-dwp *-llvm-size *-llvm-strings *-llvm-cov"
33
34SYSROOT_PREPROCESS_FUNCS += "clangcross_sysroot_preprocess"
35
36clangcross_sysroot_preprocess () {
37 sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
38}
39PACKAGES = ""
diff --git a/recipes-devtools/clang/clang-crosssdk_git.bb b/recipes-devtools/clang/clang-crosssdk_git.bb
deleted file mode 100644
index c5e2867..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
4SUMMARY = "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-${SDK_SYS}"
10
11require clang.inc
12require common-source.inc
13inherit crosssdk
14DEPENDS += "clang-native nativesdk-clang-glue virtual/nativesdk-cross-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 bb152d2..0000000
--- a/recipes-devtools/clang/clang.inc
+++ /dev/null
@@ -1,24 +0,0 @@
1LLVM_RELEASE = ""
2LLVM_DIR = "llvm${LLVM_RELEASE}"
3
4LLVM_HTTP ?= "https://github.com/llvm"
5
6MAJOR_VER = "20"
7MINOR_VER = "1"
8PATCH_VER = "2"
9# could be 'rcX' or 'git' or empty ( for release )
10VER_SUFFIX = ""
11
12PV = "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}${VER_SUFFIX}"
13
14LLVMMD5SUM = "8a15a0759ef07f2682d2ba4b893c9afe"
15CLANGMD5SUM = "ff42885ed2ab98f1ecb8c1fc41205343"
16LLDMD5SUM = "ae7dc7c027b1fa89b5b013d391d3ee2b"
17LLDBMD5SUM = "2e0d44968471fcde980034dbb826bea9"
18
19LLVM_LIBDIR_SUFFIX = "${@d.getVar('baselib').replace('lib', '')}"
20
21# set the default pigz thread
22export PIGZ = "-p ${@oe.utils.cpu_count(at_least=2)}"
23
24require 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 9c8baa9..0000000
--- a/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
+++ /dev/null
@@ -1,60 +0,0 @@
1From dfb3bf25e32b44efedf3ded9f6511e83a93a8f6e 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 | 15 ++++++++++-----
18 1 file changed, 10 insertions(+), 5 deletions(-)
19
20diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
21index 6dcfc51e5532..32478a62a058 100644
22--- a/libcxxabi/CMakeLists.txt
23+++ b/libcxxabi/CMakeLists.txt
24@@ -465,7 +465,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@@ -476,18 +476,23 @@ 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 add_custom_target(cxxabi-test-depends
51 COMMENT "Build dependencies required to run the libc++abi test suite.")
52
53+set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
54+ "Specify path to libunwind includes." FORCE)
55+set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
56+ "Specify path to libunwind source." FORCE)
57+
58 # Add source code. This also contains all of the logic for deciding linker flags
59 # soname, etc...
60 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 6082b80..0000000
--- a/recipes-devtools/clang/clang/0002-compiler-rt-support-a-new-embedded-linux-target.patch
+++ /dev/null
@@ -1,309 +0,0 @@
1From 2fe113db0952e97d85b2c3ce92a1c2145f542801 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 96003c7..0000000
--- a/recipes-devtools/clang/clang/0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
+++ /dev/null
@@ -1,44 +0,0 @@
1From 2513eec8805008ff474f4ffcb0c579b9225535f9 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 2c52788de56a..fe409704acc3 100644
25--- a/compiler-rt/CMakeLists.txt
26+++ b/compiler-rt/CMakeLists.txt
27@@ -107,7 +107,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 2bac9c1..0000000
--- a/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ /dev/null
@@ -1,90 +0,0 @@
1From 54247325f65f7f8b97f73910548660402d64583b 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 db566b8ee610..578161f9c978 100644
18--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
19+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
20@@ -1467,6 +1467,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@@ -1545,7 +1548,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@@ -1562,6 +1567,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@@ -1587,6 +1595,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@@ -1827,6 +1838,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@@ -2334,6 +2348,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@@ -2559,6 +2576,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 642e8f0..0000000
--- a/recipes-devtools/clang/clang/0005-llvm-allow-env-override-of-exe-and-libdir-path.patch
+++ /dev/null
@@ -1,71 +0,0 @@
1From ca2f7d327c1c7f63d0c438c5ad404e97c3f80428 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 3079f38..0000000
--- a/recipes-devtools/clang/clang/0006-clang-driver-Check-sysroot-for-ldso-path.patch
+++ /dev/null
@@ -1,75 +0,0 @@
1From 9767cb6318047148affd5217ffaa27519a3cf921 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 0767fe6c5879..4d0c7e63c68e 100644
19--- a/clang/lib/Driver/ToolChains/Linux.cpp
20+++ b/clang/lib/Driver/ToolChains/Linux.cpp
21@@ -523,7 +523,11 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
22 Triple.getEnvironment() == llvm::Triple::GNUEABIHFT64 ||
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@@ -578,11 +582,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 case llvm::Triple::riscv64: {
54@@ -600,6 +612,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@@ -614,6 +630,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 68abd21..0000000
--- a/recipes-devtools/clang/clang/0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From 223fe5ca4f6e2b8e22aa8e900a6e35c34dc68c1f 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 f56eeda3cb5f..9f7b9e8d42a8 100644
18--- a/clang/lib/Driver/ToolChains/Gnu.cpp
19+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
20@@ -631,6 +631,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 6d8f47c..0000000
--- a/recipes-devtools/clang/clang/0008-clang-Prepend-trailing-to-sysroot.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 17aa070ae827e6cd1bba48a655c8e896bda41da0 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 4d0c7e63c68e..6c28c8408605 100644
29--- a/clang/lib/Driver/ToolChains/Linux.cpp
30+++ b/clang/lib/Driver/ToolChains/Linux.cpp
31@@ -216,7 +216,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 620a5f0..0000000
--- a/recipes-devtools/clang/clang/0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 2fbce9b799992f1efa3f4b9e72a6de22c69f6a6b 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 acf9d264d631..3e46c88e95cb 100644
20--- a/clang/lib/Driver/ToolChain.cpp
21+++ b/clang/lib/Driver/ToolChain.cpp
22@@ -16,6 +16,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@@ -708,7 +709,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 63678fd..0000000
--- a/recipes-devtools/clang/clang/0010-clang-Define-releative-gcc-installation-dir.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1From 5f4f290d77ebc712996acb0a67b5132216020472 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 9f7b9e8d42a8..4f177aa8771e 100644
19--- a/clang/lib/Driver/ToolChains/Gnu.cpp
20+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
21@@ -2871,19 +2871,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 66f4886..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 146e389fec4739e562eb0a8fe7aeb3f6861ae6e8 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 ae635fb6a180..255e7e0b7150 100644
25--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
26+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
27@@ -2254,6 +2254,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 a029d7d..0000000
--- a/recipes-devtools/clang/clang/0012-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1From 9f4b973e7cab243991856be1f162a7e38517b611 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 3b31d3e218a3..a07ab45878fd 100644
15--- a/llvm/cmake/modules/CrossCompile.cmake
16+++ b/llvm/cmake/modules/CrossCompile.cmake
17@@ -100,6 +100,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 14145e7..0000000
--- a/recipes-devtools/clang/clang/0013-Check-for-atomic-double-intrinsics.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 3cea4e8ef2f789e6988cb9caf6b28dbc240d93bd 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-cmake-Fix-configure-for-packages-using-find_package.patch b/recipes-devtools/clang/clang/0014-cmake-Fix-configure-for-packages-using-find_package.patch
deleted file mode 100644
index 94c056a..0000000
--- a/recipes-devtools/clang/clang/0014-cmake-Fix-configure-for-packages-using-find_package.patch
+++ /dev/null
@@ -1,117 +0,0 @@
1From 93141cee493022d9f39dbd1f5f0bb0a1110ac829 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] cmake: Fix configure for packages using find_package()
5
6Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git])
7that depends on LLVM/Clang tries to run cmake find_package() during
8do_configure, it will fail with a similar error:
9
10| The imported target "llvm-tblgen" references the file
11| ".../recipe-sysroot/usr/bin/llvm-tblgen"
12|
13| but this file does not exist. Possible reasons include:
14| * The file was deleted, renamed, or moved to another location.
15| * An install or uninstall procedure did not complete successfully.
16| * The installation package was faulty and contained
17| ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake"
18| but not all the files it references.
19
20This is due to the fact that currently the cmake scripts look for target
21binaries in sysroot. Work around this by not exporting the target binaries in
22Exports-* cmake files.
23
24Upstream-Status: Inappropriate [oe-specific]
25
26Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
27---
28 clang/cmake/modules/AddClang.cmake | 2 --
29 llvm/cmake/modules/AddLLVM.cmake | 9 ++-------
30 llvm/cmake/modules/TableGen.cmake | 6 ------
31 3 files changed, 2 insertions(+), 15 deletions(-)
32
33diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
34index cdc8bd5cd503..5faa9117a30f 100644
35--- a/clang/cmake/modules/AddClang.cmake
36+++ b/clang/cmake/modules/AddClang.cmake
37@@ -182,7 +182,6 @@ macro(add_clang_tool name)
38 if (CLANG_BUILD_TOOLS)
39 get_target_export_arg(${name} Clang export_to_clangtargets)
40 install(TARGETS ${name}
41- ${export_to_clangtargets}
42 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
43 COMPONENT ${name})
44
45@@ -191,7 +190,6 @@ macro(add_clang_tool name)
46 DEPENDS ${name}
47 COMPONENT ${name})
48 endif()
49- set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
50 endif()
51 endif()
52 set_target_properties(${name} PROPERTIES XCODE_GENERATE_SCHEME ON)
53diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
54index d3e9377c8d2f..fe22d6f2b35a 100644
55--- a/llvm/cmake/modules/AddLLVM.cmake
56+++ b/llvm/cmake/modules/AddLLVM.cmake
57@@ -1492,7 +1492,6 @@ macro(llvm_add_tool project name)
58 if( LLVM_BUILD_TOOLS )
59 get_target_export_arg(${name} ${project} export_to_llvmexports)
60 install(TARGETS ${name}
61- ${export_to_llvmexports}
62 RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
63 COMPONENT ${name})
64
65@@ -1503,10 +1502,8 @@ macro(llvm_add_tool project name)
66 endif()
67 endif()
68 endif()
69- if( LLVM_BUILD_TOOLS )
70- string(TOUPPER "${project}" project_upper)
71- set_property(GLOBAL APPEND PROPERTY ${project_upper}_EXPORTS ${name})
72- endif()
73+ string(TOUPPER "${project}" project_upper)
74+ set_target_properties(${name} PROPERTIES FOLDER "Tools")
75 endif()
76 get_subproject_title(subproject_title)
77 set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Tools")
78@@ -1556,7 +1553,6 @@ macro(add_llvm_utility name)
79 if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
80 get_target_export_arg(${name} LLVM export_to_llvmexports)
81 install(TARGETS ${name}
82- ${export_to_llvmexports}
83 RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
84 COMPONENT ${name})
85
86@@ -1565,7 +1561,6 @@ macro(add_llvm_utility name)
87 DEPENDS ${name}
88 COMPONENT ${name})
89 endif()
90- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
91 elseif(LLVM_BUILD_UTILS)
92 set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
93 endif()
94diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
95index ffcc718b4777..a76f28e74b86 100644
96--- a/llvm/cmake/modules/TableGen.cmake
97+++ b/llvm/cmake/modules/TableGen.cmake
98@@ -232,12 +232,7 @@ macro(add_tablegen target project)
99
100 if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND
101 (LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS))
102- set(export_arg)
103- if(ADD_TABLEGEN_EXPORT)
104- get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg)
105- endif()
106 install(TARGETS ${target}
107- ${export_arg}
108 COMPONENT ${target}
109 RUNTIME DESTINATION "${ADD_TABLEGEN_DESTINATION}")
110 if(NOT LLVM_ENABLE_IDE)
111@@ -248,6 +243,5 @@ macro(add_tablegen target project)
112 endif()
113 if(ADD_TABLEGEN_EXPORT)
114 string(TOUPPER ${ADD_TABLEGEN_EXPORT} export_upper)
115- set_property(GLOBAL APPEND PROPERTY ${export_upper}_EXPORTS ${target})
116 endif()
117 endmacro()
diff --git a/recipes-devtools/clang/clang/0015-clang-Fix-resource-dir-location-for-cross-toolchains.patch b/recipes-devtools/clang/clang/0015-clang-Fix-resource-dir-location-for-cross-toolchains.patch
deleted file mode 100644
index 8605db0..0000000
--- a/recipes-devtools/clang/clang/0015-clang-Fix-resource-dir-location-for-cross-toolchains.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From 7c6cb0a5d35f1a757165a44aa5d2d1d16af32205 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 | 9 ++++++++-
20 1 file changed, 8 insertions(+), 1 deletion(-)
21
22diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
23index 87855fdb7997..036c9d09df26 100644
24--- a/clang/lib/Driver/Driver.cpp
25+++ b/clang/lib/Driver/Driver.cpp
26@@ -176,6 +176,7 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath) {
27
28 // Dir is bin/ or lib/, depending on where BinaryPath is.
29 StringRef Dir = llvm::sys::path::parent_path(BinaryPath);
30+ StringRef LastDirName = llvm::sys::path::filename(Dir);
31 SmallString<128> P(Dir);
32
33 StringRef ConfiguredResourceDir(CLANG_RESOURCE_DIR);
34@@ -187,9 +188,15 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath) {
35 // With a static-library build of libclang, LibClangPath will contain the
36 // path of the embedding binary, which for LLVM binaries will be in bin/.
37 // ../lib gets us to lib/ in both cases.
38- P = llvm::sys::path::parent_path(Dir);
39 // This search path is also created in the COFF driver of lld, so any
40 // changes here also needs to happen in lld/COFF/Driver.cpp
41+
42+ // OE cross toolchains are installed, by default, in a subdir of bin.
43+ if (LastDirName == "bin") {
44+ P = llvm::sys::path::parent_path(Dir);
45+ } else {
46+ P = llvm::sys::path::parent_path(llvm::sys::path::parent_path(Dir));
47+ }
48 llvm::sys::path::append(P, CLANG_INSTALL_LIBDIR_BASENAME, "clang",
49 CLANG_VERSION_MAJOR_STRING);
50 }
diff --git a/recipes-devtools/clang/clang/0016-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch b/recipes-devtools/clang/clang/0016-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
deleted file mode 100644
index 084f39d..0000000
--- a/recipes-devtools/clang/clang/0016-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1From a80ccd52d2230ec4df68506910d6c836f02af591 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 6c28c8408605..32414810b6d7 100644
23--- a/clang/lib/Driver/ToolChains/Linux.cpp
24+++ b/clang/lib/Driver/ToolChains/Linux.cpp
25@@ -524,8 +524,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@@ -582,8 +582,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@@ -591,8 +591,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@@ -612,8 +612,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@@ -630,8 +630,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/0017-clang-Use-python3-in-python-scripts.patch b/recipes-devtools/clang/clang/0017-clang-Use-python3-in-python-scripts.patch
deleted file mode 100644
index 0d5d240..0000000
--- a/recipes-devtools/clang/clang/0017-clang-Use-python3-in-python-scripts.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 34f43ca6a4757a6a80f92c56be340ca4de3b2a31 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/0018-For-x86_64-set-Yocto-based-GCC-install-search-path.patch b/recipes-devtools/clang/clang/0018-For-x86_64-set-Yocto-based-GCC-install-search-path.patch
deleted file mode 100644
index a928d6e..0000000
--- a/recipes-devtools/clang/clang/0018-For-x86_64-set-Yocto-based-GCC-install-search-path.patch
+++ /dev/null
@@ -1,70 +0,0 @@
1From b0a3357f0e3a38a2aa5eebfc73fa9cc531e9a9e1 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 4f177aa8771e..6873892372ea 100644
61--- a/clang/lib/Driver/ToolChains/Gnu.cpp
62+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
63@@ -2451,6 +2451,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
64 "x86_64-pc-linux-gnu", "x86_64-redhat-linux6E",
65 "x86_64-redhat-linux", "x86_64-suse-linux",
66 "x86_64-manbo-linux-gnu", "x86_64-slackware-linux",
67+ "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES
68 "x86_64-unknown-linux", "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/0019-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch b/recipes-devtools/clang/clang/0019-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch
deleted file mode 100644
index e7f16f6..0000000
--- a/recipes-devtools/clang/clang/0019-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From a4723752be1e9398d5697741ca0be721d90f814e 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 e9e6f130f757..97f426dd863b 100644
22--- a/llvm/lib/TargetParser/Triple.cpp
23+++ b/llvm/lib/TargetParser/Triple.cpp
24@@ -663,7 +663,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
25 .Case("mesa", Triple::Mesa)
26 .Case("suse", Triple::SUSE)
27 .Case("oe", Triple::OpenEmbedded)
28- .Case("intel", Triple::Intel)
29+ .Case("intel", Triple::Intel) //CLANG_EXTRA_OE_VENDORS_CASES
30 .Default(Triple::UnknownVendor);
31 }
32
diff --git a/recipes-devtools/clang/clang/0020-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch b/recipes-devtools/clang/clang/0020-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch
deleted file mode 100644
index bb7b01b..0000000
--- a/recipes-devtools/clang/clang/0020-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch
+++ /dev/null
@@ -1,68 +0,0 @@
1From 71f429239846d67c331aee98d84d37f2c7c07c6c 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/0021-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch b/recipes-devtools/clang/clang/0021-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch
deleted file mode 100644
index 6c7daff..0000000
--- a/recipes-devtools/clang/clang/0021-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1From 98d888c1f966d7758690b2a3b3a7fa7b47c58ebf 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 32414810b6d7..a9ee2b671f2e 100644
17--- a/clang/lib/Driver/ToolChains/Linux.cpp
18+++ b/clang/lib/Driver/ToolChains/Linux.cpp
19@@ -727,6 +727,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/0022-libunwind-Added-unw_backtrace-method.patch b/recipes-devtools/clang/clang/0022-libunwind-Added-unw_backtrace-method.patch
deleted file mode 100644
index be788b7..0000000
--- a/recipes-devtools/clang/clang/0022-libunwind-Added-unw_backtrace-method.patch
+++ /dev/null
@@ -1,56 +0,0 @@
1From bb3cadafda39177d2a36598e1430bc2ff97a3d37 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 cf39ec5f7dbd..1896f20d57f8 100644
28--- a/libunwind/src/libunwind.cpp
29+++ b/libunwind/src/libunwind.cpp
30@@ -431,6 +431,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/0023-clang-Do-not-use-install-relative-libc-headers.patch b/recipes-devtools/clang/clang/0023-clang-Do-not-use-install-relative-libc-headers.patch
deleted file mode 100644
index 25dec75..0000000
--- a/recipes-devtools/clang/clang/0023-clang-Do-not-use-install-relative-libc-headers.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 89348e6c2cf3f65eb244c5b01145309355573ade 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 6873892372ea..b5485970a0c5 100644
20--- a/clang/lib/Driver/ToolChains/Gnu.cpp
21+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
22@@ -3275,8 +3275,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/0024-Fix-lib-paths-for-OpenEmbedded-Host.patch b/recipes-devtools/clang/clang/0024-Fix-lib-paths-for-OpenEmbedded-Host.patch
deleted file mode 100644
index d450576..0000000
--- a/recipes-devtools/clang/clang/0024-Fix-lib-paths-for-OpenEmbedded-Host.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1From a3f6769e9da81aa359b2f013b88639dc0c8ca5ea 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 b5485970a0c5..868d32f501e8 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@@ -2861,6 +2862,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@@ -2878,7 +2880,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/0025-Correct-library-search-path-for-OpenEmbedded-Host.patch b/recipes-devtools/clang/clang/0025-Correct-library-search-path-for-OpenEmbedded-Host.patch
deleted file mode 100644
index 94f9c2c..0000000
--- a/recipes-devtools/clang/clang/0025-Correct-library-search-path-for-OpenEmbedded-Host.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1From 3bf683abe028c13dfdb4156eefb210741e43986a 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 b4d485dac8a2..ac0bf25b7c63 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@@ -139,6 +140,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 3cc79535de8d..595656179bdc 100644
63--- a/clang/lib/Driver/Distro.cpp
64+++ b/clang/lib/Driver/Distro.cpp
65@@ -43,6 +43,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 a9ee2b671f2e..ec1705af3cbd 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/0026-lldb-Link-with-libatomic-on-x86.patch b/recipes-devtools/clang/clang/0026-lldb-Link-with-libatomic-on-x86.patch
deleted file mode 100644
index 6b5998c..0000000
--- a/recipes-devtools/clang/clang/0026-lldb-Link-with-libatomic-on-x86.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 8b73ff82e4eec89090bd34d3fb0732321b418dcc 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 6954a2508ffe..b8bf8c07fefb 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/0027-compiler-rt-Enable-__int128-for-ppc32.patch b/recipes-devtools/clang/clang/0027-compiler-rt-Enable-__int128-for-ppc32.patch
deleted file mode 100644
index 1dafc0a..0000000
--- a/recipes-devtools/clang/clang/0027-compiler-rt-Enable-__int128-for-ppc32.patch
+++ /dev/null
@@ -1,73 +0,0 @@
1From 945c633b604d72ec307307a498cc6b206f810f4b 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 19316c52d12c..cb276311b290 100644
15--- a/compiler-rt/lib/builtins/CMakeLists.txt
16+++ b/compiler-rt/lib/builtins/CMakeLists.txt
17@@ -720,11 +720,9 @@ set(mips64el_SOURCES ${GENERIC_TF_SOURCES}
18
19 set(nvptx64_SOURCES ${GENERIC_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@@ -739,14 +737,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 cpu_model/riscv.c
49@@ -904,9 +903,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 48862f364217..cc47d3e33f67 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/0028-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch b/recipes-devtools/clang/clang/0028-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch
deleted file mode 100644
index 1afdf92..0000000
--- a/recipes-devtools/clang/clang/0028-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch
+++ /dev/null
@@ -1,62 +0,0 @@
1From 4ff4be1d645e3390431435f82d7bb567bd8d890f 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 a6d8a2581886..5b461547bdde 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( WIN32 )
45@@ -325,7 +325,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@@ -339,7 +339,7 @@ if(LLVM_ENABLE_ZSTD)
55 endif()
56 if (zstd_target STREQUAL zstd::libzstd_shared)
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 else()
61 set(llvm_system_libs ${llvm_system_libs} "${zstd_STATIC_LIBRARY}")
62 endif()
diff --git a/recipes-devtools/clang/clang/0029-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch b/recipes-devtools/clang/clang/0029-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch
deleted file mode 100644
index 52260bc..0000000
--- a/recipes-devtools/clang/clang/0029-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1From f097441a66563be067016760706e0266494db800 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 1a7d9e64048e..854a87e17236 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,6 +98,18 @@ 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 = SANITIZER_ANDROID
37 ? FIRST_32_SECOND_64(104, 128)
38 # if defined(_ABIN32) && _MIPS_SIM == _ABIN32
39@@ -106,6 +118,7 @@ const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
40 : FIRST_32_SECOND_64(160, 216);
41 # endif
42 const unsigned struct_kernel_stat64_sz = 104;
43+#endif
44 #elif defined(__s390__) && !defined(__s390x__)
45 const unsigned struct_kernel_stat_sz = 64;
46 const unsigned struct_kernel_stat64_sz = 104;
diff --git a/recipes-devtools/clang/clang/0030-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch b/recipes-devtools/clang/clang/0030-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch
deleted file mode 100644
index 8e36538..0000000
--- a/recipes-devtools/clang/clang/0030-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From ae2ad23eefd3b8645f7b77431d621f918faea48a 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 57966403c92a..efa83f30eca0 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/0031-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch b/recipes-devtools/clang/clang/0031-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch
deleted file mode 100644
index 764cf6e..0000000
--- a/recipes-devtools/clang/clang/0031-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch
+++ /dev/null
@@ -1,81 +0,0 @@
1From 7d99373f68757b17fe88bcf24b978c2721bf181e 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 868d32f501e8..beed8d34a127 100644
59--- a/clang/lib/Driver/ToolChains/Gnu.cpp
60+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
61@@ -2428,7 +2428,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
62 static const char *const AArch64beLibDirs[] = {"/lib"};
63 static const char *const AArch64beTriples[] = {"aarch64_be-none-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 ec1705af3cbd..75b32624b778 100644
72--- a/clang/lib/Driver/ToolChains/Linux.cpp
73+++ b/clang/lib/Driver/ToolChains/Linux.cpp
74@@ -199,6 +199,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/0032-clang-llvm-Add-OE-specific-ABI-triple-for-N32-ABI.patch b/recipes-devtools/clang/clang/0032-clang-llvm-Add-OE-specific-ABI-triple-for-N32-ABI.patch
deleted file mode 100644
index 27b4652..0000000
--- a/recipes-devtools/clang/clang/0032-clang-llvm-Add-OE-specific-ABI-triple-for-N32-ABI.patch
+++ /dev/null
@@ -1,78 +0,0 @@
1From 28f2573afd688996d73476e50f61dda416236bda Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 3 Feb 2024 16:47:10 -0800
4Subject: [PATCH] clang/llvm: Add OE specific ABI triple for N32 ABI
5
6Its gnun32 when using OE
7
8Upstream-Status: Inappropriate [OE-Specific]
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 clang/lib/Driver/ToolChains/Gnu.cpp | 1 +
12 clang/lib/Driver/ToolChains/Linux.cpp | 4 ++--
13 llvm/lib/TargetParser/Triple.cpp | 4 +++-
14 3 files changed, 6 insertions(+), 3 deletions(-)
15
16diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
17index beed8d34a127..c47b93a4e142 100644
18--- a/clang/lib/Driver/ToolChains/Gnu.cpp
19+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
20@@ -2491,6 +2491,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
21
22 static const char *const MIPSN32LibDirs[] = {"/lib32"};
23 static const char *const MIPSN32Triples[] = {"mips64-linux-gnuabin32",
24+ "mips64-linux-gnun32",
25 "mipsisa64r6-linux-gnuabin32"};
26 static const char *const MIPSN32ELLibDirs[] = {"/lib32"};
27 static const char *const MIPSN32ELTriples[] = {
28diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
29index 75b32624b778..b1d9c171df81 100644
30--- a/clang/lib/Driver/ToolChains/Linux.cpp
31+++ b/clang/lib/Driver/ToolChains/Linux.cpp
32@@ -139,7 +139,7 @@ std::string Linux::getMultiarchTriple(const Driver &D,
33 return IsMipsR6 ? "mipsisa32r6el-linux-gnu" : "mipsel-linux-gnu";
34 case llvm::Triple::mips64: {
35 std::string MT = std::string(IsMipsR6 ? "mipsisa64r6" : "mips64") +
36- "-linux-" + (IsMipsN32Abi ? "gnuabin32" : "gnuabi64");
37+ "-linux-" + (IsMipsN32Abi ? "gnun32" : "gnu");
38 if (D.getVFS().exists(concat(SysRoot, "/lib", MT)))
39 return MT;
40 if (D.getVFS().exists(concat(SysRoot, "/lib/mips64-linux-gnu")))
41@@ -148,7 +148,7 @@ std::string Linux::getMultiarchTriple(const Driver &D,
42 }
43 case llvm::Triple::mips64el: {
44 std::string MT = std::string(IsMipsR6 ? "mipsisa64r6el" : "mips64el") +
45- "-linux-" + (IsMipsN32Abi ? "gnuabin32" : "gnuabi64");
46+ "-linux-" + (IsMipsN32Abi ? "gnun32" : "gnu");
47 if (D.getVFS().exists(concat(SysRoot, "/lib", MT)))
48 return MT;
49 if (D.getVFS().exists(concat(SysRoot, "/lib/mips64el-linux-gnu")))
50diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
51index 97f426dd863b..dc57d5ff2d4a 100644
52--- a/llvm/lib/TargetParser/Triple.cpp
53+++ b/llvm/lib/TargetParser/Triple.cpp
54@@ -336,7 +336,7 @@ StringRef Triple::getEnvironmentTypeName(EnvironmentType Kind) {
55 case GNU: return "gnu";
56 case GNUT64: return "gnut64";
57 case GNUABI64: return "gnuabi64";
58- case GNUABIN32: return "gnuabin32";
59+ case GNUABIN32: return "gnun32";
60 case GNUEABI: return "gnueabi";
61 case GNUEABIT64: return "gnueabit64";
62 case GNUEABIHF: return "gnueabihf";
63@@ -719,6 +719,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) {
64 .StartsWith("eabihf", Triple::EABIHF)
65 .StartsWith("eabi", Triple::EABI)
66 .StartsWith("gnuabin32", Triple::GNUABIN32)
67+ .StartsWith("gnun32", Triple::GNUABIN32)
68 .StartsWith("gnuabi64", Triple::GNUABI64)
69 .StartsWith("gnueabihft64", Triple::GNUEABIHFT64)
70 .StartsWith("gnueabihf", Triple::GNUEABIHF)
71@@ -1035,6 +1036,7 @@ Triple::Triple(const Twine &Str)
72 Environment =
73 StringSwitch<Triple::EnvironmentType>(Components[0])
74 .StartsWith("mipsn32", Triple::GNUABIN32)
75+ .StartsWith("mips64-n32", Triple::GNUABIN32)
76 .StartsWith("mips64", Triple::GNUABI64)
77 .StartsWith("mipsisa64", Triple::GNUABI64)
78 .StartsWith("mipsisa32", Triple::GNU)
diff --git a/recipes-devtools/clang/clang/0033-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch b/recipes-devtools/clang/clang/0033-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch
deleted file mode 100644
index 37fa818..0000000
--- a/recipes-devtools/clang/clang/0033-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch
+++ /dev/null
@@ -1,93 +0,0 @@
1From c826b0d4aff98d44672ded6be2f6b04b15554e3f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 14 May 2024 22:04:43 -0700
4Subject: [PATCH] llvm: Add libunwind.pc.in and llvm-config scripts
5
6These are added by OE project
7
8Upstream-Status: Inappropriate [ OE-Specific ]
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 libunwind/libunwind.pc.in | 9 ++++++
13 llvm/tools/llvm-config/llvm-config | 52 ++++++++++++++++++++++++++++++
14 2 files changed, 61 insertions(+)
15 create mode 100644 libunwind/libunwind.pc.in
16 create mode 100644 llvm/tools/llvm-config/llvm-config
17
18diff --git a/libunwind/libunwind.pc.in b/libunwind/libunwind.pc.in
19new file mode 100644
20index 000000000000..a93d676604f9
21--- /dev/null
22+++ b/libunwind/libunwind.pc.in
23@@ -0,0 +1,9 @@
24+prefix=/usr
25+exec_prefix=/usr
26+libdir=@LIBDIR@
27+includedir=/usr/include
28+
29+Name: libunwind
30+Description: libunwind base library
31+Version: @VERSION@
32+Libs: -lunwind
33diff --git a/llvm/tools/llvm-config/llvm-config b/llvm/tools/llvm-config/llvm-config
34new file mode 100644
35index 000000000000..6a0dd54b8eab
36--- /dev/null
37+++ b/llvm/tools/llvm-config/llvm-config
38@@ -0,0 +1,55 @@
39+#!/bin/bash
40+#
41+# Wrapper script for llvm-config. Supplies the right environment variables
42+# for the target and delegates to the native llvm-config for anything else. This
43+# is needed because arguments like --ldflags, --cxxflags, etc. are set by the
44+# native compile rather than the target compile.
45+#
46+SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
47+NEXT_LLVM_CONFIG="$(which -a llvm-config | sed -n 2p)"
48+export YOCTO_ALTERNATE_EXE_PATH="${YOCTO_ALTERNATE_EXE_PATH:="$(readlink -f "$SCRIPT_DIR/../llvm-config")"}"
49+if [ -n "$( echo $base_libdir | sed -n '/lib64/p')" ]; then
50+ export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib64"}"
51+else
52+ export YOCTO_ALTERNATE_LIBDIR="${YOCTO_ALTERNATE_LIBDIR:="/lib"}"
53+fi
54+if [[ $# == 0 ]]; then
55+ exec "$NEXT_LLVM_CONFIG"
56+fi
57+
58+remain=""
59+output=""
60+for arg in "$@"; do
61+ case "$arg" in
62+ --cppflags)
63+ output="${output} ${CPPFLAGS}"
64+ ;;
65+ --cflags)
66+ output="${output} ${CFLAGS}"
67+ ;;
68+ --cxxflags)
69+ output="${output} ${CXXFLAGS}"
70+ ;;
71+ --libdir)
72+ output="${output} ${libdir}"
73+ ;;
74+ --ldflags)
75+ output="${output} ${LDFLAGS}"
76+ ;;
77+ --shared-mode)
78+ output="${output} shared"
79+ ;;
80+ --link-shared)
81+ break
82+ ;;
83+ *)
84+ remain="${remain} ${arg}"
85+ ;;
86+ esac
87+done
88+
89+if [ "${remain}" != "" ]; then
90+ output="${output} "$("$NEXT_LLVM_CONFIG" ${remain})
91+fi
92+
93+echo "${output}"
diff --git a/recipes-devtools/clang/clang/0034-scan-build-py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch b/recipes-devtools/clang/clang/0034-scan-build-py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch
deleted file mode 100644
index da32f37..0000000
--- a/recipes-devtools/clang/clang/0034-scan-build-py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch
+++ /dev/null
@@ -1,92 +0,0 @@
1From eab8305134f5b43204ac2c7976c90741d93da70f Mon Sep 17 00:00:00 2001
2From: Martin Jansa <martin.jansa@gmail.com>
3Date: Fri, 13 Sep 2024 13:38:08 +0200
4Subject: [PATCH] scan-build-py: respect LLVM_LIBDIR_SUFFIX like other tools do
5
6* other libraries are installed in 'lib64' or 'lib32' based on
7 LLVM_LIBDIR_SUFFIX value, but libscanbuild files were always
8 installed in 'lib'
9
10Upstream-Status: Submitted [https://github.com/llvm/llvm-project/pull/108549]
11
12Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
13---
14 clang/tools/scan-build-py/CMakeLists.txt | 38 ++++++++++++------------
15 1 file changed, 19 insertions(+), 19 deletions(-)
16
17diff --git a/clang/tools/scan-build-py/CMakeLists.txt b/clang/tools/scan-build-py/CMakeLists.txt
18index 9273eb5ed977..9033786d2da5 100644
19--- a/clang/tools/scan-build-py/CMakeLists.txt
20+++ b/clang/tools/scan-build-py/CMakeLists.txt
21@@ -77,52 +77,52 @@ foreach(lib ${LibExecs})
22 endforeach()
23
24 foreach(lib ${LibScanbuild})
25- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lib/libscanbuild/${lib}
26+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild/${lib}
27 COMMAND ${CMAKE_COMMAND} -E make_directory
28- ${CMAKE_BINARY_DIR}/lib
29+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}
30 COMMAND ${CMAKE_COMMAND} -E make_directory
31- ${CMAKE_BINARY_DIR}/lib/libscanbuild
32+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild
33 COMMAND ${CMAKE_COMMAND} -E copy
34 ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/${lib}
35- ${CMAKE_BINARY_DIR}/lib/libscanbuild/
36+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild/
37 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/${lib})
38- list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/${lib})
39+ list(APPEND Depends ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild/${lib})
40 install(FILES lib/libscanbuild/${lib}
41- DESTINATION lib/libscanbuild
42+ DESTINATION lib${LLVM_LIBDIR_SUFFIX}/libscanbuild
43 COMPONENT scan-build-py)
44 endforeach()
45
46 foreach(resource ${LibScanbuildResources})
47- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources/${resource}
48+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild/resources/${resource}
49 COMMAND ${CMAKE_COMMAND} -E make_directory
50- ${CMAKE_BINARY_DIR}/lib
51+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}
52 COMMAND ${CMAKE_COMMAND} -E make_directory
53- ${CMAKE_BINARY_DIR}/lib/libscanbuild
54+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild
55 COMMAND ${CMAKE_COMMAND} -E make_directory
56- ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources
57+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild/resources
58 COMMAND ${CMAKE_COMMAND} -E copy
59 ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/resources/${resource}
60- ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources
61+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild/resources
62 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libscanbuild/resources/${resource})
63- list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libscanbuild/resources/${resource})
64+ list(APPEND Depends ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libscanbuild/resources/${resource})
65 install(FILES lib/libscanbuild/resources/${resource}
66- DESTINATION lib/libscanbuild/resources
67+ DESTINATION lib${LLVM_LIBDIR_SUFFIX}/libscanbuild/resources
68 COMPONENT scan-build-py)
69 endforeach()
70
71 foreach(lib ${LibEar})
72- add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lib/libear/${lib}
73+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libear/${lib}
74 COMMAND ${CMAKE_COMMAND} -E make_directory
75- ${CMAKE_BINARY_DIR}/lib
76+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}
77 COMMAND ${CMAKE_COMMAND} -E make_directory
78- ${CMAKE_BINARY_DIR}/lib/libear
79+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libear
80 COMMAND ${CMAKE_COMMAND} -E copy
81 ${CMAKE_CURRENT_SOURCE_DIR}/lib/libear/${lib}
82- ${CMAKE_BINARY_DIR}/lib/libear/
83+ ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libear/
84 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lib/libear/${lib})
85- list(APPEND Depends ${CMAKE_BINARY_DIR}/lib/libear/${lib})
86+ list(APPEND Depends ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libear/${lib})
87 install(FILES lib/libear/${lib}
88- DESTINATION lib/libear
89+ DESTINATION lib${LLVM_LIBDIR_SUFFIX}/libear
90 COMPONENT scan-build-py)
91 endforeach()
92
diff --git a/recipes-devtools/clang/clang/0035-compiler-rt-Do-not-pass-target-to-clang-compiler.patch b/recipes-devtools/clang/clang/0035-compiler-rt-Do-not-pass-target-to-clang-compiler.patch
deleted file mode 100644
index c454327..0000000
--- a/recipes-devtools/clang/clang/0035-compiler-rt-Do-not-pass-target-to-clang-compiler.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 7e387310a4904eaf2c83b781b95c8cf60243c332 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 13 Mar 2025 00:30:38 -0700
4Subject: [PATCH] compiler-rt: Do not pass --target to clang compiler
5
6In OE we use <tuple>-clang and <tuple>-clang++ which
7should resolve the --target correctly.
8
9Upstream-Status: Inappropriate [ OE-Specific ]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 compiler-rt/lib/fuzzer/CMakeLists.txt | 4 ----
13 1 file changed, 4 deletions(-)
14
15diff --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt
16index 6db24610df1f..692e194c2a98 100644
17--- a/compiler-rt/lib/fuzzer/CMakeLists.txt
18+++ b/compiler-rt/lib/fuzzer/CMakeLists.txt
19@@ -140,10 +140,6 @@ if(OS_NAME MATCHES "Android|Linux|Fuchsia" AND
20 COMPILER_RT_LIBCXXABI_PATH)
21 macro(partially_link_libcxx name dir arch)
22 get_target_flags_for_arch(${arch} target_cflags)
23- if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
24- get_compiler_rt_target(${arch} target)
25- set(target_cflags --target=${target} ${target_cflags})
26- endif()
27 set(cxx_${arch}_merge_dir "${CMAKE_CURRENT_BINARY_DIR}/cxx_${arch}_merge.dir")
28 file(MAKE_DIRECTORY ${cxx_${arch}_merge_dir})
29 add_custom_command(TARGET clang_rt.${name}-${arch} POST_BUILD
diff --git a/recipes-devtools/clang/clang/0036-Fix-build-on-ppc64-musl.patch b/recipes-devtools/clang/clang/0036-Fix-build-on-ppc64-musl.patch
deleted file mode 100644
index 3abee7e..0000000
--- a/recipes-devtools/clang/clang/0036-Fix-build-on-ppc64-musl.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1From a930a513c42524842931ec9dea7d16728f095043 Mon Sep 17 00:00:00 2001
2From: mojyack <mojyack@gmail.com>
3Date: Mon, 16 Dec 2024 13:42:04 +0900
4Subject: [PATCH] Fix build on ppc64+musl
5
6In powerpc64-unknown-linux-musl, signal.h does not include asm/ptrace.h,
7which causes "member access into incomplete type 'struct pt_regs'" errors.
8Include the header explicitly to fix this.
9
10Also in sanitizer_linux_libcdep.cpp, there is a usage of
11TlsPreTcbSize which is not defined in such a platform.
12Guard the branch with macro.
13
14Upstream-Status: Submitted [https://github.com/llvm/llvm-project/pull/120036]
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 .../lib/sanitizer_common/sanitizer_linux.cpp | 4 ++++
18 .../sanitizer_common/sanitizer_linux_libcdep.cpp | 13 +++++++------
19 .../sanitizer_platform_limits_posix.cpp | 2 +-
20 .../sanitizer_stoptheworld_linux_libcdep.cpp | 3 ++-
21 4 files changed, 14 insertions(+), 8 deletions(-)
22
23diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
24index 7aa48d29d2d5..a4d526b4466c 100644
25--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
26+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
27@@ -86,6 +86,10 @@
28 # include <sys/sysmacros.h>
29 # endif
30
31+# if SANITIZER_LINUX && defined(__powerpc64__)
32+# include <asm/ptrace.h>
33+# endif
34+
35 # if SANITIZER_FREEBSD
36 # include <machine/atomic.h>
37 # include <sys/exec.h>
38diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
39index e11eff13cd32..331e1c7d8d15 100644
40--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
41+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
42@@ -619,21 +619,22 @@ static void GetTls(uptr *addr, uptr *size) {
43 *addr = tp - RoundUpTo(*size, align);
44 *size = tp - *addr + ThreadDescriptorSize();
45 # else
46- if (SANITIZER_GLIBC)
47- *size += 1664;
48- else if (SANITIZER_FREEBSD)
49- *size += 128; // RTLD_STATIC_TLS_EXTRA
50-# if defined(__mips__) || defined(__powerpc64__) || SANITIZER_RISCV64
51+# if SANITIZER_GLIBC
52+ *size += 1664;
53+# elif SANITIZER_FREEBSD
54+ *size += 128; // RTLD_STATIC_TLS_EXTRA
55+# if defined(__mips__) || defined(__powerpc64__) || SANITIZER_RISCV64
56 const uptr pre_tcb_size = TlsPreTcbSize();
57 *addr -= pre_tcb_size;
58 *size += pre_tcb_size;
59-# else
60+# else
61 // arm and aarch64 reserve two words at TP, so this underestimates the range.
62 // However, this is sufficient for the purpose of finding the pointers to
63 // thread-specific data keys.
64 const uptr tcb_size = ThreadDescriptorSize();
65 *addr -= tcb_size;
66 *size += tcb_size;
67+# endif
68 # endif
69 # endif
70 # elif SANITIZER_NETBSD
71diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
72index a5311d266b0c..ec5f2edab6a6 100644
73--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
74+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
75@@ -96,7 +96,7 @@
76 # include <sys/ptrace.h>
77 # if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
78 defined(__hexagon__) || defined(__loongarch__) || SANITIZER_RISCV64 || \
79- defined(__sparc__)
80+ defined(__sparc__) || defined(__powerpc64__)
81 # include <asm/ptrace.h>
82 # ifdef __arm__
83 typedef struct user_fpregs elf_fpregset_t;
84diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
85index 945da99d41f4..58d17d90c343 100644
86--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
87+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp
88@@ -31,7 +31,8 @@
89 #include <sys/types.h> // for pid_t
90 #include <sys/uio.h> // for iovec
91 #include <elf.h> // for NT_PRSTATUS
92-#if (defined(__aarch64__) || SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \
93+#if (defined(__aarch64__) || defined(__powerpc64__) || \
94+ SANITIZER_RISCV64 || SANITIZER_LOONGARCH64) && \
95 !SANITIZER_ANDROID
96 // GLIBC 2.20+ sys/user does not include asm/ptrace.h
97 # include <asm/ptrace.h>
diff --git a/recipes-devtools/clang/clang/0037-clangd-Add-a-build-option-to-disable-building-dexp.patch b/recipes-devtools/clang/clang/0037-clangd-Add-a-build-option-to-disable-building-dexp.patch
deleted file mode 100644
index 3851488..0000000
--- a/recipes-devtools/clang/clang/0037-clangd-Add-a-build-option-to-disable-building-dexp.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1From 8001f900e602c0a8abcf118bda5869a2eb0d5ee9 Mon Sep 17 00:00:00 2001
2From: Yoann Congal <yoann.congal@smile.fr>
3Date: Tue, 25 Mar 2025 22:25:55 +0100
4Subject: [PATCH] clangd: Add a build option to disable building dexp
5
6Building dexp on Debian 11 currently causes intermittent failure[0][1].
7
8Adding the CLANGD_BUILD_DEXP option to disable dexp from the build
9allows Debian 11 users to build clang (albeit without the dexp tool).
10
11This option is set to "Build Dexp" by default so, no change is expected
12without manual setting.
13
14[0]: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15803
15[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1101322
16
17Upstream-Status: Submitted [https://github.com/llvm/llvm-project/pull/133124]
18Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
19---
20 clang-tools-extra/clangd/CMakeLists.txt | 8 +++++++-
21 clang-tools-extra/clangd/test/CMakeLists.txt | 7 +++++--
22 clang-tools-extra/clangd/test/lit.site.cfg.py.in | 1 +
23 3 files changed, 13 insertions(+), 3 deletions(-)
24
25diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
26index 6f10afe4a562..a1e9da41b4b3 100644
27--- a/clang-tools-extra/clangd/CMakeLists.txt
28+++ b/clang-tools-extra/clangd/CMakeLists.txt
29@@ -210,6 +210,9 @@ if (CLANGD_ENABLE_REMOTE)
30 include(AddGRPC)
31 endif()
32
33+option(CLANGD_BUILD_DEXP "Build the dexp tool as part of Clangd" ON)
34+llvm_canonicalize_cmake_booleans(CLANGD_BUILD_DEXP)
35+
36 if(CLANG_INCLUDE_TESTS)
37 add_subdirectory(test)
38 add_subdirectory(unittests)
39@@ -220,4 +223,7 @@ option(CLANGD_ENABLE_REMOTE "Use gRPC library to enable remote index support for
40 set(GRPC_INSTALL_PATH "" CACHE PATH "Path to gRPC library manual installation.")
41
42 add_subdirectory(index/remote)
43-add_subdirectory(index/dex/dexp)
44+
45+if(CLANGD_BUILD_DEXP)
46+ add_subdirectory(index/dex/dexp)
47+endif()
48diff --git a/clang-tools-extra/clangd/test/CMakeLists.txt b/clang-tools-extra/clangd/test/CMakeLists.txt
49index b51f461a4986..42fc3506641f 100644
50--- a/clang-tools-extra/clangd/test/CMakeLists.txt
51+++ b/clang-tools-extra/clangd/test/CMakeLists.txt
52@@ -3,8 +3,6 @@ set(CLANGD_TEST_DEPS
53 ClangdTests
54 clangd-indexer
55 split-file
56- # No tests for it, but we should still make sure they build.
57- dexp
58 )
59
60 if(CLANGD_BUILD_XPC)
61@@ -12,6 +10,11 @@ if(CLANGD_BUILD_XPC)
62 list(APPEND CLANGD_TEST_DEPS ClangdXpcUnitTests)
63 endif()
64
65+if(CLANGD_BUILD_DEXP)
66+ # No tests for it, but we should still make sure they build.
67+ list(APPEND CLANGD_TEST_DEPS dexp)
68+endif()
69+
70 if(CLANGD_ENABLE_REMOTE)
71 list(APPEND CLANGD_TEST_DEPS clangd-index-server clangd-index-server-monitor)
72 endif()
73diff --git a/clang-tools-extra/clangd/test/lit.site.cfg.py.in b/clang-tools-extra/clangd/test/lit.site.cfg.py.in
74index 1fe7c8d0f324..a0bb3561e19e 100644
75--- a/clang-tools-extra/clangd/test/lit.site.cfg.py.in
76+++ b/clang-tools-extra/clangd/test/lit.site.cfg.py.in
77@@ -15,6 +15,7 @@ config.llvm_shlib_dir = "@SHLIBDIR@"
78 config.clangd_source_dir = "@CMAKE_CURRENT_SOURCE_DIR@/.."
79 config.clangd_binary_dir = "@CMAKE_CURRENT_BINARY_DIR@/.."
80 config.clangd_build_xpc = @CLANGD_BUILD_XPC@
81+config.clangd_build_dexp = @CLANGD_BUILD_DEXP@
82 config.clangd_enable_remote = @CLANGD_ENABLE_REMOTE@
83 config.clangd_tidy_checks = @CLANGD_TIDY_CHECKS@
84 config.have_zlib = @LLVM_ENABLE_ZLIB@
diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb
deleted file mode 100644
index 6e2817c..0000000
--- a/recipes-devtools/clang/clang_git.bb
+++ /dev/null
@@ -1,499 +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
4SUMMARY = "LLVM based C/C++ compiler"
5DESCRIPTION = "Clang is an LLVM based C/C++/Objective-C compiler, \
6 which aims to deliver amazingly fast compiles, \
7 extremely useful error and warning messages and \
8 to provide a platform for building great source \
9 level tools. The Clang Static Analyzer and \
10 clang-tidy are tools that automatically find bugs \
11 in your code, and are great examples of the sort \
12 of tools that can be built using the Clang frontend \
13 as a library to parse C/C++ code"
14HOMEPAGE = "http://clang.llvm.org/"
15SECTION = "devel"
16
17require clang.inc
18require common-source.inc
19
20INHIBIT_DEFAULT_DEPS = "1"
21
22BUILD_CC:class-nativesdk = "clang"
23BUILD_CXX:class-nativesdk = "clang++"
24BUILD_AR:class-nativesdk = "llvm-ar"
25BUILD_RANLIB:class-nativesdk = "llvm-ranlib"
26BUILD_NM:class-nativesdk = "llvm-nm"
27
28BUILDSDK_CPPFLAGS:append:class-nativesdk = "${@oe.utils.vartrue('DEBUG_BUILD', ' -Wno-error=unused-command-line-argument', '', d)}"
29
30LDFLAGS:remove:class-nativesdk = "-fuse-ld=lld"
31
32LDFLAGS:append:class-target:riscv32 = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
33LDFLAGS:append:class-target:mips = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
34
35inherit cmake cmake-native pkgconfig python3native python3targetconfig
36
37OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"
38
39def get_clang_arch(bb, d, arch_var):
40 import re
41 a = d.getVar(arch_var)
42 if re.match('(i.86|athlon|x86.64)$', a): return 'X86'
43 elif re.match('arm$', a): return 'ARM'
44 elif re.match('armeb$', a): return 'ARM'
45 elif re.match('aarch64$', a): return 'AArch64'
46 elif re.match('aarch64_be$', a): return 'AArch64'
47 elif re.match('mips(isa|)(32|64|)(r6|)(el|)$', a): return 'Mips'
48 elif re.match('riscv32$', a): return 'riscv32'
49 elif re.match('riscv64$', a): return 'riscv64'
50 elif re.match('p(pc|owerpc)(|64)', a): return 'PowerPC'
51 elif re.match('loongarch64$', a): return 'loongarch64'
52 else:
53 bb.note("'%s' is not a primary llvm architecture" % a)
54 return ""
55
56def get_clang_host_arch(bb, d):
57 return get_clang_arch(bb, d, 'HOST_ARCH')
58
59def get_clang_target_arch(bb, d):
60 return get_clang_arch(bb, d, 'TARGET_ARCH')
61
62PACKAGECONFIG_CLANG_COMMON = "build-id eh libedit rtti shared-libs \
63 ${@bb.utils.contains('TC_CXX_RUNTIME', 'llvm', 'compiler-rt libcplusplus libomp unwindlib', '', d)} \
64 "
65
66PACKAGECONFIG ??= "compiler-rt libcplusplus lldb-wchar terminfo \
67 ${PACKAGECONFIG_CLANG_COMMON} \
68 ${@bb.utils.filter('DISTRO_FEATURES', 'lto thin-lto', d)} \
69 "
70PACKAGECONFIG:class-native = "clangd \
71 ${PACKAGECONFIG_CLANG_COMMON} \
72 "
73PACKAGECONFIG:class-nativesdk = "clangd \
74 ${PACKAGECONFIG_CLANG_COMMON} \
75 ${@bb.utils.filter('DISTRO_FEATURES', 'lto thin-lto', d)} \
76 "
77
78PACKAGECONFIG[bootstrap] = "-DCLANG_ENABLE_BOOTSTRAP=On -DCLANG_BOOTSTRAP_PASSTHROUGH='${PASSTHROUGH}' -DBOOTSTRAP_LLVM_ENABLE_LTO=Thin -DBOOTSTRAP_LLVM_ENABLE_LLD=ON,,,"
79PACKAGECONFIG[build-id] = "-DENABLE_LINKER_BUILD_ID=ON,-DENABLE_LINKER_BUILD_ID=OFF,,"
80PACKAGECONFIG[clangd] = "-DCLANG_ENABLE_CLANGD=ON,-DCLANG_ENABLE_CLANGD=OFF,,"
81
82# Activate to build the dexp tool in clangd
83# Disabled by default for -native since it is known to trigger compiler failure on Debian 11
84# See: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15803
85PACKAGECONFIG[clangd-dexp] = "-DCLANGD_BUILD_DEXP=ON,-DCLANGD_BUILD_DEXP=OFF,,"
86
87PACKAGECONFIG[compiler-rt] = "-DCLANG_DEFAULT_RTLIB=compiler-rt,,"
88PACKAGECONFIG[eh] = "-DLLVM_ENABLE_EH=ON,-DLLVM_ENABLE_EH=OFF,,"
89PACKAGECONFIG[libcplusplus] = "-DCLANG_DEFAULT_CXX_STDLIB=libc++,,"
90PACKAGECONFIG[libedit] = "-DLLVM_ENABLE_LIBEDIT=ON -DLLDB_ENABLE_LIBEDIT=ON,-DLLVM_ENABLE_LIBEDIT=OFF -DLLDB_ENABLE_LIBEDIT=OFF,libedit libedit-native"
91PACKAGECONFIG[libomp] = "-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp,,"
92PACKAGECONFIG[lld] = "-DCLANG_DEFAULT_LINKER=lld,,"
93PACKAGECONFIG[lldb-lua] = "-DLLDB_ENABLE_LUA=ON,-DLLDB_ENABLE_LUA=OFF,lua"
94PACKAGECONFIG[lldb-wchar] = "-DLLDB_EDITLINE_USE_WCHAR=1,-DLLDB_EDITLINE_USE_WCHAR=0,"
95PACKAGECONFIG[lto] = "-DLLVM_ENABLE_LTO=Full -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
96PACKAGECONFIG[pfm] = "-DLLVM_ENABLE_LIBPFM=ON,-DLLVM_ENABLE_LIBPFM=OFF,libpfm,"
97PACKAGECONFIG[rtti] = "-DLLVM_ENABLE_RTTI=ON,-DLLVM_ENABLE_RTTI=OFF,,"
98PACKAGECONFIG[shared-libs] = "-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON,,,"
99PACKAGECONFIG[split-dwarf] = "-DLLVM_USE_SPLIT_DWARF=ON,-DLLVM_USE_SPLIT_DWARF=OFF,,"
100PACKAGECONFIG[terminfo] = "-DLLVM_ENABLE_TERMINFO=ON -DCOMPILER_RT_TERMINFO_LIB=ON,-DLLVM_ENABLE_TERMINFO=OFF -DCOMPILER_RT_TERMINFO_LIB=OFF,ncurses,"
101PACKAGECONFIG[thin-lto] = "-DLLVM_ENABLE_LTO=Thin -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR},,binutils,"
102PACKAGECONFIG[unwindlib] = "-DCLANG_DEFAULT_UNWINDLIB=libunwind,-DCLANG_DEFAULT_UNWINDLIB=libgcc,,"
103
104OECMAKE_SOURCEPATH = "${S}/llvm"
105
106OECMAKE_TARGET_COMPILE = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', 'stage2', 'all', d)}"
107OECMAKE_TARGET_INSTALL = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', 'stage2-install', 'install', d)}"
108BINPATHPREFIX = "${@bb.utils.contains('PACKAGECONFIG', 'bootstrap', '/tools/clang/stage2-bins/NATIVE', '', d)}"
109
110PASSTHROUGH = "\
111CLANG_DEFAULT_RTLIB;CLANG_DEFAULT_CXX_STDLIB;LLVM_BUILD_LLVM_DYLIB;LLVM_LINK_LLVM_DYLIB;\
112LLVM_ENABLE_ASSERTIONS;LLVM_ENABLE_EXPENSIVE_CHECKS;LLVM_ENABLE_PIC;\
113LLVM_BINDINGS_LIST;LLVM_ENABLE_FFI;FFI_INCLUDE_DIR;LLVM_OPTIMIZED_TABLEGEN;\
114LLVM_ENABLE_RTTI;LLVM_ENABLE_EH;LLVM_BUILD_EXTERNAL_COMPILER_RT;CMAKE_SYSTEM_NAME;\
115CMAKE_BUILD_TYPE;BUILD_SHARED_LIBS;LLVM_ENABLE_PROJECTS;LLVM_ENABLE_RUNTIMES;LLVM_BINUTILS_INCDIR;\
116LLVM_TARGETS_TO_BUILD;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;PYTHON_EXECUTABLE;\
117PYTHON_LIBRARY;PYTHON_INCLUDE_DIR;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;LLDB_EDITLINE_USE_WCHAR;\
118LLVM_ENABLE_LIBEDIT;LLDB_ENABLE_LIBEDIT;LLDB_PYTHON_RELATIVE_PATH;LLDB_PYTHON_EXE_RELATIVE_PATH;\
119LLDB_PYTHON_EXT_SUFFIX;CMAKE_C_FLAGS_RELEASE;CMAKE_CXX_FLAGS_RELEASE;CMAKE_ASM_FLAGS_RELEASE;\
120CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;CLANG_DEFAULT_UNWINDLIB;\
121CLANG_DEFAULT_OPENMP_RUNTIME;LLVM_ENABLE_PER_TARGET_RUNTIME_DIR;\
122LLVM_BUILD_TOOLS;LLVM_USE_HOST_TOOLS;LLVM_CONFIG_PATH;\
123"
124#
125# Default to build all OE-Core supported target arches (user overridable).
126# Gennerally setting LLVM_TARGETS_TO_BUILD = "" in local.conf is ok in most simple situations
127# where only one target architecture is needed along with just one build arch (usually X86)
128#
129LLVM_TARGETS_TO_BUILD ?= "AMDGPU;AArch64;ARM;BPF;Mips;PowerPC;RISCV;X86;LoongArch;NVPTX;SPIRV"
130
131LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ?= ""
132
133HF = ""
134HF:class-target = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
135HF[vardepvalue] = "${HF}"
136
137# Ensure that LLVM_PROJECTS does not contain compiler runtime components e.g. libcxx etc
138# they are enabled via LLVM_ENABLE_RUNTIMES
139LLVM_PROJECTS ?= "clang;clang-tools-extra;lld${LLDB}"
140LLDB ?= ";lldb"
141# LLDB support for RISCV32/Mips32 does not work yet
142LLDB:riscv32 = ""
143LLDB:mips = ""
144LLDB:mipsel = ""
145LLDB:powerpc = ""
146
147# linux hosts (.so) on Windows .pyd
148SOLIBSDEV:mingw32 = ".pyd"
149
150#CMAKE_VERBOSE = "VERBOSE=1"
151
152EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
153 -DLLVM_APPEND_VC_REV=OFF \
154 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
155 -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
156 -DLLVM_ENABLE_PIC=ON \
157 -DCLANG_DEFAULT_PIE_ON_LINUX=ON \
158 -DLLVM_BINDINGS_LIST='' \
159 -DLLVM_ENABLE_FFI=ON \
160 -DLLVM_ENABLE_ZSTD=ON \
161 -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
162 -DLLVM_OPTIMIZED_TABLEGEN=ON \
163 -DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
164 -DCMAKE_SYSTEM_NAME=Linux \
165 -DCMAKE_BUILD_TYPE=Release \
166 -DCMAKE_CXX_FLAGS_RELEASE='${CXXFLAGS} -DNDEBUG -g0' \
167 -DCMAKE_C_FLAGS_RELEASE='${CFLAGS} -DNDEBUG -g0' \
168 -DBUILD_SHARED_LIBS=OFF \
169 -DLLVM_ENABLE_PROJECTS='${LLVM_PROJECTS}' \
170 -DLLVM_BINUTILS_INCDIR=${STAGING_INCDIR} \
171 -DLLVM_VERSION_SUFFIX='${VER_SUFFIX}' \
172 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
173 -DLLVM_TARGETS_TO_BUILD='${LLVM_TARGETS_TO_BUILD}' \
174 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD='${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD}' \
175"
176
177EXTRA_OECMAKE:append:class-native = "\
178 -DPYTHON_EXECUTABLE='${PYTHON}' \
179"
180EXTRA_OECMAKE:append:class-nativesdk = "\
181 -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \
182 -DLLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON_PN} \
183 -DLLDB_PYTHON_EXT_SUFFIX=${SOLIBSDEV} \
184 -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain-native.cmake' \
185 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
186 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
187 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
188 -DCMAKE_STRIP=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-strip \
189 -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \
190 -DLLVM_HEADERS_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-min-tblgen \
191 -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \
192 -DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \
193 -DLLDB_PYTHON_EXE_RELATIVE_PATH=${PYTHON_PN} \
194 -DLLDB_PYTHON_EXT_SUFFIX=${SOLIBSDEV} \
195 -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \
196 -DPYTHON_EXECUTABLE='${PYTHON}' \
197"
198EXTRA_OECMAKE:append:class-target = "\
199 -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \
200 -DLLVM_HEADERS_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-min-tblgen \
201 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
202 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
203 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
204 -DCMAKE_STRIP=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-strip \
205 -DLLVM_TARGET_ARCH=${@get_clang_target_arch(bb, d)} \
206 -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_SYS}${HF} \
207 -DLLVM_HOST_TRIPLE=${TARGET_SYS}${HF} \
208 -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \
209 -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \
210 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
211 -DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \
212 -DLLDB_PYTHON_EXE_RELATIVE_PATH=${bindir} \
213 -DLLDB_PYTHON_EXT_SUFFIX=${SOLIBSDEV} \
214"
215
216DEPENDS = "binutils zlib zstd libffi libxml2 libxml2-native ninja-native swig-native"
217DEPENDS:append:class-nativesdk = " clang-crosssdk-${SDK_SYS} virtual/nativesdk-cross-binutils nativesdk-python3"
218DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} python3 compiler-rt libcxx"
219
220RRECOMMENDS:${PN} = "binutils"
221RRECOMMENDS:${PN}:append:class-target = " libcxx-dev"
222
223# patch out build host paths for reproducibility
224reproducible_build_variables() {
225 sed -i -e "s,${DEBUG_PREFIX_MAP},,g" \
226 -e "s,--sysroot=${RECIPE_SYSROOT},,g" \
227 -e "s,${STAGING_DIR_HOST},,g" \
228 -e "s,${S}/llvm,,g" \
229 -e "s,${B},,g" \
230 ${B}/tools/llvm-config/BuildVariables.inc
231}
232
233do_configure:append:class-target() {
234 reproducible_build_variables
235}
236
237do_configure:append:class-nativesdk() {
238 reproducible_build_variables
239}
240
241do_install:append() {
242 rm -rf ${D}${libdir}/python*/site-packages/six.py
243 for t in clang-pseudo clang-pseudo-gen clang-rename; do
244 if [ -e ${B}${BINPATHPREFIX}/bin/$t ]; then
245 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/$t ${D}${bindir}/$t
246 fi
247 done
248}
249
250do_install:append:class-target () {
251 # Allow bin path to change based on YOCTO_ALTERNATE_EXE_PATH
252 sed -i 's;${_IMPORT_PREFIX}/bin;${_IMPORT_PREFIX_BIN};g' ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake
253
254 # Insert function to populate Import Variables
255 sed -i "4i\
256if(DEFINED ENV{YOCTO_ALTERNATE_EXE_PATH})\n\
257 execute_process(COMMAND \"llvm-config\" \"--bindir\" OUTPUT_VARIABLE _IMPORT_PREFIX_BIN OUTPUT_STRIP_TRAILING_WHITESPACE)\n\
258else()\n\
259 set(_IMPORT_PREFIX_BIN \"\${_IMPORT_PREFIX}/bin\")\n\
260endif()\n" ${D}${libdir}/cmake/llvm/LLVMExports-release.cmake
261
262 if [ -n "${LLVM_LIBDIR_SUFFIX}" ]; then
263 mkdir -p ${D}${nonarch_libdir}
264 mv ${D}${libdir}/clang ${D}${nonarch_libdir}/clang
265 ln -rs ${D}${nonarch_libdir}/clang ${D}${libdir}/clang
266 rmdir --ignore-fail-on-non-empty ${D}${libdir}
267 fi
268 for t in clang clang++ llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \
269 llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov; do
270 ln -sf $t ${D}${bindir}/${TARGET_PREFIX}$t
271 done
272
273 # reproducibility
274 sed -i -e 's,${B},,g' ${D}${libdir}/cmake/llvm/LLVMConfig.cmake
275}
276
277do_install:append:class-native () {
278 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
279 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer
280 fi
281 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen
282 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
283 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/lldb-tblgen ${D}${bindir}/lldb-tblgen
284 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/llvm-min-tblgen ${D}${bindir}/llvm-min-tblgen
285 for f in `find ${D}${bindir} -executable -type f -not -type l`; do
286 test -n "`file -b $f|grep -i ELF`" && ${STRIP} $f
287 echo "stripped $f"
288 done
289 ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV}
290 ln -sf llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
291 ln -sf llvm-config ${D}${bindir}/llvm-config${PV}
292
293 if ${@ 'false' if 'llvm' in d.getVar('PROVIDES') or '' else 'true' } ; then
294 for f in bugpoint dsymutil llc lli opt reduce-chunk-list sancov sanstats verify-uselistorder ; do
295 rm -f ${D}${bindir}/$f
296 done
297 rm -f ${D}${bindir}/llvm-*
298
299 rm -rf ${D}${includedir}/llvm
300 rm -rf ${D}${includedir}/llvm-c
301 rm -rf ${D}${libdir}/cmake/llvm
302 rm -rf ${D}${libdir}/libLLVM*
303 rm -rf ${D}${libdir}/libLTO*
304 rm -rf ${D}${libdir}/libRemarks*
305 fi
306}
307
308do_install:append:class-nativesdk () {
309 if [ -e ${D}${libdir}/cmake/llvm/LLVMConfig.cmake ] ; then
310 sed -i -e "s|${B}/./bin/||g" ${D}${libdir}/cmake/llvm/LLVMConfig.cmake
311 fi
312 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
313 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clangd-indexer ${D}${bindir}/clangd-indexer
314 fi
315 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tblgen ${D}${bindir}/clang-tblgen
316 install -Dm 0755 ${B}${BINPATHPREFIX}/bin/clang-tidy-confusable-chars-gen ${D}${bindir}/clang-tidy-confusable-chars-gen
317 for f in `find ${D}${bindir} -executable -type f -not -type l`; do
318 test -n "`file -b $f|grep -i ELF`" && ${STRIP} $f
319 done
320 ln -sf clang-tblgen ${D}${bindir}/clang-tblgen${PV}
321 ln -sf llvm-tblgen ${D}${bindir}/llvm-tblgen${PV}
322 ln -sf llvm-config ${D}${bindir}/llvm-config${PV}
323 rm -rf ${D}${datadir}/llvm/cmake
324 rm -rf ${D}${datadir}/llvm
325
326 #reproducibility
327 if [ -e ${D}${libdir}/cmake/llvm/LLVMConfig.cmake ] ; then
328 sed -i -e 's,${B},,g' ${D}${libdir}/cmake/llvm/LLVMConfig.cmake
329 fi
330}
331
332PACKAGES =+ "${PN}-libllvm ${PN}-lldb-python ${PN}-libclang-cpp ${PN}-tidy ${PN}-format ${PN}-tools \
333 libclang lldb lldb-server liblldb llvm-linker-tools"
334
335BBCLASSEXTEND = "native nativesdk"
336
337RDEPENDS:lldb += "${PN}-lldb-python lldb-server"
338
339RDEPENDS:${PN}-tools += "\
340 perl-module-digest-md5 \
341 perl-module-file-basename \
342 perl-module-file-copy \
343 perl-module-file-find \
344 perl-module-file-path \
345 perl-module-findbin \
346 perl-module-hash-util \
347 perl-module-sys-hostname \
348 perl-module-term-ansicolor \
349"
350
351RRECOMMENDS:${PN}-tidy += "${PN}-tools"
352
353FILES:llvm-linker-tools = "${libdir}/LLVMgold* ${libdir}/libLTO.so.* ${libdir}/LLVMPolly*"
354
355FILES:${PN}-libclang-cpp = "${libdir}/libclang-cpp.so.*"
356
357FILES:${PN}-lldb-python = "${libdir}/python*/site-packages/lldb/*"
358
359FILES:${PN}-tidy = "${bindir}/*clang-tidy*"
360FILES:${PN}-format = "${bindir}/*clang-format*"
361
362FILES:${PN}-tools = "${bindir}/analyze-build \
363 ${bindir}/c-index-test \
364 ${bindir}/clang-apply-replacements \
365 ${bindir}/clang-change-namespace \
366 ${bindir}/clang-check \
367 ${bindir}/clang-doc \
368 ${bindir}/clang-extdef-mapping \
369 ${bindir}/clang-include-fixer \
370 ${bindir}/clang-linker-wrapper \
371 ${bindir}/clang-move \
372 ${bindir}/clang-nvlink-wrapper \
373 ${bindir}/clang-offload-bundler \
374 ${bindir}/clang-offload-packager \
375 ${bindir}/clang-pseudo* \
376 ${bindir}/clang-query \
377 ${bindir}/clang-refactor \
378 ${bindir}/clang-rename* \
379 ${bindir}/clang-reorder-fields \
380 ${bindir}/clang-repl \
381 ${bindir}/clang-scan-deps \
382 ${bindir}/diagtool \
383 ${bindir}/find-all-symbols \
384 ${bindir}/hmaptool \
385 ${bindir}/hwasan_symbolize \
386 ${bindir}/intercept-build \
387 ${bindir}/modularize \
388 ${bindir}/pp-trace \
389 ${bindir}/sancov \
390 ${bindir}/scan-build \
391 ${bindir}/scan-build-py \
392 ${bindir}/scan-view \
393 ${bindir}/split-file \
394 ${libdir}/libscanbuild/* \
395 ${libdir}/libear/* \
396 ${libexecdir}/analyze-c++ \
397 ${libexecdir}/analyze-cc \
398 ${libexecdir}/c++-analyzer \
399 ${libexecdir}/ccc-analyzer \
400 ${libexecdir}/intercept-c++ \
401 ${libexecdir}/intercept-cc \
402 ${datadir}/scan-build/* \
403 ${datadir}/scan-view/* \
404 ${datadir}/opt-viewer/* \
405 ${datadir}/clang/* \
406"
407
408FILES:${PN} += "\
409 ${bindir}/clang-cl \
410 ${libdir}/BugpointPasses.so \
411 ${libdir}/LLVMHello.so \
412 ${libdir}/*Plugin.so \
413 ${libdir}/${BPN} \
414 ${nonarch_libdir}/${BPN}/*/include/ \
415"
416
417FILES:lldb = "\
418 ${bindir}/lldb \
419 ${bindir}/lldb-argdumper \
420 ${bindir}/lldb-instr \
421 ${bindir}/lldb-vscode \
422"
423
424FILES:lldb-server = "\
425 ${bindir}/lldb-server \
426"
427
428FILES:liblldb = "\
429 ${libdir}/liblldbIntelFeatures.so.* \
430 ${libdir}/liblldb.so.* \
431"
432
433FILES:${PN}-libllvm =+ "\
434 ${libdir}/libLLVM.so.${MAJOR_VER}.${MINOR_VER} \
435 ${libdir}/libLLVM-${MAJOR_VER}.so \
436 ${libdir}/libRemarks.so.* \
437"
438
439FILES:libclang = "\
440 ${libdir}/libclang.so.* \
441"
442
443FILES:${PN}-dev += "\
444 ${datadir}/llvm/cmake \
445 ${libdir}/cmake \
446 ${nonarch_libdir}/libear \
447 ${nonarch_libdir}/${BPN}/*.la \
448"
449FILES:${PN}-doc += "${datadir}/clang-doc"
450
451FILES:${PN}-staticdev += "${nonarch_libdir}/${BPN}/*.a"
452
453FILES:${PN}-staticdev:remove = "${libdir}/${BPN}/*.a"
454FILES:${PN}-dev:remove = "${libdir}/${BPN}/*.la"
455FILES:${PN}:remove = "${libdir}/${BPN}/*"
456
457
458INSANE_SKIP:${PN} += "already-stripped"
459#INSANE_SKIP:${PN}-dev += "dev-elf"
460INSANE_SKIP:${PN}-lldb-python += "dev-so dev-deps"
461INSANE_SKIP:${MLPREFIX}liblldb = "dev-so"
462INSANE_SKIP:${PN}-libllvm = "dev-so"
463
464#Avoid SSTATE_SCAN_COMMAND running sed over llvm-config.
465SSTATE_SCAN_FILES:remove = "*-config"
466
467TOOLCHAIN = "clang"
468TOOLCHAIN:class-native = "gcc"
469TOOLCHAIN:class-nativesdk = "clang"
470COMPILER_RT:class-nativesdk:toolchain-clang:runtime-llvm = "-rtlib=libgcc --unwindlib=libgcc"
471LIBCPLUSPLUS:class-nativesdk:toolchain-clang:runtime-llvm = "-stdlib=libstdc++"
472
473SYSROOT_DIRS:append:class-target = " ${nonarch_libdir}"
474
475SYSROOT_PREPROCESS_FUNCS:append:class-target = " clang_sysroot_preprocess"
476SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " clang_sysroot_preprocess"
477
478clang_sysroot_preprocess() {
479 install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/
480 install -m 0755 ${S}/llvm/tools/llvm-config/llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/
481 ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV}
482 # LLDTargets.cmake references the lld executable(!) that some modules/plugins link to
483 install -d ${SYSROOT_DESTDIR}${bindir}
484
485 binaries="lld diagtool clang-${MAJOR_VER} clang-format clang-offload-packager
486 clang-offload-bundler clang-scan-deps clang-repl
487 clang-refactor clang-check clang-extdef-mapping clang-apply-replacements
488 clang-reorder-fields clang-tidy clang-change-namespace clang-doc clang-include-fixer
489 find-all-symbols clang-move clang-query pp-trace modularize"
490
491 if ${@bb.utils.contains('PACKAGECONFIG', 'clangd', 'true', 'false', d)}; then
492 binaries="${binaries} clangd"
493 fi
494
495 for f in ${binaries}
496 do
497 install -m 755 ${D}${bindir}/$f ${SYSROOT_DESTDIR}${bindir}/
498 done
499}
diff --git a/recipes-devtools/clang/common-source.inc b/recipes-devtools/clang/common-source.inc
deleted file mode 100644
index d8a0f68..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_preconfigure"
11do_populate_lic[depends] += "llvm-project-source-${PV}:do_unpack"
12do_create_spdx[depends] += "llvm-project-source-${PV}:do_preconfigure"
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 3561477..0000000
--- a/recipes-devtools/clang/common.inc
+++ /dev/null
@@ -1,71 +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
8# Snapshot
9#RELEASE ?= "a69568efe6c4972e71af295c6577b3412dd57c22"
10#BASEURI ?= "https://api.github.com/repos/llvm/llvm-project/tarball/${RELEASE};downloadfilename=llvm-${PV}-${RELEASE}.tar.gz"
11#SOURCEDIR ?= "llvm-llvm-project-${@'${RELEASE}'[0:7]}"
12#SRC_URI[sha256sum] = "aed4f66cd72867b36cc55a0588436933c3d58d3e61ca782b6bf57605d3fdcb09"
13
14# GA Release
15RELEASE ?= "${PV}"
16BASEURI ?= "${LLVM_HTTP}/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz"
17SOURCEDIR ?= "llvm-project-${PV}.src"
18SRC_URI[sha256sum] = "f0a4a240aabc9b056142d14d5478bb6d962aeac549cbd75b809f5499240a8b38"
19
20SRC_URI = "\
21 ${BASEURI} \
22 file://0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \
23 file://0002-compiler-rt-support-a-new-embedded-linux-target.patch \
24 file://0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \
25 file://0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \
26 file://0005-llvm-allow-env-override-of-exe-and-libdir-path.patch \
27 file://0006-clang-driver-Check-sysroot-for-ldso-path.patch \
28 file://0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch \
29 file://0008-clang-Prepend-trailing-to-sysroot.patch \
30 file://0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch \
31 file://0010-clang-Define-releative-gcc-installation-dir.patch \
32 file://0011-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \
33 file://0012-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \
34 file://0013-Check-for-atomic-double-intrinsics.patch \
35 file://0014-cmake-Fix-configure-for-packages-using-find_package.patch \
36 file://0015-clang-Fix-resource-dir-location-for-cross-toolchains.patch \
37 file://0016-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch \
38 file://0017-clang-Use-python3-in-python-scripts.patch \
39 file://0018-For-x86_64-set-Yocto-based-GCC-install-search-path.patch \
40 file://0019-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch \
41 file://0020-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch \
42 file://0021-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch \
43 file://0022-libunwind-Added-unw_backtrace-method.patch \
44 file://0023-clang-Do-not-use-install-relative-libc-headers.patch \
45 file://0024-Fix-lib-paths-for-OpenEmbedded-Host.patch \
46 file://0025-Correct-library-search-path-for-OpenEmbedded-Host.patch \
47 file://0026-lldb-Link-with-libatomic-on-x86.patch \
48 file://0027-compiler-rt-Enable-__int128-for-ppc32.patch \
49 file://0028-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch \
50 file://0029-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch \
51 file://0030-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch \
52 file://0031-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch \
53 file://0032-clang-llvm-Add-OE-specific-ABI-triple-for-N32-ABI.patch \
54 file://0033-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch \
55 file://0034-scan-build-py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch \
56 file://0035-compiler-rt-Do-not-pass-target-to-clang-compiler.patch \
57 file://0036-Fix-build-on-ppc64-musl.patch \
58 file://0037-clangd-Add-a-build-option-to-disable-building-dexp.patch \
59"
60# Fallback to no-PIE if not set
61GCCPIE ??= ""
62
63S = "${TMPDIR}/work-shared/llvm-project-source-${PV}-${PR}/${SOURCEDIR}"
64B ?= "${WORKDIR}/llvm-project-source-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
65
66# We need to ensure that for the shared work directory, the do_patch signatures match
67# The real WORKDIR location isn't a dependency for the shared workdir.
68src_patches[vardepsexclude] = "WORKDIR"
69should_apply[vardepsexclude] += "PN"
70
71BPN = "clang"
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 6beb16a..0000000
--- a/recipes-devtools/clang/compiler-rt-sanitizers_git.bb
+++ /dev/null
@@ -1,129 +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
4SUMMARY = "LLVM based C/C++ compiler Sanitizers Runtime"
5DESCRIPTION = "Runtime libraries that are required \
6 to run the code with sanitizer instrumentation"
7HOMEPAGE = "http://compiler-rt.llvm.org/"
8SECTION = "base"
9
10require clang.inc
11require common-source.inc
12
13BPN = "compiler-rt-sanitizers"
14
15inherit cmake pkgconfig python3native
16
17
18LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=d846d1d65baf322d4c485d6ee54e877a"
19
20TUNE_CCARGS:remove = "-no-integrated-as"
21
22DEPENDS += "ninja-native virtual/crypt compiler-rt"
23DEPENDS:append:class-native = " clang-native libxcrypt-native"
24DEPENDS:append:class-nativesdk = " clang-native clang-crosssdk-${SDK_SYS} nativesdk-libxcrypt nativesdk-gcc-runtime"
25DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc gcc-runtime"
26
27PACKAGECONFIG ??= ""
28PACKAGECONFIG[crt] = "-DCOMPILER_RT_BUILD_CRT:BOOL=ON,-DCOMPILER_RT_BUILD_CRT:BOOL=OFF"
29PACKAGECONFIG[static-libcxx] = "-DSANITIZER_USE_STATIC_CXX_ABI=ON -DSANITIZER_USE_STATIC_LLVM_UNWINDER=ON -DCOMPILER_RT_ENABLE_STATIC_UNWINDER=ON,,"
30# Context Profiling
31PACKAGECONFIG[ctx-profile] = "-DCOMPILER_RT_BUILD_CTX_PROFILE=ON,-DCOMPILER_RT_BUILD_CTX_PROFILE=OFF"
32
33HF = ""
34HF:class-target = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
35HF[vardepvalue] = "${HF}"
36
37CXXFLAGS:append:libc-musl = " -D_LARGEFILE64_SOURCE"
38
39OECMAKE_TARGET_COMPILE = "compiler-rt"
40OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers"
41OECMAKE_SOURCEPATH = "${S}/llvm"
42EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
43 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
44 -DCOMPILER_RT_STANDALONE_BUILD=ON \
45 -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
46 -DCOMPILER_RT_BUILD_BUILTINS=OFF \
47 -DCOMPILER_RT_INCLUDE_TESTS=OFF \
48 -DSANITIZER_CXX_ABI_LIBNAME=${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "libc++", "libstdc++", d)} \
49 -DCOMPILER_RT_BUILD_XRAY=ON \
50 -DCOMPILER_RT_BUILD_SANITIZERS=ON \
51 -DCOMPILER_RT_BUILD_LIBFUZZER=ON \
52 -DCOMPILER_RT_BUILD_PROFILE=ON \
53 -DCOMPILER_RT_BUILD_MEMPROF=ON \
54 -DLLVM_ENABLE_RUNTIMES='compiler-rt' \
55 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
56 -DLLVM_APPEND_VC_REV=OFF \
57 -S ${S}/runtimes \
58"
59
60EXTRA_OECMAKE:append:class-target = "\
61 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
62 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
63 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
64 -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \
65 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
66 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
67"
68
69EXTRA_OECMAKE:append:class-nativesdk = "\
70 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
71 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
72 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
73 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
74 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
75 -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \
76 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
77"
78
79EXTRA_OECMAKE:append:libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON "
80EXTRA_OECMAKE:append:powerpc = " -DCOMPILER_RT_DEFAULT_TARGET_ARCH=powerpc "
81
82do_install:append () {
83 mkdir -p ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib
84 mv ${D}${nonarch_libdir}/linux ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib
85 # Already shipped with compile-rt Orc support
86 rm -rf ${D}${nonarch_libdir}/clang/${MAJOR_VER}/lib/linux/liborc_rt-*.a
87 rm -rf ${D}${nonarch_libdir}/clang/${MAJOR_VER}/include/orc/
88}
89
90FILES_SOLIBSDEV = ""
91FILES:${PN} += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER} \
92 ${nonarch_libdir}/clang/${MAJOR_VER}/lib/linux/lib*${SOLIBSDEV} \
93 ${nonarch_libdir}/clang/${MAJOR_VER}/*.txt \
94 ${nonarch_libdir}/clang/${MAJOR_VER}/share/*.txt"
95FILES:${PN}-staticdev += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
96FILES:${PN}-dev += "${datadir} ${nonarch_libdir}/clang/${MAJOR_VER}/lib/linux/*.syms \
97 ${nonarch_libdir}/clang/${MAJOR_VER}/include \
98 ${nonarch_libdir}/clang/${MAJOR_VER}/lib/linux/clang_rt.crt*.o \
99 ${nonarch_libdir}/clang/${MAJOR_VER}/lib/linux/libclang_rt.asan-preinit*.a"
100INSANE_SKIP:${PN} = "dev-so libdir"
101INSANE_SKIP:${PN}-dbg = "libdir"
102
103#PROVIDES:append:class-target = "\
104# virtual/${MLPREFIX}compilerlibs \
105# libgcc \
106# libgcc-initial \
107# libgcc-dev \
108# libgcc-initial-dev \
109# "
110#
111
112RDEPENDS:${PN}-dev += "${PN}-staticdev"
113
114BBCLASSEXTEND = "native nativesdk"
115
116ALLOW_EMPTY:${PN} = "1"
117ALLOW_EMPTY:${PN}-dev = "1"
118
119TOOLCHAIN = "clang"
120# Overrides defaults from clang.bbclass
121TOOLCHAIN:class-nativesdk = "clang"
122TOOLCHAIN:class-native = "clang"
123SYSROOT_DIRS:append:class-target = " ${nonarch_libdir}"
124
125# riscv and x86_64 Sanitizers work on musl too
126COMPATIBLE_HOST:libc-musl:x86-64 = "(.*)"
127COMPATIBLE_HOST:libc-musl:riscv64 = "(.*)"
128COMPATIBLE_HOST:libc-musl:riscv32 = "(.*)"
129COMPATIBLE_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 debc61f..0000000
--- a/recipes-devtools/clang/compiler-rt_git.bb
+++ /dev/null
@@ -1,130 +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
4SUMMARY = "LLVM based C/C++ compiler Runtime"
5DESCRIPTIOM = "Simple builtin library that provides an \
6 implementation of the low-level target-specific \
7 hooks required by code generation and other runtime \
8 components"
9HOMEPAGE = "http://compiler-rt.llvm.org/"
10SECTION = "base"
11
12require clang.inc
13require common-source.inc
14
15BPN = "compiler-rt"
16
17inherit cmake cmake-native pkgconfig python3native
18
19
20LIC_FILES_CHKSUM = "file://compiler-rt/LICENSE.TXT;md5=d846d1d65baf322d4c485d6ee54e877a"
21
22LIBCPLUSPLUS = ""
23COMPILER_RT = ""
24
25TUNE_CCARGS:remove = "-no-integrated-as"
26
27INHIBIT_DEFAULT_DEPS = "1"
28
29DEPENDS += "ninja-native libgcc"
30DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc gcc-runtime"
31DEPENDS:append:class-nativesdk = " clang-native clang-crosssdk-${SDK_SYS} nativesdk-gcc-runtime"
32DEPENDS:append:class-native = " clang-native"
33
34# Trick clang.bbclass into not creating circular dependencies
35UNWINDLIB:class-nativesdk:toolchain-clang = "--unwindlib=libgcc"
36COMPILER_RT:class-nativesdk:toolchain-clang = "-rtlib=libgcc --unwindlib=libgcc"
37LIBCPLUSPLUS:class-nativesdk:toolchain-clang = "-stdlib=libstdc++"
38UNWINDLIB:class-native:toolchain-clang = "--unwindlib=libgcc"
39COMPILER_RT:class-native:toolchain-clang = "-rtlib=libgcc --unwindlib=libgcc"
40LIBCPLUSPLUS:class-native:toolchain-clang = "-stdlib=libstdc++"
41UNWINDLIB:class-target:toolchain-clang = "--unwindlib=libgcc"
42COMPILER_RT:class-target:toolchain-clang = "-rtlib=libgcc --unwindlib=libgcc"
43LIBCPLUSPLUS:class-target:toolchain-clang = "-stdlib=libstdc++"
44
45PACKAGECONFIG ??= ""
46PACKAGECONFIG[crt] = "-DCOMPILER_RT_BUILD_CRT:BOOL=ON,-DCOMPILER_RT_BUILD_CRT:BOOL=OFF"
47PACKAGECONFIG[profile] = "-DCOMPILER_RT_BUILD_PROFILE=ON,-DCOMPILER_RT_BUILD_PROFILE=OFF"
48# Context Profiling, might need to enable 'profile' too
49PACKAGECONFIG[ctx-profile] = "-DCOMPILER_RT_BUILD_CTX_PROFILE=ON,-DCOMPILER_RT_BUILD_CTX_PROFILE=OFF"
50
51HF = ""
52HF:class-target = "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}"
53HF[vardepvalue] = "${HF}"
54
55OECMAKE_TARGET_COMPILE = "compiler-rt"
56OECMAKE_TARGET_INSTALL = "install-compiler-rt install-compiler-rt-headers"
57OECMAKE_SOURCEPATH = "${S}/llvm"
58EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
59 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
60 -DCOMPILER_RT_STANDALONE_BUILD=ON \
61 -DCOMPILER_RT_INCLUDE_TESTS=OFF \
62 -DCOMPILER_RT_BUILD_XRAY=OFF \
63 -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
64 -DCOMPILER_RT_BUILD_MEMPROF=OFF \
65 -DCOMPILER_RT_BUILD_LIBFUZZER=OFF \
66 -DLLVM_ENABLE_RUNTIMES='compiler-rt' \
67 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
68 -DLLVM_APPEND_VC_REV=OFF \
69 -S ${S}/runtimes \
70"
71EXTRA_OECMAKE:append:class-target = "\
72 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
73 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
74 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
75 -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \
76 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
77 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
78"
79
80EXTRA_OECMAKE:append:class-nativesdk = "\
81 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \
82 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \
83 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \
84 -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
85 -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
86 -DCMAKE_C_COMPILER_TARGET=${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}${HF} \
87 -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
88"
89EXTRA_OECMAKE:append:powerpc = " -DCOMPILER_RT_DEFAULT_TARGET_ARCH=powerpc "
90
91do_install:append () {
92 mkdir -p ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib
93 mv ${D}${nonarch_libdir}/linux ${D}${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib
94}
95
96FILES_SOLIBSDEV = ""
97
98FILES:${PN} += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/lib*${SOLIBSDEV} \
99 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/*.txt \
100 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/share/*.txt"
101FILES:${PN}-staticdev += "${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.a"
102FILES:${PN}-dev += "${datadir} ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/*.syms \
103 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/include \
104 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/clang_rt.crt*.o \
105 ${nonarch_libdir}/clang/${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}/lib/linux/libclang_rt.asan-preinit*.a"
106
107INSANE_SKIP:${PN} = "dev-so libdir"
108INSANE_SKIP:${PN}-dbg = "libdir"
109
110#PROVIDES:append:class-target = "\
111# virtual/${MLPREFIX}compilerlibs \
112# libgcc \
113# libgcc-initial \
114# libgcc-dev \
115# libgcc-initial-dev \
116# "
117#
118
119RDEPENDS:${PN}-dev += "${PN}-staticdev"
120
121BBCLASSEXTEND = "native nativesdk"
122
123ALLOW_EMPTY:${PN} = "1"
124ALLOW_EMPTY:${PN}-dev = "1"
125
126TOOLCHAIN = "clang"
127# Overrides defaults from clang.bbclass
128TOOLCHAIN:class-nativesdk = "clang"
129TOOLCHAIN:class-native = "clang"
130SYSROOT_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 1e2f837..0000000
--- a/recipes-devtools/clang/libclc_git.bb
+++ /dev/null
@@ -1,38 +0,0 @@
1SUMMARY = "Implementation of the library requirements of the OpenCL 1.1+ C programming language"
2HOMEPAGE = "http://libclc.llvm.org/"
3SECTION = "libs"
4
5require clang.inc
6require common-source.inc
7
8BPN = "libclc"
9
10TOOLCHAIN = "clang"
11
12LIC_FILES_CHKSUM = "file://libclc/LICENSE.TXT;md5=7cc795f6cbb2d801d84336b83c8017db"
13
14inherit cmake cmake-qemu pkgconfig python3native
15
16DEPENDS += "clang spirv-tools spirv-llvm-translator spirv-llvm-translator-native ncurses"
17
18OECMAKE_SOURCEPATH = "${S}/libclc"
19
20EXTRA_OECMAKE += "\
21 -DLLVM_APPEND_VC_REV=OFF \
22 -DLIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR=${STAGING_BINDIR_NATIVE} \
23 -DLLVM_CLANG=${STAGING_BINDIR_NATIVE}/clang \
24 -DLLVM_AS=${STAGING_BINDIR_NATIVE}/llvm-as \
25 -DLLVM_LINK=${STAGING_BINDIR_NATIVE}/llvm-link \
26 -DLLVM_OPT=${STAGING_BINDIR_NATIVE}/opt \
27 -DLLVM_SPIRV=${STAGING_BINDIR_NATIVE}/llvm-spirv \
28 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
29 -Dclc_comp_in:FILEPATH=${OECMAKE_SOURCEPATH}/cmake/CMakeCLCCompiler.cmake.in \
30 -Dll_comp_in:FILEPATH=${OECMAKE_SOURCEPATH}/cmake/CMakeLLAsmCompiler.cmake.in \
31 -DCMAKE_POSITION_INDEPENDENT_CODE=ON"
32
33FILES:${PN} += "${datadir}/clc"
34
35BBCLASSEXTEND = "native nativesdk"
36
37export YOCTO_ALTERNATE_EXE_PATH
38export YOCTO_ALTERNATE_LIBDIR
diff --git a/recipes-devtools/clang/libcxx_git.bb b/recipes-devtools/clang/libcxx_git.bb
deleted file mode 100644
index 85c467c..0000000
--- a/recipes-devtools/clang/libcxx_git.bb
+++ /dev/null
@@ -1,117 +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
4SUMMARY = "libc++ is a new implementation of the C++ standard library, targeting C++11 and above"
5HOMEPAGE = "http://libcxx.llvm.org/"
6SECTION = "base"
7
8require clang.inc
9require common-source.inc
10
11inherit cmake cmake-native python3native
12
13BPN = "libcxx"
14
15PACKAGECONFIG ??= "compiler-rt exceptions ${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "unwind unwind-shared", "", d)}"
16PACKAGECONFIG:append:armv5 = " no-atomics"
17PACKAGECONFIG:remove:class-native = "compiler-rt"
18PACKAGECONFIG[unwind] = "-DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON,-DLIBCXXABI_USE_LLVM_UNWINDER=OFF,,"
19PACKAGECONFIG[exceptions] = "-DLIBCXXABI_ENABLE_EXCEPTIONS=ON -DLIBCXX_ENABLE_EXCEPTIONS=ON,-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF -DLIBCXX_ENABLE_EXCEPTIONS=OFF -DCMAKE_REQUIRED_FLAGS='-fno-exceptions',"
20PACKAGECONFIG[no-atomics] = "-D_LIBCXXABI_HAS_ATOMIC_BUILTINS=OFF -DCMAKE_SHARED_LINKER_FLAGS='-latomic',,"
21PACKAGECONFIG[compiler-rt] = "-DLIBCXX_USE_COMPILER_RT=ON -DLIBCXXABI_USE_COMPILER_RT=ON -DLIBUNWIND_USE_COMPILER_RT=ON,,compiler-rt"
22PACKAGECONFIG[unwind-shared] = "-DLIBUNWIND_ENABLE_SHARED=ON,-DLIBUNWIND_ENABLE_SHARED=OFF,,"
23
24DEPENDS += "ninja-native"
25DEPENDS:append:class-target = " clang-cross-${TARGET_ARCH} virtual/${MLPREFIX}libc virtual/${MLPREFIX}compilerlibs"
26DEPENDS:append:class-nativesdk = " clang-crosssdk-${SDK_SYS} nativesdk-compiler-rt"
27DEPENDS:append:class-native = " clang-native compiler-rt-native"
28
29COMPILER_RT ?= "${@bb.utils.contains("PACKAGECONFIG", "compiler-rt", "-rtlib=compiler-rt", "-rtlib=libgcc", d)}"
30UNWINDLIB ?= "${@bb.utils.contains("PACKAGECONFIG", "unwind", "-unwindlib=none", "-unwindlib=libgcc", d)}"
31LIBCPLUSPLUS ?= "-stdlib=libstdc++"
32# Trick clang.bbclass into not creating circular dependencies
33UNWINDLIB:class-nativesdk = "-unwindlib=libgcc"
34LIBCPLUSPLUS:class-nativesdk = "-stdlib=libstdc++"
35UNWINDLIB:class-native = "-unwindlib=libgcc"
36LIBCPLUSPLUS:class-native = "-stdlib=libstdc++"
37
38LDFLAGS:append = " ${UNWINDLIB}"
39
40INHIBIT_DEFAULT_DEPS = "1"
41
42LIC_FILES_CHKSUM = "file://libcxx/LICENSE.TXT;md5=55d89dd7eec8d3b4204b680e27da3953 \
43 file://libcxxabi/LICENSE.TXT;md5=7b9334635b542c56868400a46b272b1e \
44 file://libunwind/LICENSE.TXT;md5=f66970035d12f196030658b11725e1a1 \
45"
46
47OECMAKE_TARGET_COMPILE = "${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "unwind", "", d)} cxxabi cxx"
48OECMAKE_TARGET_INSTALL = "${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "install-unwind", "", d)} install-cxxabi install-cxx"
49
50OECMAKE_SOURCEPATH = "${S}/llvm"
51EXTRA_OECMAKE += "\
52 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
53 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
54 -DCMAKE_CROSSCOMPILING=ON \
55 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
56 -DLLVM_ENABLE_RTTI=ON \
57 -DLIBUNWIND_ENABLE_CROSS_UNWINDING=ON \
58 -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
59 -DLIBCXXABI_INCLUDE_TESTS=OFF \
60 -DLIBCXXABI_ENABLE_SHARED=ON \
61 -DLIBCXXABI_LIBCXX_INCLUDES=${S}/libcxx/include \
62 -DLIBCXX_CXX_ABI=libcxxabi \
63 -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${S}/libcxxabi/include \
64 -DLIBCXX_CXX_ABI_LIBRARY_PATH=${B}/lib${LLVM_LIBDIR_SUFFIX} \
65 -S ${S}/runtimes \
66 -DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \
67 -DLLVM_RUNTIME_TARGETS=${HOST_SYS} \
68 -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} \
69 -DLLVM_APPEND_VC_REV=OFF \
70 -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
71"
72
73EXTRA_OECMAKE:append:class-target = " \
74 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${AR} \
75 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${NM} \
76 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${RANLIB} \
77 -DLLVM_DEFAULT_TARGET_TRIPLE=${HOST_SYS} \
78 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
79"
80
81EXTRA_OECMAKE:append:class-nativesdk = " \
82 -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${AR} \
83 -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${NM} \
84 -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${RANLIB} \
85 -DLLVM_DEFAULT_TARGET_TRIPLE=${HOST_SYS} \
86"
87
88EXTRA_OECMAKE:append:libc-musl = " -DLIBCXX_HAS_MUSL_LIBC=ON "
89
90CXXFLAGS:append:armv5 = " -mfpu=vfp2"
91
92ALLOW_EMPTY:${PN} = "1"
93
94PROVIDES:append:runtime-llvm = " libunwind"
95
96do_install:append() {
97 if ${@bb.utils.contains("TC_CXX_RUNTIME", "llvm", "true", "false", d)}
98 then
99 for f in libunwind.h __libunwind_config.h unwind.h unwind_itanium.h unwind_arm_ehabi.h
100 do
101 install -Dm 0644 ${S}/libunwind/include/$f ${D}${includedir}/$f
102 done
103 install -d ${D}${libdir}/pkgconfig
104 sed -e 's,@LIBDIR@,${libdir},g;s,@VERSION@,${PV},g' ${S}/libunwind/libunwind.pc.in > ${D}${libdir}/pkgconfig/libunwind.pc
105 fi
106}
107
108PACKAGES:append:runtime-llvm = " libunwind"
109FILES:libunwind:runtime-llvm = "${libdir}/libunwind.so.*"
110# Package library module manifest path
111FILES:${PN}-dev += "${datadir}/libc++/v1/ ${libdir}/libc++.modules.json"
112
113BBCLASSEXTEND = "native nativesdk"
114TOOLCHAIN = "clang"
115# Overrides defaults from clang.bbclass
116TOOLCHAIN:class-nativesdk = "clang"
117TOOLCHAIN:class-native = "clang"
diff --git a/recipes-devtools/clang/llvm-project-source.bb b/recipes-devtools/clang/llvm-project-source.bb
deleted file mode 100644
index c1cd887..0000000
--- a/recipes-devtools/clang/llvm-project-source.bb
+++ /dev/null
@@ -1,12 +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
10BPN = "llvm-project-source"
11
12EXCLUDE_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 50e9154..0000000
--- a/recipes-devtools/clang/llvm-project-source.inc
+++ /dev/null
@@ -1,99 +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
28B = "${WORKDIR}/build"
29
30# space separated list of additional distro vendor values we want to support e.g.
31# "yoe webos" or "-yoe -webos" '-' is optional
32CLANG_EXTRA_OE_VENDORS ?= "${TARGET_VENDOR} ${SDK_VENDOR}"
33# Extra OE DISTRO that want to support as build host. space separated list of additional distro.
34# ":" separated the ID in "/etc/os-release" and the triple for finding gcc on this OE DISTRO.
35# eg: "poky:poky wrlinux:wrs"
36CLANG_EXTRA_OE_DISTRO ?= "poky:poky"
37# Match with MULTILIB_GLOBAL_VARIANTS
38MULTILIB_VARIANTS = "lib32 lib64 libx32"
39
40python do_preconfigure() {
41 import subprocess
42 case = ""
43 triple = ""
44 vendors = d.getVar('CLANG_EXTRA_OE_VENDORS')
45 multilib_variants = (d.getVar("MULTILIB_VARIANTS") or "").split()
46 vendors_to_add = []
47 for vendor in vendors.split():
48 # convert -yoe into yoe
49 vendor = vendor.lstrip('-')
50 # generate possible multilib vendor names for yoe
51 # such as yoemllib32
52 vendors_to_add.extend([vendor + 'ml' + variant for variant in multilib_variants])
53 # skip oe since already part of the cpp file
54 if vendor != "oe":
55 vendors_to_add.append(vendor)
56
57 for vendor_to_add in vendors_to_add:
58 case += '\\n .Case("' + vendor_to_add + '", Triple::OpenEmbedded)'
59 triple += ' "x86_64-' + vendor_to_add + '-linux",'
60
61 bb.note("Adding support following TARGET_VENDOR values")
62 bb.note(str(vendors_to_add))
63 bb.note("in llvm/lib/TargetParser/Triple.cpp and ${S}/clang/lib/Driver/ToolChains/Gnu.cpp")
64 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_TRIPLES#%s#g' ${S}/clang/lib/Driver/ToolChains/Gnu.cpp" % (triple))
65 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
66 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_VENDORS_CASES#%s#g' -i ${S}/llvm/lib/TargetParser/Triple.cpp" % (case))
67 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
68
69
70 case = ""
71 triple = ""
72 name = ""
73 check = ""
74 oe_names = ""
75 distros = d.getVar('CLANG_EXTRA_OE_DISTRO')
76 for distro in distros.split():
77 distro_id = distro.split(":")[0].replace('-','_')
78 distro_triple = distro.split(":")[1]
79 case += '\\n .Case("' + distro_id + '", Distro::' + distro_id.upper() + ')'
80 triple += '\\n if (Distro.Is' + distro_id.upper() + '())\\n return "x86_64-' + distro_triple + '-linux",'
81 name += '\\n '+ distro_id.upper() + ','
82 check += '\\nbool Is' + distro_id.upper() + '() const { return DistroVal == ' + distro_id.upper() + '; }'
83 oe_names += distro_id.upper() + ' ||'
84
85 check += '\\nbool IsOpenEmbedded() const { return DistroVal == ' + oe_names[0:-3] + '; }'
86
87 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_NAME#%s#g' ${S}/clang/include/clang/Driver/Distro.h" % (name))
88 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
89 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_CHECK#%s#g' ${S}/clang/include/clang/Driver/Distro.h" % (check))
90 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
91 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_TRIPLES#%s#g' ${S}/clang/lib/Driver/ToolChains/Linux.cpp" % (triple))
92 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
93 cmd = d.expand("sed -i 's#//CLANG_EXTRA_OE_DISTRO_CASES#%s#g' -i ${S}/clang/lib/Driver/Distro.cpp" % (case))
94 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
95}
96
97do_patch[vardepsexclude] = "MULTILIBS"
98addtask do_preconfigure after do_patch
99do_create_spdx[depends] += "${PN}:do_preconfigure"
diff --git a/recipes-devtools/clang/nativesdk-clang-glue.bb b/recipes-devtools/clang/nativesdk-clang-glue.bb
deleted file mode 100644
index 8e5622f..0000000
--- a/recipes-devtools/clang/nativesdk-clang-glue.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
4SUMMARY = "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_defer 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_package_spdx
36deltask 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 398479b..0000000
--- a/recipes-devtools/clang/openmp_git.bb
+++ /dev/null
@@ -1,67 +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
4SUMMARY = "LLVM OpenMP compiler Runtime"
5HOMEPAGE = "https://openmp.llvm.org/"
6SECTION = "libs"
7
8require clang.inc
9require common-source.inc
10
11BPN = "openmp"
12
13TOOLCHAIN = "clang"
14
15LIC_FILES_CHKSUM = "file://openmp/LICENSE.TXT;md5=d75288d1ce0450b28b8d58a284c09c79"
16
17inherit cmake pkgconfig perlnative python3native python3targetconfig
18
19DEPENDS += "elfutils libffi clang"
20
21EXTRA_OECMAKE += "-DCMAKE_BUILD_TYPE=RelWithDebInfo \
22 -DLLVM_APPEND_VC_REV=OFF \
23 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
24 -DOPENMP_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
25 -DOPENMP_STANDALONE_BUILD=ON \
26 -DCLANG_TOOL=${STAGING_BINDIR_NATIVE}/clang \
27 -DLINK_TOOL=${STAGING_BINDIR_NATIVE}/llvm-link \
28 -DOPT_TOOL=${STAGING_BINDIR_NATIVE}/opt \
29 -DOPENMP_LLVM_LIT_EXECUTABLE=${STAGING_BINDIR_NATIVE}/llvm-lit \
30 -DEXTRACT_TOOL=${STAGING_BINDIR_NATIVE}/llvm-extract \
31 -DPACKAGER_TOOL=${STAGING_BINDIR_NATIVE}/clang-offload-packager \
32 -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
33 "
34
35OECMAKE_SOURCEPATH = "${S}/openmp"
36
37PACKAGECONFIG ?= "ompt-tools offloading-plugin"
38
39PACKAGECONFIG:remove:arm = "ompt-tools offloading-plugin"
40PACKAGECONFIG:remove:powerpc = "ompt-tools offloading-plugin"
41
42PACKAGECONFIG:append:mipsarcho32 = " no-atomics"
43
44PACKAGECONFIG[ompt-tools] = "-DOPENMP_ENABLE_OMPT_TOOLS=ON,-DOPENMP_ENABLE_OMPT_TOOLS=OFF,"
45PACKAGECONFIG[aliases] = "-DLIBOMP_INSTALL_ALIASES=ON,-DLIBOMP_INSTALL_ALIASES=OFF,"
46PACKAGECONFIG[offloading-plugin] = ",,elfutils libffi,libelf libffi"
47PACKAGECONFIG[no-atomics] = "-DLIBOMP_HAVE_BUILTIN_ATOMIC=OFF -DLIBOMP_LIBFLAGS='-latomic',,"
48
49PACKAGES += "${PN}-libomptarget ${PN}-gdb-plugin"
50FILES_SOLIBSDEV = ""
51FILES:${PN} += "${libdir}/lib*${SOLIBSDEV}"
52FILES:${PN}-libomptarget = "${libdir}/libomptarget-*.bc"
53FILES:${PN}-gdb-plugin = "${datadir}/gdb/python/ompd"
54
55RDEPENDS:${PN}-gdb-plugin += "python3-core"
56
57INSANE_SKIP:${PN} = "dev-so"
58# Currently the static libraries contain buildpaths
59INSANE_SKIP:${PN}-staticdev += "buildpaths"
60
61COMPATIBLE_HOST:mips64 = "null"
62COMPATIBLE_HOST:riscv32 = "null"
63COMPATIBLE_HOST:powerpc = "null"
64
65BBCLASSEXTEND = "native nativesdk"
66
67CVE_STATUS[CVE-2022-26345] = "cpe-incorrect: specific to the Intel distribution before 2022.1"