From 85d96727f5532da645053ef913921dd9b1b18668 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 14 May 2021 17:17:32 -0700 Subject: clang: Upgrade to trunk/13.0 future series Signed-off-by: Khem Raj (cherry picked from commit 76e37fafa29e9b2097eb823537b17d6cc638c1d5) Conflicts: - recipes-devtools/clang/common.inc: caused by 3880a395f870ecd8da73d2de1e2b88a855df2ef0, the patches have been kept. The patch introduced in fdb936e80b30f40cbf7ef9a8e124b58eec95f45c is part of LLVM 13 so it has been removed. --- conf/layer.conf | 2 +- recipes-devtools/clang/clang.inc | 6 +- ...d-lxml2-to-linker-cmdline-of-xml-is-found.patch | 6 +- ...ind-libunwind-headers-when-LIBCXXABI_LIBU.patch | 8 +- ...er-rt-support-a-new-embedded-linux-target.patch | 2 +- ...-Simplify-cross-compilation.-Don-t-use-na.patch | 6 +- ...LibraryInfo-Undefine-libc-functions-if-th.patch | 88 +++++ ...LibraryInfo-Undefine-libc-functions-if-th.patch | 88 ----- .../0006-llvm-allow-env-override-of-exe-path.patch | 34 ++ ...-clang-driver-Check-sysroot-for-ldso-path.patch | 61 ++++ .../0007-llvm-allow-env-override-of-exe-path.patch | 34 -- ...iver-tools.cpp-Add-lssp_nonshared-on-musl.patch | 31 ++ ...-clang-driver-Check-sysroot-for-ldso-path.patch | 61 ---- ...iver-tools.cpp-Add-lssp_nonshared-on-musl.patch | 31 -- ...-ppc-does-not-support-128-bit-long-double.patch | 25 ++ .../0010-clang-Prepend-trailing-to-sysroot.patch | 38 +++ ...-ppc-does-not-support-128-bit-long-double.patch | 25 -- ...inside-the-target-sysroot-for-compiler-ru.patch | 40 +++ .../0011-clang-Prepend-trailing-to-sysroot.patch | 38 --- ...ang-Define-releative-gcc-installation-dir.patch | 46 +++ ...inside-the-target-sysroot-for-compiler-ru.patch | 40 --- ...pthread-and-ldl-along-with-lunwind-for-st.patch | 38 +++ ...ang-Define-releative-gcc-installation-dir.patch | 45 --- ..._EXECUTABLE-when-cross-compiling-for-nati.patch | 23 ++ ...dso-for-musl-on-x86-and-x32-architectures.patch | 41 --- .../0015-Check-for-atomic-double-intrinsics.patch | 33 ++ .../0015-clang-scan-view-needs-python-2.x.patch | 24 -- ...pthread-and-ldl-along-with-lunwind-for-st.patch | 40 --- .../0016-clang-Enable-SSP-and-PIE-by-default.patch | 312 +++++++++++++++++ ..._EXECUTABLE-when-cross-compiling-for-nati.patch | 23 -- ...compiler-runtime-library-to-link-step-for.patch | 37 ++ .../0018-Check-for-atomic-double-intrinsics.patch | 33 -- ...cmake-Fix-configure-for-packages-using-fi.patch | 116 +++++++ .../0019-clang-Enable-SSP-and-PIE-by-default.patch | 310 ----------------- ...esource-dir-location-for-cross-toolchains.patch | 39 +++ .../clang/clang/0020-fix-path-to-libffi.patch | 26 ++ ...compiler-runtime-library-to-link-step-for.patch | 37 -- ...r-Add-dyld-prefix-when-checking-sysroot-f.patch | 67 ++++ ...cmake-Fix-configure-for-packages-using-fi.patch | 140 -------- ...esource-dir-location-for-cross-toolchains.patch | 39 --- .../0022-clang-Use-python3-in-python-scripts.patch | 101 ++++++ ...4-set-Yocto-based-GCC-install-search-path.patch | 70 ++++ .../clang/clang/0023-fix-path-to-libffi.patch | 26 -- ...r-Add-dyld-prefix-when-checking-sysroot-f.patch | 67 ---- .../clang/0024-compiler-rt-Include-stddef.h.patch | 27 ++ .../0025-clang-Use-python3-in-python-scripts.patch | 112 ------ ...-llvm-Do-not-use-find_library-for-ncurses.patch | 44 +++ ...4-set-Yocto-based-GCC-install-search-path.patch | 70 ---- ...-anchor-for-adding-OE-distro-vendor-names.patch | 32 ++ .../clang/0027-compiler-rt-Include-stddef.h.patch | 27 -- ...ompiler-rt-Use-mcr-based-barrier-on-armv6.patch | 71 ++++ ...h-defaults-to-dwarf-5-debug-info-on-Linux.patch | 28 ++ ...-llvm-Do-not-use-find_library-for-ncurses.patch | 44 --- ...-anchor-for-adding-OE-distro-vendor-names.patch | 32 -- ...mitter-sort-ClassInfo-lists-by-name-as-we.patch | 32 -- ...ompiler-rt-Use-mcr-based-barrier-on-armv6.patch | 71 ---- ...h-defaults-to-dwarf-5-debug-info-on-Linux.patch | 28 -- ...llable-find-modules-for-terminfo-and-libf.patch | 19 +- ...993-reference_wrapper-T-conversion-from-U.patch | 379 --------------------- recipes-devtools/clang/clang_git.bb | 7 +- recipes-devtools/clang/common.inc | 52 ++- 61 files changed, 1481 insertions(+), 1991 deletions(-) create mode 100644 recipes-devtools/clang/clang/0005-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch delete mode 100644 recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch create mode 100644 recipes-devtools/clang/clang/0006-llvm-allow-env-override-of-exe-path.patch create mode 100644 recipes-devtools/clang/clang/0007-clang-driver-Check-sysroot-for-ldso-path.patch delete mode 100644 recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch create mode 100644 recipes-devtools/clang/clang/0008-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch delete mode 100644 recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch delete mode 100644 recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch create mode 100644 recipes-devtools/clang/clang/0009-clang-musl-ppc-does-not-support-128-bit-long-double.patch create mode 100644 recipes-devtools/clang/clang/0010-clang-Prepend-trailing-to-sysroot.patch delete mode 100644 recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch create mode 100644 recipes-devtools/clang/clang/0011-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch delete mode 100644 recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch create mode 100644 recipes-devtools/clang/clang/0012-clang-Define-releative-gcc-installation-dir.patch delete mode 100644 recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch create mode 100644 recipes-devtools/clang/clang/0013-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch delete mode 100644 recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch create mode 100644 recipes-devtools/clang/clang/0014-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch delete mode 100644 recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch create mode 100644 recipes-devtools/clang/clang/0015-Check-for-atomic-double-intrinsics.patch delete mode 100644 recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch delete mode 100644 recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch create mode 100644 recipes-devtools/clang/clang/0016-clang-Enable-SSP-and-PIE-by-default.patch delete mode 100644 recipes-devtools/clang/clang/0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch create mode 100644 recipes-devtools/clang/clang/0017-libcxx-Add-compiler-runtime-library-to-link-step-for.patch delete mode 100644 recipes-devtools/clang/clang/0018-Check-for-atomic-double-intrinsics.patch create mode 100644 recipes-devtools/clang/clang/0018-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch delete mode 100644 recipes-devtools/clang/clang/0019-clang-Enable-SSP-and-PIE-by-default.patch create mode 100644 recipes-devtools/clang/clang/0019-clang-Fix-resource-dir-location-for-cross-toolchains.patch create mode 100644 recipes-devtools/clang/clang/0020-fix-path-to-libffi.patch delete mode 100644 recipes-devtools/clang/clang/0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch create mode 100644 recipes-devtools/clang/clang/0021-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch delete mode 100644 recipes-devtools/clang/clang/0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch delete mode 100644 recipes-devtools/clang/clang/0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch create mode 100644 recipes-devtools/clang/clang/0022-clang-Use-python3-in-python-scripts.patch create mode 100644 recipes-devtools/clang/clang/0023-For-x86_64-set-Yocto-based-GCC-install-search-path.patch delete mode 100644 recipes-devtools/clang/clang/0023-fix-path-to-libffi.patch delete mode 100644 recipes-devtools/clang/clang/0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch create mode 100644 recipes-devtools/clang/clang/0024-compiler-rt-Include-stddef.h.patch delete mode 100644 recipes-devtools/clang/clang/0025-clang-Use-python3-in-python-scripts.patch create mode 100644 recipes-devtools/clang/clang/0025-llvm-Do-not-use-find_library-for-ncurses.patch delete mode 100644 recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch create mode 100644 recipes-devtools/clang/clang/0026-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch delete mode 100644 recipes-devtools/clang/clang/0027-compiler-rt-Include-stddef.h.patch create mode 100644 recipes-devtools/clang/clang/0027-compiler-rt-Use-mcr-based-barrier-on-armv6.patch create mode 100644 recipes-devtools/clang/clang/0028-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch delete mode 100644 recipes-devtools/clang/clang/0028-llvm-Do-not-use-find_library-for-ncurses.patch delete mode 100644 recipes-devtools/clang/clang/0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch delete mode 100644 recipes-devtools/clang/clang/0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch delete mode 100644 recipes-devtools/clang/clang/0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch delete mode 100644 recipes-devtools/clang/clang/0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch delete mode 100644 recipes-devtools/clang/clang/0036-libc-LWG2993-reference_wrapper-T-conversion-from-U.patch diff --git a/conf/layer.conf b/conf/layer.conf index 19e348b..6fa70ad 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -33,7 +33,7 @@ INHERIT += "clang" # Do not include clang in SDK unless user wants to CLANGSDK ??= "0" -LLVMVERSION = "12.0.0" +LLVMVERSION = "13.0.0" require conf/nonclangable.conf require conf/nonscanable.conf diff --git a/recipes-devtools/clang/clang.inc b/recipes-devtools/clang/clang.inc index 6a08046..86e937f 100644 --- a/recipes-devtools/clang/clang.inc +++ b/recipes-devtools/clang/clang.inc @@ -4,14 +4,14 @@ LLVM_DIR = "llvm${LLVM_RELEASE}" LLVM_GIT ?= "git://github.com/llvm" LLVM_GIT_PROTOCOL ?= "https" -MAJOR_VER = "12" +MAJOR_VER = "13" MINOR_VER = "0" PATCH_VER = "0" -SRCREV ?= "fa0971b87fb2c9d14d1bba2551e61f02f18f329b" +SRCREV ?= "08d31ff4f45f795afb6648bc00257d60ff2f8204" PV = "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}" -BRANCH = "release/${MAJOR_VER}.x" +BRANCH = "main" LLVMMD5SUM = "8a15a0759ef07f2682d2ba4b893c9afe" CLANGMD5SUM = "ff42885ed2ab98f1ecb8c1fc41205343" diff --git a/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch b/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch index c1ba432..5a0c33d 100644 --- a/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch +++ b/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch @@ -1,4 +1,4 @@ -From 42e6673563ca1d0e433e16c3eefa20b98e280ebd Mon Sep 17 00:00:00 2001 +From b737bad67076c8c5a3f19f0808f7b5e4da616a5b Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 22 May 2017 17:36:16 -0700 Subject: [PATCH] lldb: Add -lxml2 to linker cmdline of xml is found @@ -23,10 +23,10 @@ Signed-off-by: Khem Raj 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt -index 7456cb98bfa1..1a732ec5cb89 100644 +index a018fd6c183d..936bdd461350 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt -@@ -138,7 +138,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "NetBSD") +@@ -137,7 +137,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "NetBSD") list(APPEND EXTRA_LIBS kvm) endif() if (LLDB_ENABLE_LIBXML2) diff --git a/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch b/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch index f101e77..da33f56 100644 --- a/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch +++ b/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch @@ -1,4 +1,4 @@ -From da63df8f02b3a767b68d6de730bb63bba6c3ce33 Mon Sep 17 00:00:00 2001 +From 854f2bcd9770dd31641c89be6fa2603ac339d818 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 27 Aug 2017 10:37:49 -0700 Subject: [PATCH] libcxxabi: Find libunwind headers when @@ -17,10 +17,10 @@ Signed-off-by: Khem Raj 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt -index 426c855288fc..06a62c642898 100644 +index d4eb01ce3888..5fe5b54371d1 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt -@@ -478,14 +478,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}") +@@ -516,14 +516,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}") # Setup Source Code #=============================================================================== @@ -36,7 +36,7 @@ index 426c855288fc..06a62c642898 100644 PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES} ${LIBCXXABI_LIBUNWIND_PATH}/include ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES} -@@ -496,15 +491,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) +@@ -534,15 +529,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) NO_CMAKE_FIND_ROOT_PATH ) diff --git a/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch b/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch index e8536d3..589833e 100644 --- a/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch +++ b/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch @@ -1,4 +1,4 @@ -From cfeba7ac05c96abddfad1eeb827ba8d0c968ec94 Mon Sep 17 00:00:00 2001 +From c4fa88657785e8ca179e39c6ec819960fd95c0f9 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sun, 19 Apr 2015 15:16:23 -0700 Subject: [PATCH] compiler-rt: support a new embedded linux target diff --git a/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch b/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch index 8b8edd8..ab6679a 100644 --- a/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch +++ b/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch @@ -1,4 +1,4 @@ -From 6c786d55d560abca076b7c1b718cdcb31ef5b388 Mon Sep 17 00:00:00 2001 +From 4b29b554ef9bfcbbcadd70f355df2f1eca55fade Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 19 May 2016 23:11:45 -0700 Subject: [PATCH] compiler-rt: Simplify cross-compilation. Don't use @@ -20,10 +20,10 @@ Signed-off-by: Khem Raj 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt -index b44ad2c2118e..ed8f4bd80e93 100644 +index c9939acfd710..57fe7bc635ed 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt -@@ -72,7 +72,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL +@@ -74,7 +74,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL "Build for a bare-metal target.") if (COMPILER_RT_STANDALONE_BUILD) diff --git a/recipes-devtools/clang/clang/0005-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/recipes-devtools/clang/clang/0005-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch new file mode 100644 index 0000000..a22c6dd --- /dev/null +++ b/recipes-devtools/clang/clang/0005-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch @@ -0,0 +1,88 @@ +From 91de17d8a3b8efa9758c7f393ae8647eb159657f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 21 May 2016 00:33:20 +0000 +Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are + macros + +musl defines some functions as macros and not inline functions +if this is the case then make sure to undefine them + +Signed-off-by: Khem Raj +--- + .../llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def +index defc95d0062a..41d2099d0c5b 100644 +--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def ++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def +@@ -809,6 +809,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") + TLI_DEFINE_ENUM_INTERNAL(fopen) + TLI_DEFINE_STRING_INTERNAL("fopen") + /// FILE *fopen64(const char *filename, const char *opentype) ++#ifdef fopen64 ++#undef fopen64 ++#endif + TLI_DEFINE_ENUM_INTERNAL(fopen64) + TLI_DEFINE_STRING_INTERNAL("fopen64") + /// int fork(); +@@ -856,6 +859,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek") + /// int fseeko(FILE *stream, off_t offset, int whence); + TLI_DEFINE_ENUM_INTERNAL(fseeko) + TLI_DEFINE_STRING_INTERNAL("fseeko") ++#ifdef fseeko64 ++#undef fseeko64 ++#endif + /// int fseeko64(FILE *stream, off64_t offset, int whence) + TLI_DEFINE_ENUM_INTERNAL(fseeko64) + TLI_DEFINE_STRING_INTERNAL("fseeko64") +@@ -866,6 +872,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos") + TLI_DEFINE_ENUM_INTERNAL(fstat) + TLI_DEFINE_STRING_INTERNAL("fstat") + /// int fstat64(int filedes, struct stat64 *buf) ++#ifdef fstat64 ++#undef fstat64 ++#endif + TLI_DEFINE_ENUM_INTERNAL(fstat64) + TLI_DEFINE_STRING_INTERNAL("fstat64") + /// int fstatvfs(int fildes, struct statvfs *buf); +@@ -881,6 +890,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell") + TLI_DEFINE_ENUM_INTERNAL(ftello) + TLI_DEFINE_STRING_INTERNAL("ftello") + /// off64_t ftello64(FILE *stream) ++#ifdef ftello64 ++#undef ftello64 ++#endif + TLI_DEFINE_ENUM_INTERNAL(ftello64) + TLI_DEFINE_STRING_INTERNAL("ftello64") + /// int ftrylockfile(FILE *file); +@@ -1007,6 +1019,9 @@ TLI_DEFINE_STRING_INTERNAL("logl") + TLI_DEFINE_ENUM_INTERNAL(lstat) + TLI_DEFINE_STRING_INTERNAL("lstat") + /// int lstat64(const char *path, struct stat64 *buf); ++#ifdef lstat64 ++#undef lstat64 ++#endif + TLI_DEFINE_ENUM_INTERNAL(lstat64) + TLI_DEFINE_STRING_INTERNAL("lstat64") + /// void *malloc(size_t size); +@@ -1250,6 +1265,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf") + TLI_DEFINE_ENUM_INTERNAL(stat) + TLI_DEFINE_STRING_INTERNAL("stat") + /// int stat64(const char *path, struct stat64 *buf); ++#ifdef stat64 ++#undef stat64 ++#endif + TLI_DEFINE_ENUM_INTERNAL(stat64) + TLI_DEFINE_STRING_INTERNAL("stat64") + /// int statvfs(const char *path, struct statvfs *buf); +@@ -1385,6 +1403,9 @@ TLI_DEFINE_STRING_INTERNAL("times") + TLI_DEFINE_ENUM_INTERNAL(tmpfile) + TLI_DEFINE_STRING_INTERNAL("tmpfile") + /// FILE *tmpfile64(void) ++#ifdef tmpfile64 ++#undef tmpfile64 ++#endif + TLI_DEFINE_ENUM_INTERNAL(tmpfile64) + TLI_DEFINE_STRING_INTERNAL("tmpfile64") + /// int toascii(int c); diff --git a/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch deleted file mode 100644 index 4e1120a..0000000 --- a/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 4afcffd0c4b3317b5b5e08e3372b2923ab471e4b Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 21 May 2016 00:33:20 +0000 -Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are - macros - -musl defines some functions as macros and not inline functions -if this is the case then make sure to undefine them - -Signed-off-by: Khem Raj ---- - .../llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++ - 1 file changed, 21 insertions(+) - -diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def -index defc95d0062a..41d2099d0c5b 100644 ---- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def -+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def -@@ -809,6 +809,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl") - TLI_DEFINE_ENUM_INTERNAL(fopen) - TLI_DEFINE_STRING_INTERNAL("fopen") - /// FILE *fopen64(const char *filename, const char *opentype) -+#ifdef fopen64 -+#undef fopen64 -+#endif - TLI_DEFINE_ENUM_INTERNAL(fopen64) - TLI_DEFINE_STRING_INTERNAL("fopen64") - /// int fork(); -@@ -856,6 +859,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek") - /// int fseeko(FILE *stream, off_t offset, int whence); - TLI_DEFINE_ENUM_INTERNAL(fseeko) - TLI_DEFINE_STRING_INTERNAL("fseeko") -+#ifdef fseeko64 -+#undef fseeko64 -+#endif - /// int fseeko64(FILE *stream, off64_t offset, int whence) - TLI_DEFINE_ENUM_INTERNAL(fseeko64) - TLI_DEFINE_STRING_INTERNAL("fseeko64") -@@ -866,6 +872,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos") - TLI_DEFINE_ENUM_INTERNAL(fstat) - TLI_DEFINE_STRING_INTERNAL("fstat") - /// int fstat64(int filedes, struct stat64 *buf) -+#ifdef fstat64 -+#undef fstat64 -+#endif - TLI_DEFINE_ENUM_INTERNAL(fstat64) - TLI_DEFINE_STRING_INTERNAL("fstat64") - /// int fstatvfs(int fildes, struct statvfs *buf); -@@ -881,6 +890,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell") - TLI_DEFINE_ENUM_INTERNAL(ftello) - TLI_DEFINE_STRING_INTERNAL("ftello") - /// off64_t ftello64(FILE *stream) -+#ifdef ftello64 -+#undef ftello64 -+#endif - TLI_DEFINE_ENUM_INTERNAL(ftello64) - TLI_DEFINE_STRING_INTERNAL("ftello64") - /// int ftrylockfile(FILE *file); -@@ -1007,6 +1019,9 @@ TLI_DEFINE_STRING_INTERNAL("logl") - TLI_DEFINE_ENUM_INTERNAL(lstat) - TLI_DEFINE_STRING_INTERNAL("lstat") - /// int lstat64(const char *path, struct stat64 *buf); -+#ifdef lstat64 -+#undef lstat64 -+#endif - TLI_DEFINE_ENUM_INTERNAL(lstat64) - TLI_DEFINE_STRING_INTERNAL("lstat64") - /// void *malloc(size_t size); -@@ -1250,6 +1265,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf") - TLI_DEFINE_ENUM_INTERNAL(stat) - TLI_DEFINE_STRING_INTERNAL("stat") - /// int stat64(const char *path, struct stat64 *buf); -+#ifdef stat64 -+#undef stat64 -+#endif - TLI_DEFINE_ENUM_INTERNAL(stat64) - TLI_DEFINE_STRING_INTERNAL("stat64") - /// int statvfs(const char *path, struct statvfs *buf); -@@ -1385,6 +1403,9 @@ TLI_DEFINE_STRING_INTERNAL("times") - TLI_DEFINE_ENUM_INTERNAL(tmpfile) - TLI_DEFINE_STRING_INTERNAL("tmpfile") - /// FILE *tmpfile64(void) -+#ifdef tmpfile64 -+#undef tmpfile64 -+#endif - TLI_DEFINE_ENUM_INTERNAL(tmpfile64) - TLI_DEFINE_STRING_INTERNAL("tmpfile64") - /// int toascii(int c); diff --git a/recipes-devtools/clang/clang/0006-llvm-allow-env-override-of-exe-path.patch b/recipes-devtools/clang/clang/0006-llvm-allow-env-override-of-exe-path.patch new file mode 100644 index 0000000..2901045 --- /dev/null +++ b/recipes-devtools/clang/clang/0006-llvm-allow-env-override-of-exe-path.patch @@ -0,0 +1,34 @@ +From b1c948df03ae8784f0078b9a23d78dff5cdb7175 Mon Sep 17 00:00:00 2001 +From: Martin Kelly +Date: Fri, 19 May 2017 00:22:57 -0700 +Subject: [PATCH] llvm: allow env override of exe path + +When using a native llvm-config from inside a sysroot, we need llvm-config to +return the libraries, include directories, etc. from inside the sysroot rather +than from the native sysroot. Thus provide an env override for calling +llvm-config from a target sysroot. + +Signed-off-by: Martin Kelly +Signed-off-by: Khem Raj +--- + llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp +index 1a2f04552d13..019d8f2b5c5e 100644 +--- a/llvm/tools/llvm-config/llvm-config.cpp ++++ b/llvm/tools/llvm-config/llvm-config.cpp +@@ -247,6 +247,13 @@ Typical components:\n\ + + /// Compute the path to the main executable. + std::string GetExecutablePath(const char *Argv0) { ++ // Hack for Yocto: we need to override the root path when we are using ++ // llvm-config from within a target sysroot. ++ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH"); ++ if (Sysroot != nullptr) { ++ return Sysroot; ++ } ++ + // This just needs to be some symbol in the binary; C++ doesn't + // allow taking the address of ::main however. + void *P = (void *)(intptr_t)GetExecutablePath; diff --git a/recipes-devtools/clang/clang/0007-clang-driver-Check-sysroot-for-ldso-path.patch b/recipes-devtools/clang/clang/0007-clang-driver-Check-sysroot-for-ldso-path.patch new file mode 100644 index 0000000..ba1466e --- /dev/null +++ b/recipes-devtools/clang/clang/0007-clang-driver-Check-sysroot-for-ldso-path.patch @@ -0,0 +1,61 @@ +From 3a53f9b0fba8586c531db93fee524a4e4ca2017c Mon Sep 17 00:00:00 2001 +From: Dan McGregor +Date: Wed, 26 Apr 2017 20:29:41 -0600 +Subject: [PATCH] clang: driver: Check sysroot for ldso path + +OE does not necessarily follow the default path for the dynamic linker, +therefore adjust it for OE. Check for the default path, and if it isn't +there, check /lib. + +Signed-off-by: Dan McGregor +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index e855d337ae64..95d88e0c6d79 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -479,11 +479,19 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + LibDir = "lib64"; + Loader = + (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; ++ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && ++ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { ++ LibDir = "lib"; ++ } + break; + case llvm::Triple::ppc64le: + LibDir = "lib64"; + Loader = + (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; ++ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && ++ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { ++ LibDir = "lib"; ++ } + break; + case llvm::Triple::riscv32: { + StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple); +@@ -505,6 +513,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + case llvm::Triple::sparcv9: + LibDir = "lib64"; + Loader = "ld-linux.so.2"; ++ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && ++ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { ++ LibDir = "lib"; ++ } + break; + case llvm::Triple::systemz: + LibDir = "lib"; +@@ -519,6 +531,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + + LibDir = X32 ? "libx32" : "lib64"; + Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2"; ++ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && ++ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { ++ LibDir = "lib"; ++ } + break; + } + case llvm::Triple::ve: diff --git a/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch b/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch deleted file mode 100644 index 4df2d62..0000000 --- a/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 4ed6b8848edbe1c453ce0d23d33551ff023f4fb2 Mon Sep 17 00:00:00 2001 -From: Martin Kelly -Date: Fri, 19 May 2017 00:22:57 -0700 -Subject: [PATCH] llvm: allow env override of exe path - -When using a native llvm-config from inside a sysroot, we need llvm-config to -return the libraries, include directories, etc. from inside the sysroot rather -than from the native sysroot. Thus provide an env override for calling -llvm-config from a target sysroot. - -Signed-off-by: Martin Kelly -Signed-off-by: Khem Raj ---- - llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp -index 1a2f04552d13..019d8f2b5c5e 100644 ---- a/llvm/tools/llvm-config/llvm-config.cpp -+++ b/llvm/tools/llvm-config/llvm-config.cpp -@@ -247,6 +247,13 @@ Typical components:\n\ - - /// Compute the path to the main executable. - std::string GetExecutablePath(const char *Argv0) { -+ // Hack for Yocto: we need to override the root path when we are using -+ // llvm-config from within a target sysroot. -+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH"); -+ if (Sysroot != nullptr) { -+ return Sysroot; -+ } -+ - // This just needs to be some symbol in the binary; C++ doesn't - // allow taking the address of ::main however. - void *P = (void *)(intptr_t)GetExecutablePath; diff --git a/recipes-devtools/clang/clang/0008-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch b/recipes-devtools/clang/clang/0008-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch new file mode 100644 index 0000000..3a7da76 --- /dev/null +++ b/recipes-devtools/clang/clang/0008-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch @@ -0,0 +1,31 @@ +From f4aa83e324b98622e1174d00d51852289ae1349d Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 19 May 2016 21:11:06 -0700 +Subject: [PATCH] clang: Driver/tools.cpp: Add -lssp_nonshared on musl + +musl driver will need to add ssp_nonshared for stack_check_local +on the linker cmdline when using stack protector commands on +compiler cmdline + +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index a27841dc5985..e0be5e43a10b 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -630,6 +630,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, + if (IsIAMCU) + CmdArgs.push_back("-lgloss"); + ++ if (ToolChain.getTriple().isMusl() && ++ (Args.hasArg(options::OPT_fstack_protector) || ++ Args.hasArg(options::OPT_fstack_protector_strong) || ++ Args.hasArg(options::OPT_fstack_protector_all))) { ++ CmdArgs.push_back("-lssp_nonshared"); ++ } + if (IsStatic || IsStaticPIE) + CmdArgs.push_back("--end-group"); + else diff --git a/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch b/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch deleted file mode 100644 index ea28de0..0000000 --- a/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 15008103e23b5e1cd65bcc32746aa41579583dc5 Mon Sep 17 00:00:00 2001 -From: Dan McGregor -Date: Wed, 26 Apr 2017 20:29:41 -0600 -Subject: [PATCH] clang: driver: Check sysroot for ldso path - -OE does not necessarily follow the default path for the dynamic linker, -therefore adjust it for OE. Check for the default path, and if it isn't -there, check /lib. - -Signed-off-by: Dan McGregor -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp -index 9663a7390ada..06b92cc0bf5b 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -507,11 +507,19 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - LibDir = "lib64"; - Loader = - (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; -+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && -+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { -+ LibDir = "lib"; -+ } - break; - case llvm::Triple::ppc64le: - LibDir = "lib64"; - Loader = - (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; -+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && -+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { -+ LibDir = "lib"; -+ } - break; - case llvm::Triple::riscv32: { - StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple); -@@ -533,6 +541,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - case llvm::Triple::sparcv9: - LibDir = "lib64"; - Loader = "ld-linux.so.2"; -+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && -+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { -+ LibDir = "lib"; -+ } - break; - case llvm::Triple::systemz: - LibDir = "lib"; -@@ -547,6 +559,10 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - - LibDir = X32 ? "libx32" : "lib64"; - Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2"; -+ if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && -+ getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { -+ LibDir = "lib"; -+ } - break; - } - case llvm::Triple::ve: diff --git a/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch b/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch deleted file mode 100644 index a0d116b..0000000 --- a/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 1b2f69bc1938d4d65dd88c2e43e1bd160312d074 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 19 May 2016 21:11:06 -0700 -Subject: [PATCH] clang: Driver/tools.cpp: Add -lssp_nonshared on musl - -musl driver will need to add ssp_nonshared for stack_check_local -on the linker cmdline when using stack protector commands on -compiler cmdline - -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 1d8a3cdce92a..195a302c8771 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -628,6 +628,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, - if (IsIAMCU) - CmdArgs.push_back("-lgloss"); - -+ if (ToolChain.getTriple().isMusl() && -+ (Args.hasArg(options::OPT_fstack_protector) || -+ Args.hasArg(options::OPT_fstack_protector_strong) || -+ Args.hasArg(options::OPT_fstack_protector_all))) { -+ CmdArgs.push_back("-lssp_nonshared"); -+ } - if (IsStatic || IsStaticPIE) - CmdArgs.push_back("--end-group"); - else diff --git a/recipes-devtools/clang/clang/0009-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/recipes-devtools/clang/clang/0009-clang-musl-ppc-does-not-support-128-bit-long-double.patch new file mode 100644 index 0000000..3040407 --- /dev/null +++ b/recipes-devtools/clang/clang/0009-clang-musl-ppc-does-not-support-128-bit-long-double.patch @@ -0,0 +1,25 @@ +From 081f27d53afe592fb8d7b3c4e8a0e2e8be4ee439 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 10 May 2016 02:00:11 -0700 +Subject: [PATCH] clang: musl/ppc does not support 128-bit long double + +Signed-off-by: Khem Raj +--- + clang/lib/Basic/Targets/PPC.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h +index 554f2174fee0..18bcfd173ede 100644 +--- a/clang/lib/Basic/Targets/PPC.h ++++ b/clang/lib/Basic/Targets/PPC.h +@@ -389,6 +389,10 @@ public: + LongDoubleFormat = &llvm::APFloat::IEEEdouble(); + } + ++ if (getTriple().isMusl()) { ++ LongDoubleWidth = LongDoubleAlign = 64; ++ LongDoubleFormat = &llvm::APFloat::IEEEdouble(); ++ } + // PPC32 supports atomics up to 4 bytes. + MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; + } diff --git a/recipes-devtools/clang/clang/0010-clang-Prepend-trailing-to-sysroot.patch b/recipes-devtools/clang/clang/0010-clang-Prepend-trailing-to-sysroot.patch new file mode 100644 index 0000000..45ec740 --- /dev/null +++ b/recipes-devtools/clang/clang/0010-clang-Prepend-trailing-to-sysroot.patch @@ -0,0 +1,38 @@ +From bf9255d8abec8f8589e8700fff96dace5c986ad5 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 16 Mar 2017 09:02:13 -0700 +Subject: [PATCH] clang: Prepend trailing '/' to sysroot + +This is needed to handle a case where clang +isntall and target sysroot are perilously same + +e.g. + +sysroot = /mnt/clang/recipe-sysroot +clang install = /mnt/clang/recipe-sysroot-native + +in this case it will mistakenly assume that +clang is installed under the same sysroot dir +and it will try to add relative ../lib paths +to linker steps which would then be wrong +since they will become relative to clang +installation and not sysroot + +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/Linux.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index 95d88e0c6d79..d2ccbe635208 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -182,7 +182,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + Multilibs = GCCInstallation.getMultilibs(); + SelectedMultilib = GCCInstallation.getMultilib(); + llvm::Triple::ArchType Arch = Triple.getArch(); +- std::string SysRoot = computeSysRoot(); ++ std::string SysRoot = computeSysRoot() + "/"; + ToolChain::path_list &PPaths = getProgramPaths(); + + Generic_GCC::PushPPaths(PPaths); diff --git a/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch deleted file mode 100644 index 8c2ddeb..0000000 --- a/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 7ab52935bc6bd89529a2478af1ea2cdf192eb0d9 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 10 May 2016 02:00:11 -0700 -Subject: [PATCH] clang: musl/ppc does not support 128-bit long double - -Signed-off-by: Khem Raj ---- - clang/lib/Basic/Targets/PPC.h | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h -index 56c8f33ef221..b7e7edf270be 100644 ---- a/clang/lib/Basic/Targets/PPC.h -+++ b/clang/lib/Basic/Targets/PPC.h -@@ -386,6 +386,10 @@ public: - LongDoubleFormat = &llvm::APFloat::IEEEdouble(); - } - -+ if (getTriple().isMusl()) { -+ LongDoubleWidth = LongDoubleAlign = 64; -+ LongDoubleFormat = &llvm::APFloat::IEEEdouble(); -+ } - // PPC32 supports atomics up to 4 bytes. - MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; - } diff --git a/recipes-devtools/clang/clang/0011-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch b/recipes-devtools/clang/clang/0011-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch new file mode 100644 index 0000000..bde7bf1 --- /dev/null +++ b/recipes-devtools/clang/clang/0011-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch @@ -0,0 +1,40 @@ +From 322063cbeb3de0719183b38ec3aab5334de28641 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 16 Mar 2017 19:06:26 -0700 +Subject: [PATCH] clang: Look inside the target sysroot for compiler runtime + +In OE compiler-rt and libc++ are built and staged into target +sysroot and not into resourcedir which is relative to clang +driver installation where the libraries are not instlled + +Specific to cross compiling the way yocto/OE works + +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChain.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp +index 3342de85fc30..671d308e2efc 100644 +--- a/clang/lib/Driver/ToolChain.cpp ++++ b/clang/lib/Driver/ToolChain.cpp +@@ -14,6 +14,7 @@ + #include "ToolChains/Flang.h" + #include "clang/Basic/ObjCRuntime.h" + #include "clang/Basic/Sanitizers.h" ++#include "clang/Basic/Version.h" + #include "clang/Config/config.h" + #include "clang/Driver/Action.h" + #include "clang/Driver/Driver.h" +@@ -407,7 +408,10 @@ StringRef ToolChain::getOSLibName() const { + } + + std::string ToolChain::getCompilerRTPath() const { +- SmallString<128> Path(getDriver().ResourceDir); ++ SmallString<128> Path(getDriver().SysRoot); ++ StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX); ++ llvm::sys::path::append(Path, "/usr/", Twine("lib") + ClangLibdirSuffix, "clang", ++ CLANG_VERSION_STRING); + if (Triple.isOSUnknown()) { + llvm::sys::path::append(Path, "lib"); + } else { diff --git a/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch b/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch deleted file mode 100644 index 88d1868..0000000 --- a/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch +++ /dev/null @@ -1,38 +0,0 @@ -From af7639bf4db497300060a22f2cc94b37145b8db5 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 16 Mar 2017 09:02:13 -0700 -Subject: [PATCH] clang: Prepend trailing '/' to sysroot - -This is needed to handle a case where clang -isntall and target sysroot are perilously same - -e.g. - -sysroot = /mnt/clang/recipe-sysroot -clang install = /mnt/clang/recipe-sysroot-native - -in this case it will mistakenly assume that -clang is installed under the same sysroot dir -and it will try to add relative ../lib paths -to linker steps which would then be wrong -since they will become relative to clang -installation and not sysroot - -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Linux.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp -index 06b92cc0bf5b..726308413dc9 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -218,7 +218,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - Multilibs = GCCInstallation.getMultilibs(); - SelectedMultilib = GCCInstallation.getMultilib(); - llvm::Triple::ArchType Arch = Triple.getArch(); -- std::string SysRoot = computeSysRoot(); -+ std::string SysRoot = computeSysRoot() + "/"; - ToolChain::path_list &PPaths = getProgramPaths(); - - Generic_GCC::PushPPaths(PPaths); diff --git a/recipes-devtools/clang/clang/0012-clang-Define-releative-gcc-installation-dir.patch b/recipes-devtools/clang/clang/0012-clang-Define-releative-gcc-installation-dir.patch new file mode 100644 index 0000000..1acce6c --- /dev/null +++ b/recipes-devtools/clang/clang/0012-clang-Define-releative-gcc-installation-dir.patch @@ -0,0 +1,46 @@ +From 017ff83dee2dce1a0940abdab1e32780cb86bc30 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 20 Mar 2021 16:09:16 -0700 +Subject: [PATCH] clang: Define / releative gcc installation dir + +This is required for OE gcc installation to work. +Without this its not able to find the paths for libgcc +and other standard headers and libraries from gcc +installation in OE + +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/Gnu.cpp | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index e0be5e43a10b..19c13afe048d 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2529,19 +2529,19 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( + // Whether this library suffix is relevant for the triple. + bool Active; + } Suffixes[] = { +- // This is the normal place. +- {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists}, +- +- // Debian puts cross-compilers in gcc-cross. +- {"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists}, +- + // The Freescale PPC SDK has the gcc libraries in + // /usr/lib//x.y.z so have a look there as well. Only do + // this on Freescale triples, though, since some systems put a *lot* of + // files in that location, not just GCC installation data. + {CandidateTriple.str(), "..", + TargetTriple.getVendor() == llvm::Triple::Freescale || +- TargetTriple.getVendor() == llvm::Triple::OpenEmbedded}}; ++ TargetTriple.getVendor() == llvm::Triple::OpenEmbedded}, ++ ++ // This is the normal place. ++ {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists}, ++ ++ // Debian puts cross-compilers in gcc-cross. ++ {"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists}}; + + for (auto &Suffix : Suffixes) { + if (!Suffix.Active) diff --git a/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch b/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch deleted file mode 100644 index 1e9d395..0000000 --- a/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch +++ /dev/null @@ -1,40 +0,0 @@ -From f946307a70619c45919ac06fa37c267fd25c3ec8 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 16 Mar 2017 19:06:26 -0700 -Subject: [PATCH] clang: Look inside the target sysroot for compiler runtime - -In OE compiler-rt and libc++ are built and staged into target -sysroot and not into resourcedir which is relative to clang -driver installation where the libraries are not instlled - -Specific to cross compiling the way yocto/OE works - -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChain.cpp | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp -index b2ddef141a75..784a946b453f 100644 ---- a/clang/lib/Driver/ToolChain.cpp -+++ b/clang/lib/Driver/ToolChain.cpp -@@ -14,6 +14,7 @@ - #include "ToolChains/Flang.h" - #include "clang/Basic/ObjCRuntime.h" - #include "clang/Basic/Sanitizers.h" -+#include "clang/Basic/Version.h" - #include "clang/Config/config.h" - #include "clang/Driver/Action.h" - #include "clang/Driver/Driver.h" -@@ -404,7 +405,10 @@ StringRef ToolChain::getOSLibName() const { - } - - std::string ToolChain::getCompilerRTPath() const { -- SmallString<128> Path(getDriver().ResourceDir); -+ SmallString<128> Path(getDriver().SysRoot); -+ StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX); -+ llvm::sys::path::append(Path, "/usr/", Twine("lib") + ClangLibdirSuffix, "clang", -+ CLANG_VERSION_STRING); - if (Triple.isOSUnknown()) { - llvm::sys::path::append(Path, "lib"); - } else { diff --git a/recipes-devtools/clang/clang/0013-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch b/recipes-devtools/clang/clang/0013-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch new file mode 100644 index 0000000..3584d70 --- /dev/null +++ b/recipes-devtools/clang/clang/0013-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch @@ -0,0 +1,38 @@ +From b40a8752cea684e392a25f45028493711352e1e2 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 31 Jul 2019 22:51:39 -0700 +Subject: [PATCH] clang: Add -lpthread and -ldl along with -lunwind for static + linking + +When doing static liking with --unwindlib=libunwind -static we encounter +undefined symbols +libunwind/src/RWMutex.hpp:68: undefined reference to `pthread_rwlock_wrlock' + +and + +libunwind/src/AddressSpace.hpp:597: undefined reference to `dladdr' + +therefore we need to link in libpthread and libdl to fill these symbols + +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/CommonArgs.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp +index b74a9fe3eb92..4c7a2ec15a2e 100644 +--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp ++++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp +@@ -1444,8 +1444,11 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D, + break; + } + case ToolChain::UNW_CompilerRT: +- if (LGT == LibGccType::StaticLibGcc) ++ if (LGT == LibGccType::StaticLibGcc) { + CmdArgs.push_back("-l:libunwind.a"); ++ CmdArgs.push_back("-lpthread"); ++ CmdArgs.push_back("-ldl"); ++ } + else if (TC.getTriple().isOSCygMing()) { + if (LGT == LibGccType::SharedLibGcc) + CmdArgs.push_back("-l:libunwind.dll.a"); diff --git a/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch b/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch deleted file mode 100644 index 1b07e5a..0000000 --- a/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 9c61a33cec25c8f2e0a90d5109808131d2e51c2d Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 21 May 2017 15:38:25 -0700 -Subject: [PATCH] clang: Define / releative gcc installation dir - -This is required for OE gcc installation to work. -Without this its not able to find the paths for libgcc -and other standard headers and libraries from gcc -installation in OE - -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Gnu.cpp | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 195a302c8771..05d1d3003881 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -2514,12 +2514,6 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( - // Whether this library suffix is relevant for the triple. - bool Active; - } Suffixes[] = { -- // This is the normal place. -- {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists}, -- -- // Debian puts cross-compilers in gcc-cross. -- {"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists}, -- - // The Freescale PPC SDK has the gcc libraries in - // /usr/lib//x.y.z so have a look there as well. Only do - // this on Freescale triples, though, since some systems put a *lot* of -@@ -2528,6 +2522,12 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( - TargetTriple.getVendor() == llvm::Triple::Freescale || - TargetTriple.getVendor() == llvm::Triple::OpenEmbedded}, - -+ // This is the normal place. -+ {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists}, -+ -+ // Debian puts cross-compilers in gcc-cross. -+ {"gcc-cross/" + CandidateTriple.str(), "../..", GCCCrossDirExists}, -+ - // Natively multiarch systems sometimes put the GCC triple-specific - // directory within their multiarch lib directory, resulting in the - // triple appearing twice. diff --git a/recipes-devtools/clang/clang/0014-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch b/recipes-devtools/clang/clang/0014-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch new file mode 100644 index 0000000..3b37371 --- /dev/null +++ b/recipes-devtools/clang/clang/0014-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch @@ -0,0 +1,23 @@ +From 6cdc2ea0f1d738e8fd03c6f5d29bc1a22d46aeac Mon Sep 17 00:00:00 2001 +From: Anuj Mittal +Date: Thu, 26 Dec 2019 12:56:16 -0800 +Subject: [PATCH] Pass PYTHON_EXECUTABLE when cross compiling for native build + +Signed-off-by: Anuj Mittal +Signed-off-by: Khem Raj +--- + llvm/cmake/modules/CrossCompile.cmake | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake +index 01cd37124841..f50be9d967df 100644 +--- a/llvm/cmake/modules/CrossCompile.cmake ++++ b/llvm/cmake/modules/CrossCompile.cmake +@@ -79,6 +79,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) + -DLLVM_EXTERNAL_PROJECTS="${llvm_external_projects_arg}" + ${external_project_source_dirs} + -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}" ++ -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" + ${build_type_flags} ${linker_flag} ${external_clang_dir} + ${ARGN} + WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD} diff --git a/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch b/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch deleted file mode 100644 index 67cc8de..0000000 --- a/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 3166a3b59f406de57f04a0b6fd0f3f1eabfaaa37 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 16 Aug 2017 15:16:15 -0700 -Subject: [PATCH] clang: Fix ldso for musl on x86 and x32 architectures - -x32 linker is called ld-musl-x32.so.1 and x86 linker -is called ld-musl-i386.so.1, Currently, linker for -x86 is returned as ld-musl-i586.so.1, when default -arch is i586, which is not the right thing - -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp -index 726308413dc9..b64396647882 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -426,6 +426,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - if (Triple.isMusl()) { - std::string ArchName; - bool IsArm = false; -+ bool isX32 = false; - - switch (Arch) { - case llvm::Triple::arm: -@@ -438,6 +439,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - ArchName = "armeb"; - IsArm = true; - break; -+ case llvm::Triple::x86: -+ ArchName = "i386"; -+ break; -+ case llvm::Triple::x86_64: -+ isX32 = Triple.getEnvironment() == llvm::Triple::GNUX32; -+ ArchName = isX32 ? "x32" : Triple.getArchName().str(); -+ break; - default: - ArchName = Triple.getArchName().str(); - } diff --git a/recipes-devtools/clang/clang/0015-Check-for-atomic-double-intrinsics.patch b/recipes-devtools/clang/clang/0015-Check-for-atomic-double-intrinsics.patch new file mode 100644 index 0000000..baa2fa4 --- /dev/null +++ b/recipes-devtools/clang/clang/0015-Check-for-atomic-double-intrinsics.patch @@ -0,0 +1,33 @@ +From 1a89fa157e92e70a9ca33fecd12fd12743c32b0b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 18 Nov 2019 17:00:29 -0800 +Subject: [PATCH] Check for atomic intrinsics + +On some architectures e.g. x86/32bit gcc decides to inline calls to +double atomic variables but clang does not and defers it to libatomic +therefore detect if clang can use built-ins for atomic if not +then link libatomic, this helps building clangd for x86 on linux systems +with gcc runtime + +Signed-off-by: Khem Raj +--- + llvm/cmake/modules/CheckAtomic.cmake | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake +index 04eed1448482..e890cfecd139 100644 +--- a/llvm/cmake/modules/CheckAtomic.cmake ++++ b/llvm/cmake/modules/CheckAtomic.cmake +@@ -30,10 +30,11 @@ function(check_working_cxx_atomics64 varname) + #include + #include + std::atomic x (0); ++std::atomic y (0); + int main() { + uint64_t i = x.load(std::memory_order_relaxed); + (void)i; +- return 0; ++ return int(y); + } + " ${varname}) + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) diff --git a/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch b/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch deleted file mode 100644 index 46b6995..0000000 --- a/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch +++ /dev/null @@ -1,24 +0,0 @@ -From bd42395fa181d5821f0d756d12c534f2cda525c0 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 15 May 2018 10:28:43 -0700 -Subject: [PATCH] clang: scan-view needs python 2.x - -Some distributions e.g. archlinux have switched to pointing -python to python3, therefore its better to be specific about -python version needed. - -Signed-off-by: Khem Raj ---- - clang/tools/scan-view/bin/scan-view | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view -index 6165432e7af8..04ad518a60cd 100755 ---- a/clang/tools/scan-view/bin/scan-view -+++ b/clang/tools/scan-view/bin/scan-view -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2 - - from __future__ import print_function - diff --git a/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch b/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch deleted file mode 100644 index a785bda..0000000 --- a/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch +++ /dev/null @@ -1,40 +0,0 @@ -From c309e121d6aca050119084e3e98371cd8e44ecca Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 31 Jul 2019 22:51:39 -0700 -Subject: [PATCH] clang: Add -lpthread and -ldl along with -lunwind for static - linking - -When doing static liking with --unwindlib=libunwind -static we encounter -undefined symbols -libunwind/src/RWMutex.hpp:68: undefined reference to `pthread_rwlock_wrlock' - -and - -libunwind/src/AddressSpace.hpp:597: undefined reference to `dladdr' - -therefore we need to link in libpthread and libdl to fill these symbols - -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/CommonArgs.cpp | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp -index bcaea71dca94..95b806e29ef2 100644 ---- a/clang/lib/Driver/ToolChains/CommonArgs.cpp -+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp -@@ -1423,8 +1423,13 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D, - // Let the linker choose between libunwind.dll.a and libunwind.a - // depending on what's available, and depending on the -static flag - CmdArgs.push_back("-lunwind"); -- } else -+ } else { - CmdArgs.push_back("-l:libunwind.so"); -+ if (Args.hasArg(options::OPT_static)) { -+ CmdArgs.push_back("-lpthread"); -+ CmdArgs.push_back("-ldl"); -+ } -+ } - break; - } - diff --git a/recipes-devtools/clang/clang/0016-clang-Enable-SSP-and-PIE-by-default.patch b/recipes-devtools/clang/clang/0016-clang-Enable-SSP-and-PIE-by-default.patch new file mode 100644 index 0000000..1b554df --- /dev/null +++ b/recipes-devtools/clang/clang/0016-clang-Enable-SSP-and-PIE-by-default.patch @@ -0,0 +1,312 @@ +From f44a8afe89238ba008d3452c295868aea221ba4b Mon Sep 17 00:00:00 2001 +From: Evangelos Foutras +Date: Thu, 26 Dec 2019 15:46:19 -0800 +Subject: [PATCH] clang: Enable SSP and PIE by default + +This is a minimal set of changes needed to make clang use SSP and PIE by +default on Arch Linux. Tests that were easy to adjust have been changed +accordingly; only test/Driver/linux-ld.c has been marked as "expected +failure" due to the number of changes it would require (mostly replacing +crtbegin.o with crtbeginS.o). + +Doing so is needed in order to align clang with the new default GCC +behavior in Arch which generates PIE executables by default and also +defaults to -fstack-protector-strong. It is not meant to be a long term +solution, but a simple temporary fix. + +Hopefully these changes will be obsoleted by the introduction upstream +of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410) + +Taken from ArchLinux - https://git.archlinux.org/svntogit/packages.git/plain/trunk/enable-SSP-and-PIE-by-default.patch?h=packages/clang + +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/Linux.cpp | 10 ++++++++-- + clang/lib/Driver/ToolChains/Linux.h | 4 ++++ + clang/test/Driver/cross-linux.c | 16 ++++++++-------- + clang/test/Driver/env.c | 2 +- + clang/test/Driver/fsanitize.c | 14 +++++++------- + clang/test/Driver/gcc-toolchain.cpp | 2 +- + clang/test/Driver/hexagon-toolchain-elf.c | 2 +- + clang/test/Driver/linux-as.c | 4 ++-- + clang/test/Driver/linux-ld.c | 2 ++ + clang/test/Driver/ppc-abi.c | 4 ++-- + clang/test/Driver/riscv32-toolchain.c | 4 ++-- + clang/test/Driver/riscv64-toolchain.c | 4 ++-- + clang/test/Driver/stack-protector.c | 4 ++-- + 13 files changed, 42 insertions(+), 30 deletions(-) + +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index d2ccbe635208..5bd2e5061f3c 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -671,8 +671,14 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs, + } + + bool Linux::isPIEDefault() const { +- return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) || +- getTriple().isMusl() || getSanitizerArgs().requiresPIE(); ++ const bool IsMips = getTriple().isMIPS(); ++ const bool IsAndroid = getTriple().isAndroid(); ++ ++ if (IsMips || IsAndroid) ++ return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) || ++ getTriple().isMusl() || getSanitizerArgs().requiresPIE(); ++ ++ return true; + } + + bool Linux::IsAArch64OutlineAtomicsDefault(const ArgList &Args) const { +diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h +index 169a37c44072..b3544a0c7681 100644 +--- a/clang/lib/Driver/ToolChains/Linux.h ++++ b/clang/lib/Driver/ToolChains/Linux.h +@@ -46,6 +46,10 @@ public: + bool isPIEDefault() const override; + bool isNoExecStackDefault() const override; + bool IsMathErrnoDefault() const override; ++ virtual LangOptions::StackProtectorMode ++ GetDefaultStackProtectorLevel(bool KernelOrKext) const override { ++ return LangOptions::SSPStrong; ++ } + SanitizerMask getSupportedSanitizers() const override; + void addProfileRTLibs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; +diff --git a/clang/test/Driver/cross-linux.c b/clang/test/Driver/cross-linux.c +index 59f5a97d2d9d..8d0e9e724aa0 100644 +--- a/clang/test/Driver/cross-linux.c ++++ b/clang/test/Driver/cross-linux.c +@@ -43,8 +43,8 @@ + // CHECK-MULTI32-I386: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld" + // CHECK-MULTI32-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" + // CHECK-MULTI32-I386: "-m" "elf_i386" +-// CHECK-MULTI32-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0]]{{/|\\\\}}crtbegin.o" +-// CHECK-MULTI32-I386: "-L[[gcc_install]]" ++// CHECK-MULTI32-I386: "crti.o" "crtbeginS.o" ++// CHECK-MULTI32-I386: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0]]" + // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib32" + // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib" + // CHECK-MULTI32-I386: "-L[[sysroot]]/lib" +@@ -61,8 +61,8 @@ + // CHECK-MULTI32-X86-64: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld" + // CHECK-MULTI32-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" + // CHECK-MULTI32-X86-64: "-m" "elf_x86_64" +-// CHECK-MULTI32-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0]]/64{{/|\\\\}}crtbegin.o" +-// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/64" ++// CHECK-MULTI32-X86-64: "crti.o" "crtbeginS.o" ++// CHECK-MULTI32-X86-64: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0]]/64" + // CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib64" + // CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib" + // CHECK-MULTI32-X86-64: "-L[[sysroot]]/lib" +@@ -79,8 +79,8 @@ + // CHECK-MULTI64-I386: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld" + // CHECK-MULTI64-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" + // CHECK-MULTI64-I386: "-m" "elf_i386" +-// CHECK-MULTI64-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/10.2.0]]/32{{/|\\\\}}crtbegin.o" +-// CHECK-MULTI64-I386: "-L[[gcc_install]]/32" ++// CHECK-MULTI64-I386: "crti.o" "crtbeginS.o" ++// CHECK-MULTI64-I386: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/10.2.0]]/32" + // CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib32" + // CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib" + // CHECK-MULTI64-I386: "-L[[sysroot]]/lib" +@@ -97,8 +97,8 @@ + // CHECK-MULTI64-X86-64: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/10.2.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld" + // CHECK-MULTI64-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" + // CHECK-MULTI64-X86-64: "-m" "elf_x86_64" +-// CHECK-MULTI64-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/10.2.0]]{{/|\\\\}}crtbegin.o" +-// CHECK-MULTI64-X86-64: "-L[[gcc_install]]" ++// CHECK-MULTI64-X86-64: "crti.o" "crtbeginS.o" ++// CHECK-MULTI64-X86-64: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/10.2.0]]" + // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib64" + // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib" + // CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib" +diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c +index e9b86cbcf428..47f304c0420d 100644 +--- a/clang/test/Driver/env.c ++++ b/clang/test/Driver/env.c +@@ -22,7 +22,7 @@ + // + // CHECK-LD-32-NOT: warning: + // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +-// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o" ++// CHECK-LD-32: "crtbeginS.o" + // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0" + // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/10.2.0/../../../../i386-unknown-linux/lib" + // CHECK-LD-32: "-L[[SYSROOT]]/lib" +diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c +index 7febfd02a1ad..1381d9018e32 100644 +--- a/clang/test/Driver/fsanitize.c ++++ b/clang/test/Driver/fsanitize.c +@@ -330,15 +330,15 @@ + // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1 + // OK + +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + // RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + // RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIC-NO-PIE + // RUN: %clang -target arm-linux-androideabi24 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + // RUN: %clang -target aarch64-linux-android -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE +-// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE ++// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + + // CHECK-NO-PIE-NOT: "-pie" + // CHECK-NO-PIE: "-mrelocation-model" "static" +@@ -673,12 +673,12 @@ + // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP + // NOSP-NOT: "-fsanitize=safe-stack" + +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP + // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN + // RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP + // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP +-// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP +-// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP ++// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP ++// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP + // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP + // NO-SP-NOT: stack-protector + // NO-SP: "-fsanitize=safe-stack" +diff --git a/clang/test/Driver/gcc-toolchain.cpp b/clang/test/Driver/gcc-toolchain.cpp +index 7cdba0841b8c..e2b3c6b04f08 100644 +--- a/clang/test/Driver/gcc-toolchain.cpp ++++ b/clang/test/Driver/gcc-toolchain.cpp +@@ -23,7 +23,7 @@ + // the same precise formatting of the path as the '-internal-system' flags + // above, so we just blanket wildcard match the 'crtbegin.o'. + // CHECK: "{{[^"]*}}ld{{(.exe)?}}" +-// CHECK-SAME: "{{[^"]*}}/usr/lib/gcc/x86_64-linux-gnu/4.8{{/|\\\\}}crtbegin.o" ++// CHECK-SAME: "crtbeginS.o" + // CHECK-SAME: "-L[[TOOLCHAIN]]/usr/lib/gcc/x86_64-linux-gnu/4.8" + /// On x86_64, there is an extra usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu but we should not test it. + +diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c +index cc11f9fcba9e..1fe8b5db587b 100644 +--- a/clang/test/Driver/hexagon-toolchain-elf.c ++++ b/clang/test/Driver/hexagon-toolchain-elf.c +@@ -487,7 +487,7 @@ + // RUN: %s 2>&1 \ + // RUN: | FileCheck -check-prefix=CHECK042 %s + // CHECK042: "-cc1" +-// CHECK042: "-mrelocation-model" "static" ++// CHECK042: "-mrelocation-model" "pic" + // CHECK042: "-mllvm" "-hexagon-small-data-threshold=8" + // CHECK042-NEXT: llvm-mc + // CHECK042: "-gpsize=8" +diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c +index 0959bd7ba0a1..4056a672b6f9 100644 +--- a/clang/test/Driver/linux-as.c ++++ b/clang/test/Driver/linux-as.c +@@ -164,7 +164,7 @@ + // CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu" + // + // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \ +-// RUN: -no-integrated-as -c %s 2>&1 \ ++// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ + // RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s + // CHECK-SPARCV9: as + // CHECK-SPARCV9: -64 +@@ -173,7 +173,7 @@ + // CHECK-SPARCV9: -o + // + // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \ +-// RUN: -no-integrated-as -fpic -c %s 2>&1 \ ++// RUN: -no-integrated-as -c %s 2>&1 \ + // RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s + // CHECK-SPARCV9PIC: as + // CHECK-SPARCV9PIC: -64 +diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c +index cc505588331b..c7f81d2c5e49 100644 +--- a/clang/test/Driver/linux-ld.c ++++ b/clang/test/Driver/linux-ld.c +@@ -1,4 +1,6 @@ + // UNSUPPORTED: system-windows ++// XFAIL: linux ++ + // General tests that ld invocations on Linux targets sane. Note that we use + // sysroot to make these tests independent of the host system. + // +diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c +index a74a19953ca2..0ba4a14ab74f 100644 +--- a/clang/test/Driver/ppc-abi.c ++++ b/clang/test/Driver/ppc-abi.c +@@ -26,9 +26,9 @@ + + // CHECK-ELFv1: "-mrelocation-model" "static" + // CHECK-ELFv1: "-target-abi" "elfv1" +-// CHECK-ELFv1-LE: "-mrelocation-model" "static" ++// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2" + // CHECK-ELFv1-LE: "-target-abi" "elfv1" +-// CHECK-ELFv2: "-mrelocation-model" "static" ++// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2" + // CHECK-ELFv2: "-target-abi" "elfv2" + // CHECK-ELFv2-BE: "-mrelocation-model" "static" + // CHECK-ELFv2-BE: "-target-abi" "elfv2" +diff --git a/clang/test/Driver/riscv32-toolchain.c b/clang/test/Driver/riscv32-toolchain.c +index a5852f5f3997..233d9ef003cf 100644 +--- a/clang/test/Driver/riscv32-toolchain.c ++++ b/clang/test/Driver/riscv32-toolchain.c +@@ -84,7 +84,7 @@ + // C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" + // C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv" + // C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1" +-// C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32{{/|\\\\}}crtbegin.o" ++// C-RV32-LINUX-MULTI-ILP32: "crtbeginS.o" + // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32" + // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32" + // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32" +@@ -99,7 +99,7 @@ + // C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" + // C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv" + // C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1" +-// C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d{{/|\\\\}}crtbegin.o" ++// C-RV32-LINUX-MULTI-ILP32D: "crtbeginS.o" + // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d" + // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d" + // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d" +diff --git a/clang/test/Driver/riscv64-toolchain.c b/clang/test/Driver/riscv64-toolchain.c +index e727f20bb601..a801e5eee462 100644 +--- a/clang/test/Driver/riscv64-toolchain.c ++++ b/clang/test/Driver/riscv64-toolchain.c +@@ -84,7 +84,7 @@ + // C-RV64-LINUX-MULTI-LP64: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" + // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv" + // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64.so.1" +-// C-RV64-LINUX-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64{{/|\\\\}}crtbegin.o" ++// C-RV64-LINUX-MULTI-LP64: "crtbeginS.o" + // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64" + // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64" + // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64" +@@ -99,7 +99,7 @@ + // C-RV64-LINUX-MULTI-LP64D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" + // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv" + // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64d.so.1" +-// C-RV64-LINUX-MULTI-LP64D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d{{/|\\\\}}crtbegin.o" ++// C-RV64-LINUX-MULTI-LP64D: "crtbeginS.o" + // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d" + // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d" + // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d" +diff --git a/clang/test/Driver/stack-protector.c b/clang/test/Driver/stack-protector.c +index a3e40b50eed8..dfffe0d6cf85 100644 +--- a/clang/test/Driver/stack-protector.c ++++ b/clang/test/Driver/stack-protector.c +@@ -3,11 +3,11 @@ + // NOSSP-NOT: "-stack-protector-buffer-size" + + // RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP +-// SSP: "-stack-protector" "1" ++// SSP: "-stack-protector" "2" + // SSP-NOT: "-stack-protector-buffer-size" + + // RUN: %clang -target i386-unknown-linux -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF +-// SSP-BUF: "-stack-protector" "1" ++// SSP-BUF: "-stack-protector" "2" + // SSP-BUF: "-stack-protector-buffer-size" "16" + + // RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD diff --git a/recipes-devtools/clang/clang/0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch b/recipes-devtools/clang/clang/0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch deleted file mode 100644 index 3f2e16b..0000000 --- a/recipes-devtools/clang/clang/0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 00449fb89e8ab3b34f03d3a09a4d859e5d0a8245 Mon Sep 17 00:00:00 2001 -From: Anuj Mittal -Date: Thu, 26 Dec 2019 12:56:16 -0800 -Subject: [PATCH] Pass PYTHON_EXECUTABLE when cross compiling for native build - -Signed-off-by: Anuj Mittal -Signed-off-by: Khem Raj ---- - llvm/cmake/modules/CrossCompile.cmake | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake -index 01cd37124841..f50be9d967df 100644 ---- a/llvm/cmake/modules/CrossCompile.cmake -+++ b/llvm/cmake/modules/CrossCompile.cmake -@@ -79,6 +79,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) - -DLLVM_EXTERNAL_PROJECTS="${llvm_external_projects_arg}" - ${external_project_source_dirs} - -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}" -+ -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" - ${build_type_flags} ${linker_flag} ${external_clang_dir} - ${ARGN} - WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD} diff --git a/recipes-devtools/clang/clang/0017-libcxx-Add-compiler-runtime-library-to-link-step-for.patch b/recipes-devtools/clang/clang/0017-libcxx-Add-compiler-runtime-library-to-link-step-for.patch new file mode 100644 index 0000000..d5a4e5a --- /dev/null +++ b/recipes-devtools/clang/clang/0017-libcxx-Add-compiler-runtime-library-to-link-step-for.patch @@ -0,0 +1,37 @@ +From 405d32adeeba5b003649c75c49db1194d9bd86ba Mon Sep 17 00:00:00 2001 +From: Jeremy Puhlman +Date: Thu, 16 Jan 2020 21:16:10 +0000 +Subject: [PATCH] libcxx: Add compiler runtime library to link step for libcxx + +This corrects "undefined reference to __divti3" + +Upstream-Status: Inappropriate [configuration] + +Signed-off-by: Jeremy Puhlman +Signed-off-by: Khem Raj +--- + libcxx/src/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt +index 87b71f7ba334..412374e8820e 100644 +--- a/libcxx/src/CMakeLists.txt ++++ b/libcxx/src/CMakeLists.txt +@@ -189,7 +189,7 @@ split_list(LIBCXX_LINK_FLAGS) + if (LIBCXX_ENABLE_SHARED) + add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) + target_link_libraries(cxx_shared PUBLIC cxx-headers +- PRIVATE ${LIBCXX_LIBRARIES}) ++ PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)") + set_target_properties(cxx_shared + PROPERTIES + COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" +@@ -266,7 +266,7 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "lib") + if (LIBCXX_ENABLE_STATIC) + add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) + target_link_libraries(cxx_static PUBLIC cxx-headers +- PRIVATE ${LIBCXX_LIBRARIES}) ++ PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)") + set_target_properties(cxx_static + PROPERTIES + COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" diff --git a/recipes-devtools/clang/clang/0018-Check-for-atomic-double-intrinsics.patch b/recipes-devtools/clang/clang/0018-Check-for-atomic-double-intrinsics.patch deleted file mode 100644 index 800b58e..0000000 --- a/recipes-devtools/clang/clang/0018-Check-for-atomic-double-intrinsics.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 761be2d8d20d9ebe93fa33719bdd0d25396d812d Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 18 Nov 2019 17:00:29 -0800 -Subject: [PATCH] Check for atomic intrinsics - -On some architectures e.g. x86/32bit gcc decides to inline calls to -double atomic variables but clang does not and defers it to libatomic -therefore detect if clang can use built-ins for atomic if not -then link libatomic, this helps building clangd for x86 on linux systems -with gcc runtime - -Signed-off-by: Khem Raj ---- - llvm/cmake/modules/CheckAtomic.cmake | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake -index 04eed1448482..e890cfecd139 100644 ---- a/llvm/cmake/modules/CheckAtomic.cmake -+++ b/llvm/cmake/modules/CheckAtomic.cmake -@@ -30,10 +30,11 @@ function(check_working_cxx_atomics64 varname) - #include - #include - std::atomic x (0); -+std::atomic y (0); - int main() { - uint64_t i = x.load(std::memory_order_relaxed); - (void)i; -- return 0; -+ return int(y); - } - " ${varname}) - set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) diff --git a/recipes-devtools/clang/clang/0018-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/recipes-devtools/clang/clang/0018-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch new file mode 100644 index 0000000..e687742 --- /dev/null +++ b/recipes-devtools/clang/clang/0018-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch @@ -0,0 +1,116 @@ +From 863e525e1ee6621f198ee1602702263f803f3ecd Mon Sep 17 00:00:00 2001 +From: Ovidiu Panait +Date: Fri, 31 Jan 2020 10:56:11 +0200 +Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using + find_package() + +Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git]) +that depends on LLVM/Clang tries to run cmake find_package() during +do_configure, it will fail with a similar error: + +| The imported target "llvm-tblgen" references the file +| ".../recipe-sysroot/usr/bin/llvm-tblgen" +| +| but this file does not exist. Possible reasons include: +| * The file was deleted, renamed, or moved to another location. +| * An install or uninstall procedure did not complete successfully. +| * The installation package was faulty and contained +| ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake" +| but not all the files it references. + +This is due to the fact that currently the cmake scripts look for target +binaries in sysroot. Work around this by not exporting the target binaries in +Exports-* cmake files. + +Upstream-Status: Innapropriate [oe-specific] + +Signed-off-by: Ovidiu Panait +--- + clang/cmake/modules/AddClang.cmake | 2 -- + llvm/cmake/modules/AddLLVM.cmake | 6 ------ + llvm/cmake/modules/TableGen.cmake | 7 ------- + 3 files changed, 15 deletions(-) + +diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake +index 5752f4277444..f40ea35faf46 100644 +--- a/clang/cmake/modules/AddClang.cmake ++++ b/clang/cmake/modules/AddClang.cmake +@@ -158,7 +158,6 @@ macro(add_clang_tool name) + if (CLANG_BUILD_TOOLS) + get_target_export_arg(${name} Clang export_to_clangtargets) + install(TARGETS ${name} +- ${export_to_clangtargets} + RUNTIME DESTINATION bin + COMPONENT ${name}) + +@@ -167,7 +166,6 @@ macro(add_clang_tool name) + DEPENDS ${name} + COMPONENT ${name}) + endif() +- set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name}) + endif() + endmacro() + +diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake +index f3b27937fd8e..a48040a45275 100644 +--- a/llvm/cmake/modules/AddLLVM.cmake ++++ b/llvm/cmake/modules/AddLLVM.cmake +@@ -1209,7 +1209,6 @@ macro(add_llvm_tool name) + if( LLVM_BUILD_TOOLS ) + get_target_export_arg(${name} LLVM export_to_llvmexports) + install(TARGETS ${name} +- ${export_to_llvmexports} + RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR} + COMPONENT ${name}) + +@@ -1220,9 +1219,6 @@ macro(add_llvm_tool name) + endif() + endif() + endif() +- if( LLVM_BUILD_TOOLS ) +- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) +- endif() + set_target_properties(${name} PROPERTIES FOLDER "Tools") + endmacro(add_llvm_tool name) + +@@ -1262,7 +1258,6 @@ macro(add_llvm_utility name) + if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) + get_target_export_arg(${name} LLVM export_to_llvmexports) + install(TARGETS ${name} +- ${export_to_llvmexports} + RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR} + COMPONENT ${name}) + +@@ -1271,7 +1266,6 @@ macro(add_llvm_utility name) + DEPENDS ${name} + COMPONENT ${name}) + endif() +- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) + elseif(LLVM_BUILD_UTILS) + set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name}) + endif() +diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake +index 5f07acc1f692..47fe887e083b 100644 +--- a/llvm/cmake/modules/TableGen.cmake ++++ b/llvm/cmake/modules/TableGen.cmake +@@ -177,14 +177,8 @@ macro(add_tablegen target project) + endif() + + if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) +- set(export_to_llvmexports) +- if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR +- NOT LLVM_DISTRIBUTION_COMPONENTS) +- set(export_to_llvmexports EXPORT LLVMExports) +- endif() + + install(TARGETS ${target} +- ${export_to_llvmexports} + COMPONENT ${target} + RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}) + if(NOT LLVM_ENABLE_IDE) +@@ -193,5 +187,4 @@ macro(add_tablegen target project) + COMPONENT ${target}) + endif() + endif() +- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target}) + endmacro() diff --git a/recipes-devtools/clang/clang/0019-clang-Enable-SSP-and-PIE-by-default.patch b/recipes-devtools/clang/clang/0019-clang-Enable-SSP-and-PIE-by-default.patch deleted file mode 100644 index 164503f..0000000 --- a/recipes-devtools/clang/clang/0019-clang-Enable-SSP-and-PIE-by-default.patch +++ /dev/null @@ -1,310 +0,0 @@ -From d0f788c1fb3d00350c51e88302ecbcf3506e4b53 Mon Sep 17 00:00:00 2001 -From: Evangelos Foutras -Date: Thu, 26 Dec 2019 15:46:19 -0800 -Subject: [PATCH] clang: Enable SSP and PIE by default - -This is a minimal set of changes needed to make clang use SSP and PIE by -default on Arch Linux. Tests that were easy to adjust have been changed -accordingly; only test/Driver/linux-ld.c has been marked as "expected -failure" due to the number of changes it would require (mostly replacing -crtbegin.o with crtbeginS.o). - -Doing so is needed in order to align clang with the new default GCC -behavior in Arch which generates PIE executables by default and also -defaults to -fstack-protector-strong. It is not meant to be a long term -solution, but a simple temporary fix. - -Hopefully these changes will be obsoleted by the introduction upstream -of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410) - -Taken from ArchLinux - https://git.archlinux.org/svntogit/packages.git/plain/trunk/enable-SSP-and-PIE-by-default.patch?h=packages/clang - -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Linux.cpp | 10 ++++++++-- - clang/lib/Driver/ToolChains/Linux.h | 4 ++++ - clang/test/Driver/cross-linux.c | 16 ++++++++-------- - clang/test/Driver/env.c | 2 +- - clang/test/Driver/fsanitize.c | 14 +++++++------- - clang/test/Driver/gcc-toolchain.cpp | 2 +- - clang/test/Driver/hexagon-toolchain-elf.c | 2 +- - clang/test/Driver/linux-as.c | 4 ++-- - clang/test/Driver/linux-ld.c | 2 ++ - clang/test/Driver/ppc-abi.c | 4 ++-- - clang/test/Driver/riscv32-toolchain.c | 4 ++-- - clang/test/Driver/riscv64-toolchain.c | 4 ++-- - clang/test/Driver/stack-protector.c | 4 ++-- - 13 files changed, 42 insertions(+), 30 deletions(-) - -diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp -index b64396647882..604024bb3df4 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -856,8 +856,14 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs, - } - - bool Linux::isPIEDefault() const { -- return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) || -- getTriple().isMusl() || getSanitizerArgs().requiresPIE(); -+ const bool IsMips = getTriple().isMIPS(); -+ const bool IsAndroid = getTriple().isAndroid(); -+ -+ if (IsMips || IsAndroid) -+ return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) || -+ getTriple().isMusl() || getSanitizerArgs().requiresPIE(); -+ -+ return true; - } - - bool Linux::isNoExecStackDefault() const { -diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h -index 6b16b0e64990..582d4bef81df 100644 ---- a/clang/lib/Driver/ToolChains/Linux.h -+++ b/clang/lib/Driver/ToolChains/Linux.h -@@ -39,6 +39,10 @@ public: - bool isPIEDefault() const override; - bool isNoExecStackDefault() const override; - bool IsMathErrnoDefault() const override; -+ virtual LangOptions::StackProtectorMode -+ GetDefaultStackProtectorLevel(bool KernelOrKext) const override { -+ return LangOptions::SSPStrong; -+ } - SanitizerMask getSupportedSanitizers() const override; - void addProfileRTLibs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const override; -diff --git a/clang/test/Driver/cross-linux.c b/clang/test/Driver/cross-linux.c -index 6c2dab260695..c28c5653e348 100644 ---- a/clang/test/Driver/cross-linux.c -+++ b/clang/test/Driver/cross-linux.c -@@ -42,8 +42,8 @@ - // CHECK-MULTI32-I386: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld" - // CHECK-MULTI32-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" - // CHECK-MULTI32-I386: "-m" "elf_i386" --// CHECK-MULTI32-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o" --// CHECK-MULTI32-I386: "-L[[gcc_install]]" -+// CHECK-MULTI32-I386: "crti.o" "crtbeginS.o" -+// CHECK-MULTI32-I386: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]" - // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib32" - // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib" - // CHECK-MULTI32-I386: "-L[[sysroot]]/lib" -@@ -60,8 +60,8 @@ - // CHECK-MULTI32-X86-64: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld" - // CHECK-MULTI32-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" - // CHECK-MULTI32-X86-64: "-m" "elf_x86_64" --// CHECK-MULTI32-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64{{/|\\\\}}crtbegin.o" --// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/64" -+// CHECK-MULTI32-X86-64: "crti.o" "crtbeginS.o" -+// CHECK-MULTI32-X86-64: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64" - // CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib64" - // CHECK-MULTI32-X86-64: "-L[[gcc_install]]" - // CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib" -@@ -79,8 +79,8 @@ - // CHECK-MULTI64-I386: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld" - // CHECK-MULTI64-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" - // CHECK-MULTI64-I386: "-m" "elf_i386" --// CHECK-MULTI64-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32{{/|\\\\}}crtbegin.o" --// CHECK-MULTI64-I386: "-L[[gcc_install]]/32" -+// CHECK-MULTI64-I386: "crti.o" "crtbeginS.o" -+// CHECK-MULTI64-I386: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32" - // CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib32" - // CHECK-MULTI64-I386: "-L[[gcc_install]]" - // CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib" -@@ -98,8 +98,8 @@ - // CHECK-MULTI64-X86-64: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld" - // CHECK-MULTI64-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" - // CHECK-MULTI64-X86-64: "-m" "elf_x86_64" --// CHECK-MULTI64-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o" --// CHECK-MULTI64-X86-64: "-L[[gcc_install]]" -+// CHECK-MULTI64-X86-64: "crti.o" "crtbeginS.o" -+// CHECK-MULTI64-X86-64: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]" - // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib64" - // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib" - // CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib" -diff --git a/clang/test/Driver/env.c b/clang/test/Driver/env.c -index 0371bc91c4a3..ea89f5251217 100644 ---- a/clang/test/Driver/env.c -+++ b/clang/test/Driver/env.c -@@ -20,7 +20,7 @@ - // - // CHECK-LD-32-NOT: warning: - // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" --// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o" -+// CHECK-LD-32: "crtbeginS.o" - // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0" - // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib" - // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.." -diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c -index 8926d55a0cf4..40f628ccae45 100644 ---- a/clang/test/Driver/fsanitize.c -+++ b/clang/test/Driver/fsanitize.c -@@ -330,15 +330,15 @@ - // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1 - // OK - --// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE --// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE -+// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE -+// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE - // RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE - // RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE - // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIC-NO-PIE - // RUN: %clang -target arm-linux-androideabi24 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE - // RUN: %clang -target aarch64-linux-android -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE --// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE --// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE -+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE -+// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE - - // CHECK-NO-PIE-NOT: "-pie" - // CHECK-NO-PIE: "-mrelocation-model" "static" -@@ -667,12 +667,12 @@ - // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP - // NOSP-NOT: "-fsanitize=safe-stack" - --// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP -+// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP - // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN - // RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP - // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP --// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP --// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP -+// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP -+// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP - // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP - // NO-SP-NOT: stack-protector - // NO-SP: "-fsanitize=safe-stack" -diff --git a/clang/test/Driver/gcc-toolchain.cpp b/clang/test/Driver/gcc-toolchain.cpp -index 6c872f4255c3..f5006d1dd9ab 100644 ---- a/clang/test/Driver/gcc-toolchain.cpp -+++ b/clang/test/Driver/gcc-toolchain.cpp -@@ -26,6 +26,6 @@ - // the same precise formatting of the path as the '-internal-system' flags - // above, so we just blanket wildcard match the 'crtbegin.o'. - // CHECK: "{{[^"]*}}ld{{(.exe)?}}" --// CHECK: "{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o" -+// CHECK: "crtbeginS.o" - // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5" - // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.." -diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c -index cc11f9fcba9e..1fe8b5db587b 100644 ---- a/clang/test/Driver/hexagon-toolchain-elf.c -+++ b/clang/test/Driver/hexagon-toolchain-elf.c -@@ -487,7 +487,7 @@ - // RUN: %s 2>&1 \ - // RUN: | FileCheck -check-prefix=CHECK042 %s - // CHECK042: "-cc1" --// CHECK042: "-mrelocation-model" "static" -+// CHECK042: "-mrelocation-model" "pic" - // CHECK042: "-mllvm" "-hexagon-small-data-threshold=8" - // CHECK042-NEXT: llvm-mc - // CHECK042: "-gpsize=8" -diff --git a/clang/test/Driver/linux-as.c b/clang/test/Driver/linux-as.c -index 0959bd7ba0a1..4056a672b6f9 100644 ---- a/clang/test/Driver/linux-as.c -+++ b/clang/test/Driver/linux-as.c -@@ -164,7 +164,7 @@ - // CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu" - // - // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \ --// RUN: -no-integrated-as -c %s 2>&1 \ -+// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ - // RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s - // CHECK-SPARCV9: as - // CHECK-SPARCV9: -64 -@@ -173,7 +173,7 @@ - // CHECK-SPARCV9: -o - // - // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \ --// RUN: -no-integrated-as -fpic -c %s 2>&1 \ -+// RUN: -no-integrated-as -c %s 2>&1 \ - // RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s - // CHECK-SPARCV9PIC: as - // CHECK-SPARCV9PIC: -64 -diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c -index 24d3c78643f8..9ea22e6e0f64 100644 ---- a/clang/test/Driver/linux-ld.c -+++ b/clang/test/Driver/linux-ld.c -@@ -1,3 +1,5 @@ -+// XFAIL: linux -+ - // General tests that ld invocations on Linux targets sane. Note that we use - // sysroot to make these tests independent of the host system. - // -diff --git a/clang/test/Driver/ppc-abi.c b/clang/test/Driver/ppc-abi.c -index a74a19953ca2..0ba4a14ab74f 100644 ---- a/clang/test/Driver/ppc-abi.c -+++ b/clang/test/Driver/ppc-abi.c -@@ -26,9 +26,9 @@ - - // CHECK-ELFv1: "-mrelocation-model" "static" - // CHECK-ELFv1: "-target-abi" "elfv1" --// CHECK-ELFv1-LE: "-mrelocation-model" "static" -+// CHECK-ELFv1-LE: "-mrelocation-model" "pic" "-pic-level" "2" - // CHECK-ELFv1-LE: "-target-abi" "elfv1" --// CHECK-ELFv2: "-mrelocation-model" "static" -+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2" - // CHECK-ELFv2: "-target-abi" "elfv2" - // CHECK-ELFv2-BE: "-mrelocation-model" "static" - // CHECK-ELFv2-BE: "-target-abi" "elfv2" -diff --git a/clang/test/Driver/riscv32-toolchain.c b/clang/test/Driver/riscv32-toolchain.c -index a5852f5f3997..233d9ef003cf 100644 ---- a/clang/test/Driver/riscv32-toolchain.c -+++ b/clang/test/Driver/riscv32-toolchain.c -@@ -84,7 +84,7 @@ - // C-RV32-LINUX-MULTI-ILP32: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" - // C-RV32-LINUX-MULTI-ILP32: "-m" "elf32lriscv" - // C-RV32-LINUX-MULTI-ILP32: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32.so.1" --// C-RV32-LINUX-MULTI-ILP32: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32{{/|\\\\}}crtbegin.o" -+// C-RV32-LINUX-MULTI-ILP32: "crtbeginS.o" - // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32" - // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32" - // C-RV32-LINUX-MULTI-ILP32: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32" -@@ -99,7 +99,7 @@ - // C-RV32-LINUX-MULTI-ILP32D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" - // C-RV32-LINUX-MULTI-ILP32D: "-m" "elf32lriscv" - // C-RV32-LINUX-MULTI-ILP32D: "-dynamic-linker" "/lib/ld-linux-riscv32-ilp32d.so.1" --// C-RV32-LINUX-MULTI-ILP32D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d{{/|\\\\}}crtbegin.o" -+// C-RV32-LINUX-MULTI-ILP32D: "crtbeginS.o" - // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib32/ilp32d" - // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib32/ilp32d" - // C-RV32-LINUX-MULTI-ILP32D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib32/ilp32d" -diff --git a/clang/test/Driver/riscv64-toolchain.c b/clang/test/Driver/riscv64-toolchain.c -index e727f20bb601..a801e5eee462 100644 ---- a/clang/test/Driver/riscv64-toolchain.c -+++ b/clang/test/Driver/riscv64-toolchain.c -@@ -84,7 +84,7 @@ - // C-RV64-LINUX-MULTI-LP64: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" - // C-RV64-LINUX-MULTI-LP64: "-m" "elf64lriscv" - // C-RV64-LINUX-MULTI-LP64: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64.so.1" --// C-RV64-LINUX-MULTI-LP64: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64{{/|\\\\}}crtbegin.o" -+// C-RV64-LINUX-MULTI-LP64: "crtbeginS.o" - // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64" - // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64" - // C-RV64-LINUX-MULTI-LP64: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64" -@@ -99,7 +99,7 @@ - // C-RV64-LINUX-MULTI-LP64D: "--sysroot={{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot" - // C-RV64-LINUX-MULTI-LP64D: "-m" "elf64lriscv" - // C-RV64-LINUX-MULTI-LP64D: "-dynamic-linker" "/lib/ld-linux-riscv64-lp64d.so.1" --// C-RV64-LINUX-MULTI-LP64D: "{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d{{/|\\\\}}crtbegin.o" -+// C-RV64-LINUX-MULTI-LP64D: "crtbeginS.o" - // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/lib/gcc/riscv64-unknown-linux-gnu/7.2.0/lib64/lp64d" - // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/lib64/lp64d" - // C-RV64-LINUX-MULTI-LP64D: "-L{{.*}}/Inputs/multilib_riscv_linux_sdk/sysroot/usr/lib64/lp64d" -diff --git a/clang/test/Driver/stack-protector.c b/clang/test/Driver/stack-protector.c -index a3e40b50eed8..dfffe0d6cf85 100644 ---- a/clang/test/Driver/stack-protector.c -+++ b/clang/test/Driver/stack-protector.c -@@ -3,11 +3,11 @@ - // NOSSP-NOT: "-stack-protector-buffer-size" - - // RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP --// SSP: "-stack-protector" "1" -+// SSP: "-stack-protector" "2" - // SSP-NOT: "-stack-protector-buffer-size" - - // RUN: %clang -target i386-unknown-linux -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF --// SSP-BUF: "-stack-protector" "1" -+// SSP-BUF: "-stack-protector" "2" - // SSP-BUF: "-stack-protector-buffer-size" "16" - - // RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD diff --git a/recipes-devtools/clang/clang/0019-clang-Fix-resource-dir-location-for-cross-toolchains.patch b/recipes-devtools/clang/clang/0019-clang-Fix-resource-dir-location-for-cross-toolchains.patch new file mode 100644 index 0000000..545cd1f --- /dev/null +++ b/recipes-devtools/clang/clang/0019-clang-Fix-resource-dir-location-for-cross-toolchains.patch @@ -0,0 +1,39 @@ +From e12f10a878d1ddb797204f07b4aee3ac52a10591 Mon Sep 17 00:00:00 2001 +From: Jim Broadus +Date: Thu, 26 Mar 2020 16:05:53 -0700 +Subject: [PATCH] clang: Fix resource dir location for cross toolchains + +When clang looks for the resources directory, it does so based on the binary +location and assumes that the containing directory is a sibling to lib. The +Yocto cross.bbclass defines the default bindir as +${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}. ex: /usr/bin/aarch64-poky-linux/. +This causes clang to form a path that looks like /usr/bin/lib/clang/... + +As a fix for this, check the parent directory name. If that is "bin", then +use that directory's parent. + +Signed-off-by: Jim Broadus +Signed-off-by: Khem Raj +--- + clang/lib/Driver/Driver.cpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp +index 25af909d9bd2..87dd4a74c99c 100644 +--- a/clang/lib/Driver/Driver.cpp ++++ b/clang/lib/Driver/Driver.cpp +@@ -121,7 +121,13 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath, + // With a static-library build of libclang, LibClangPath will contain the + // path of the embedding binary, which for LLVM binaries will be in bin/. + // ../lib gets us to lib/ in both cases. +- P = llvm::sys::path::parent_path(Dir); ++ Dir = std::string(llvm::sys::path::parent_path(Dir)); ++ ++ // OE cross toolchains are installed, by default, in a subdir of bin. ++ if (llvm::sys::path::filename(Dir) == "bin") { ++ Dir = std::string(llvm::sys::path::parent_path(Dir)); ++ } ++ P = Dir; + llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang", + CLANG_VERSION_STRING); + } diff --git a/recipes-devtools/clang/clang/0020-fix-path-to-libffi.patch b/recipes-devtools/clang/clang/0020-fix-path-to-libffi.patch new file mode 100644 index 0000000..95b1c36 --- /dev/null +++ b/recipes-devtools/clang/clang/0020-fix-path-to-libffi.patch @@ -0,0 +1,26 @@ +From 0407ee030cf435da660461f3a3cc1c8c7909b8b8 Mon Sep 17 00:00:00 2001 +From: Anuj Mittal +Date: Fri, 3 Apr 2020 15:10:37 +0800 +Subject: [PATCH] fix path to libffi + +FFI_LIBRARY_PATH is the full path to libffi so when building something that links to +libLLVMInterpreter, we were looking for libffi in clang's recipe-sysroot instead of +the recipe's sysroot. + +Signed-off-by: Anuj Mittal +Signed-off-by: Khem Raj +--- + llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt +index 976219830d5e..9930e01559e9 100644 +--- a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt ++++ b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt +@@ -22,5 +22,5 @@ add_llvm_component_library(LLVMInterpreter + ) + + if( LLVM_ENABLE_FFI ) +- target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} ) ++ target_link_libraries( LLVMInterpreter PRIVATE ffi ) + endif() diff --git a/recipes-devtools/clang/clang/0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch b/recipes-devtools/clang/clang/0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch deleted file mode 100644 index 1500fc9..0000000 --- a/recipes-devtools/clang/clang/0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 5c0a4264ad87c880ade430022e0f128da86bbf6d Mon Sep 17 00:00:00 2001 -From: Jeremy Puhlman -Date: Thu, 16 Jan 2020 21:16:10 +0000 -Subject: [PATCH] libcxx: Add compiler runtime library to link step for libcxx - -This corrects "undefined reference to __divti3" - -Upstream-Status: Inappropriate [configuration] - -Signed-off-by: Jeremy Puhlman -Signed-off-by: Khem Raj ---- - libcxx/src/CMakeLists.txt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt -index 9965104cb5b2..bee4d80bc67a 100644 ---- a/libcxx/src/CMakeLists.txt -+++ b/libcxx/src/CMakeLists.txt -@@ -177,7 +177,7 @@ split_list(LIBCXX_LINK_FLAGS) - if (LIBCXX_ENABLE_SHARED) - add_library(cxx_shared SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) - target_link_libraries(cxx_shared PUBLIC cxx-headers -- PRIVATE ${LIBCXX_LIBRARIES}) -+ PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)") - set_target_properties(cxx_shared - PROPERTIES - COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" -@@ -252,7 +252,7 @@ endif() - if (LIBCXX_ENABLE_STATIC) - add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) - target_link_libraries(cxx_static PUBLIC cxx-headers -- PRIVATE ${LIBCXX_LIBRARIES}) -+ PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)") - set(CMAKE_STATIC_LIBRARY_PREFIX "lib") - set_target_properties(cxx_static - PROPERTIES diff --git a/recipes-devtools/clang/clang/0021-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch b/recipes-devtools/clang/clang/0021-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch new file mode 100644 index 0000000..a36f117 --- /dev/null +++ b/recipes-devtools/clang/clang/0021-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch @@ -0,0 +1,67 @@ +From 673c58b89a0ca84a33aa760809c7cc6754928af4 Mon Sep 17 00:00:00 2001 +From: Oleksandr Ocheretnyi +Date: Wed, 15 Apr 2020 00:08:39 +0300 +Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso + path + + * the dyld-prefix shall be taken into account when the default + path for the dynamic linker has to be checked. + + * this patch shall be used as annex to the next patch: + 'clang: driver: Check sysroot for ldso path' which includes + the usrmerge scenario. + +Signed-off-by: Oleksandr Ocheretnyi +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index 5bd2e5061f3c..8a63dd8c0e60 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -479,8 +479,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + LibDir = "lib64"; + Loader = + (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; +- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && +- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { ++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && ++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { + LibDir = "lib"; + } + break; +@@ -488,8 +488,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + LibDir = "lib64"; + Loader = + (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; +- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && +- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { ++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && ++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { + LibDir = "lib"; + } + break; +@@ -513,8 +513,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + case llvm::Triple::sparcv9: + LibDir = "lib64"; + Loader = "ld-linux.so.2"; +- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && +- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { ++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && ++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { + LibDir = "lib"; + } + break; +@@ -531,8 +531,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + + LibDir = X32 ? "libx32" : "lib64"; + Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2"; +- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && +- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { ++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && ++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { + LibDir = "lib"; + } + break; diff --git a/recipes-devtools/clang/clang/0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/recipes-devtools/clang/clang/0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch deleted file mode 100644 index a9cd7a7..0000000 --- a/recipes-devtools/clang/clang/0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 12fe6e45d18add7da95fe637f9e21425330666f9 Mon Sep 17 00:00:00 2001 -From: Ovidiu Panait -Date: Fri, 31 Jan 2020 10:56:11 +0200 -Subject: [PATCH] clang,llvm: cmake: Fix configure for packages using - find_package() - -Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git]) -that depends on LLVM/Clang tries to run cmake find_package() during -do_configure, it will fail with a similar error: - -| The imported target "llvm-tblgen" references the file -| ".../recipe-sysroot/usr/bin/llvm-tblgen" -| -| but this file does not exist. Possible reasons include: -| * The file was deleted, renamed, or moved to another location. -| * An install or uninstall procedure did not complete successfully. -| * The installation package was faulty and contained -| ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake" -| but not all the files it references. - -This is due to the fact that currently the cmake scripts look for target -binaries in sysroot. Work around this by not exporting the target binaries in -Exports-* cmake files. - -Upstream-Status: Innapropriate [oe-specific] - -Signed-off-by: Ovidiu Panait ---- - clang/cmake/modules/AddClang.cmake | 8 -------- - llvm/cmake/modules/AddLLVM.cmake | 18 ------------------ - llvm/cmake/modules/TableGen.cmake | 7 ------- - 3 files changed, 33 deletions(-) - -diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake -index 704278a0e93b..6ea99c90772c 100644 ---- a/clang/cmake/modules/AddClang.cmake -+++ b/clang/cmake/modules/AddClang.cmake -@@ -161,15 +161,8 @@ macro(add_clang_tool name) - add_dependencies(${name} clang-resource-headers) - - if (CLANG_BUILD_TOOLS) -- set(export_to_clangtargets) -- if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR -- NOT LLVM_DISTRIBUTION_COMPONENTS) -- set(export_to_clangtargets EXPORT ClangTargets) -- set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True) -- endif() - - install(TARGETS ${name} -- ${export_to_clangtargets} - RUNTIME DESTINATION bin - COMPONENT ${name}) - -@@ -178,7 +171,6 @@ macro(add_clang_tool name) - DEPENDS ${name} - COMPONENT ${name}) - endif() -- set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name}) - endif() - endmacro() - -diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake -index 97c9980c7de3..2cb2ead31ba0 100644 ---- a/llvm/cmake/modules/AddLLVM.cmake -+++ b/llvm/cmake/modules/AddLLVM.cmake -@@ -1210,15 +1210,8 @@ macro(add_llvm_tool name) - - if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - if( LLVM_BUILD_TOOLS ) -- set(export_to_llvmexports) -- if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR -- NOT LLVM_DISTRIBUTION_COMPONENTS) -- set(export_to_llvmexports EXPORT LLVMExports) -- set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) -- endif() - - install(TARGETS ${name} -- ${export_to_llvmexports} - RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR} - COMPONENT ${name}) - -@@ -1229,9 +1222,6 @@ macro(add_llvm_tool name) - endif() - endif() - endif() -- if( LLVM_BUILD_TOOLS ) -- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) -- endif() - set_target_properties(${name} PROPERTIES FOLDER "Tools") - endmacro(add_llvm_tool name) - -@@ -1269,15 +1259,8 @@ macro(add_llvm_utility name) - set_target_properties(${name} PROPERTIES FOLDER "Utils") - if ( ${name} IN_LIST LLVM_TOOLCHAIN_UTILITIES OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS) -- set(export_to_llvmexports) -- if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR -- NOT LLVM_DISTRIBUTION_COMPONENTS) -- set(export_to_llvmexports EXPORT LLVMExports) -- set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) -- endif() - - install(TARGETS ${name} -- ${export_to_llvmexports} - RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR} - COMPONENT ${name}) - -@@ -1286,7 +1269,6 @@ macro(add_llvm_utility name) - DEPENDS ${name} - COMPONENT ${name}) - endif() -- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name}) - elseif(LLVM_BUILD_UTILS) - set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name}) - endif() -diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake -index 5f07acc1f692..47fe887e083b 100644 ---- a/llvm/cmake/modules/TableGen.cmake -+++ b/llvm/cmake/modules/TableGen.cmake -@@ -177,14 +177,8 @@ macro(add_tablegen target project) - endif() - - if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) -- set(export_to_llvmexports) -- if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR -- NOT LLVM_DISTRIBUTION_COMPONENTS) -- set(export_to_llvmexports EXPORT LLVMExports) -- endif() - - install(TARGETS ${target} -- ${export_to_llvmexports} - COMPONENT ${target} - RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}) - if(NOT LLVM_ENABLE_IDE) -@@ -193,5 +187,4 @@ macro(add_tablegen target project) - COMPONENT ${target}) - endif() - endif() -- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target}) - endmacro() diff --git a/recipes-devtools/clang/clang/0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch b/recipes-devtools/clang/clang/0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch deleted file mode 100644 index da4e3fe..0000000 --- a/recipes-devtools/clang/clang/0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 6ad331a0e464ee28eac7d0a1c658cd007e831297 Mon Sep 17 00:00:00 2001 -From: Jim Broadus -Date: Thu, 26 Mar 2020 16:05:53 -0700 -Subject: [PATCH] clang: Fix resource dir location for cross toolchains - -When clang looks for the resources directory, it does so based on the binary -location and assumes that the containing directory is a sibling to lib. The -Yocto cross.bbclass defines the default bindir as -${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}. ex: /usr/bin/aarch64-poky-linux/. -This causes clang to form a path that looks like /usr/bin/lib/clang/... - -As a fix for this, check the parent directory name. If that is "bin", then -use that directory's parent. - -Signed-off-by: Jim Broadus -Signed-off-by: Khem Raj ---- - clang/lib/Driver/Driver.cpp | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp -index 418e1d3e8ec9..44c9f6e59d3f 100644 ---- a/clang/lib/Driver/Driver.cpp -+++ b/clang/lib/Driver/Driver.cpp -@@ -119,7 +119,13 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath, - // With a static-library build of libclang, LibClangPath will contain the - // path of the embedding binary, which for LLVM binaries will be in bin/. - // ../lib gets us to lib/ in both cases. -- P = llvm::sys::path::parent_path(Dir); -+ Dir = std::string(llvm::sys::path::parent_path(Dir)); -+ -+ // OE cross toolchains are installed, by default, in a subdir of bin. -+ if (llvm::sys::path::filename(Dir) == "bin") { -+ Dir = std::string(llvm::sys::path::parent_path(Dir)); -+ } -+ P = Dir; - llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang", - CLANG_VERSION_STRING); - } diff --git a/recipes-devtools/clang/clang/0022-clang-Use-python3-in-python-scripts.patch b/recipes-devtools/clang/clang/0022-clang-Use-python3-in-python-scripts.patch new file mode 100644 index 0000000..8c204f0 --- /dev/null +++ b/recipes-devtools/clang/clang/0022-clang-Use-python3-in-python-scripts.patch @@ -0,0 +1,101 @@ +From 00cda4dc84261e3cae5d484d5b6bc0059880852f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 14 Oct 2020 22:19:57 -0700 +Subject: [PATCH] clang: Use python3 in python scripts + +Some scripts ask for python, but they work fine with python3 +and in OE python symlink is not exposed to build, only python3 is + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + .../find-all-symbols/tool/run-find-all-symbols.py | 2 +- + clang-tools-extra/clang-tidy/add_new_check.py | 2 +- + clang-tools-extra/clang-tidy/rename_check.py | 2 +- + clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py | 2 +- + clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | 2 +- + clang/tools/clang-format/git-clang-format | 2 +- + clang/tools/scan-view/bin/scan-view | 2 +- + clang/utils/hmaptool/hmaptool | 2 +- + 8 files changed, 8 insertions(+), 8 deletions(-) + +diff --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 +index 8655af137bb2..e95ba59a421c 100755 +--- 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 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + #=- run-find-all-symbols.py - Parallel find-all-symbols runner -*- python -*-=# + # +diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py +index 14fcfe8d49ff..ee7e682690b7 100755 +--- a/clang-tools-extra/clang-tidy/add_new_check.py ++++ b/clang-tools-extra/clang-tidy/add_new_check.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + #===- add_new_check.py - clang-tidy check generator ---------*- python -*--===# + # +diff --git a/clang-tools-extra/clang-tidy/rename_check.py b/clang-tools-extra/clang-tidy/rename_check.py +index 2410041fd5d2..976a02100cd6 100755 +--- a/clang-tools-extra/clang-tidy/rename_check.py ++++ b/clang-tools-extra/clang-tidy/rename_check.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + #===- rename_check.py - clang-tidy check renamer ------------*- python -*--===# + # +diff --git a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py +index 6bd05531333b..9e134123ef44 100755 +--- a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ++++ b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + #===- clang-tidy-diff.py - ClangTidy Diff Checker -----------*- python -*--===# + # +diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +index 313ecd2f9571..a298e38b1a45 100755 +--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py ++++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + #===- run-clang-tidy.py - Parallel clang-tidy runner --------*- python -*--===# + # +diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format +index 3646b4ff41d7..a6a7393448c9 100755 +--- a/clang/tools/clang-format/git-clang-format ++++ b/clang/tools/clang-format/git-clang-format +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + #===- git-clang-format - ClangFormat Git Integration ---------*- python -*--===# + # +diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view +index 6165432e7af8..07effbca5969 100755 +--- a/clang/tools/scan-view/bin/scan-view ++++ b/clang/tools/scan-view/bin/scan-view +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from __future__ import print_function + +diff --git a/clang/utils/hmaptool/hmaptool b/clang/utils/hmaptool/hmaptool +index e647cde6bc46..7ed2fdf674b1 100755 +--- a/clang/utils/hmaptool/hmaptool ++++ b/clang/utils/hmaptool/hmaptool +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + from __future__ import absolute_import, division, print_function + + import json diff --git a/recipes-devtools/clang/clang/0023-For-x86_64-set-Yocto-based-GCC-install-search-path.patch b/recipes-devtools/clang/clang/0023-For-x86_64-set-Yocto-based-GCC-install-search-path.patch new file mode 100644 index 0000000..5b23945 --- /dev/null +++ b/recipes-devtools/clang/clang/0023-For-x86_64-set-Yocto-based-GCC-install-search-path.patch @@ -0,0 +1,70 @@ +From 9601dddb6366e90725b364be6a21ddaa584557e2 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Mon, 25 Jan 2021 16:14:35 +0800 +Subject: [PATCH] For x86_64, set Yocto based GCC install search path + +Under Yocto host, while using clang-native to build, it searches +install host gcc failed which causing the include file not found +[snip] +|clang++ -target x86_64-linux -MMD -MF src/base/files/file_path_constants.o.d -I../../../tools/gn/src -I. \ +-isystem/tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/recipe-sysroot-native/usr/include -O2 -pipe \ +-std=c++17 -c ../../../tools/gn/src/base/files/file_path_constants.cc -o src/base/files/file_path_constants.o +|../../../tools/gn/src/base/files/file_path_constants.cc:7:10: fatal error: 'iterator' file not found +|#include +| ^~~~~~~~ +[snip] + +Set three Yocto based GCC triple: poky, oe-core and wind river + +Before aplly the patch +[snip] +$ ../recipe-sysroot-native/usr/bin/clang++ -v +clang version 11.0.1 (https://github.com/llvm/llvm-project 43ff75f2c3feef64f9d73328230d34dac8832a91) +Target: x86_64-unknown-linux-gnu +Thread model: posix +InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin +[snip] + +After aplly the patch: +[snip] +$ ../recipe-sysroot-native/usr/bin/clang++ -v +clang version 11.0.1 (https://github.com/llvm/llvm-project 22c3241ff9a6224261df48d0258957fd8acc3d64) +Target: x86_64-unknown-linux-gnu +Thread model: posix +InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin +Found candidate GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0 +Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.1.0 +Selected GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0 +Candidate multilib: .;@m64 +Selected multilib: .;@m64 +[snip] + +BTW, it is hardly to insert a triple by the replacement of TARGET_SYS +(=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR +is different between clang and clang-native + +The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of +additional triples based on CLANG_EXTRA_OE_VENDORS variable in +recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors() + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Martin Jansa +Signed-off-by: Hongxu Jia +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/Gnu.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index 19c13afe048d..458acb47a45d 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2111,6 +2111,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + "x86_64-redhat-linux", "x86_64-suse-linux", + "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", + "x86_64-slackware-linux", "x86_64-unknown-linux", ++ "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES + "x86_64-amazon-linux", "x86_64-linux-android"}; + static const char *const X32Triples[] = {"x86_64-linux-gnux32", + "x86_64-pc-linux-gnux32"}; diff --git a/recipes-devtools/clang/clang/0023-fix-path-to-libffi.patch b/recipes-devtools/clang/clang/0023-fix-path-to-libffi.patch deleted file mode 100644 index e22c0bd..0000000 --- a/recipes-devtools/clang/clang/0023-fix-path-to-libffi.patch +++ /dev/null @@ -1,26 +0,0 @@ -From cbcfe7d13dfc5644c9b8a48e951b43bc15d9f4cf Mon Sep 17 00:00:00 2001 -From: Anuj Mittal -Date: Fri, 3 Apr 2020 15:10:37 +0800 -Subject: [PATCH] fix path to libffi - -FFI_LIBRARY_PATH is the full path to libffi so when building something that links to -libLLVMInterpreter, we were looking for libffi in clang's recipe-sysroot instead of -the recipe's sysroot. - -Signed-off-by: Anuj Mittal -Signed-off-by: Khem Raj ---- - llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt -index 976219830d5e..9930e01559e9 100644 ---- a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt -+++ b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt -@@ -22,5 +22,5 @@ add_llvm_component_library(LLVMInterpreter - ) - - if( LLVM_ENABLE_FFI ) -- target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} ) -+ target_link_libraries( LLVMInterpreter PRIVATE ffi ) - endif() diff --git a/recipes-devtools/clang/clang/0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch b/recipes-devtools/clang/clang/0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch deleted file mode 100644 index 521f06d..0000000 --- a/recipes-devtools/clang/clang/0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 5f3d1b71c3e87017dfa471f1561f6c28f34a77f8 Mon Sep 17 00:00:00 2001 -From: Oleksandr Ocheretnyi -Date: Wed, 15 Apr 2020 00:08:39 +0300 -Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso - path - - * the dyld-prefix shall be taken into account when the default - path for the dynamic linker has to be checked. - - * this patch shall be used as annex to the next patch: - 'clang: driver: Check sysroot for ldso path' which includes - the usrmerge scenario. - -Signed-off-by: Oleksandr Ocheretnyi -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp -index 604024bb3df4..812599cdaf84 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -515,8 +515,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - LibDir = "lib64"; - Loader = - (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1"; -- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && -- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { -+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && -+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { - LibDir = "lib"; - } - break; -@@ -524,8 +524,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - LibDir = "lib64"; - Loader = - (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2"; -- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && -- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { -+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && -+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { - LibDir = "lib"; - } - break; -@@ -549,8 +549,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - case llvm::Triple::sparcv9: - LibDir = "lib64"; - Loader = "ld-linux.so.2"; -- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && -- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { -+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && -+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { - LibDir = "lib"; - } - break; -@@ -567,8 +567,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { - - LibDir = X32 ? "libx32" : "lib64"; - Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2"; -- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) && -- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) { -+ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) && -+ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) { - LibDir = "lib"; - } - break; diff --git a/recipes-devtools/clang/clang/0024-compiler-rt-Include-stddef.h.patch b/recipes-devtools/clang/clang/0024-compiler-rt-Include-stddef.h.patch new file mode 100644 index 0000000..773911b --- /dev/null +++ b/recipes-devtools/clang/clang/0024-compiler-rt-Include-stddef.h.patch @@ -0,0 +1,27 @@ +From 574ba321d2e58b8aa791b32a4bdbc3110e0978e0 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 6 Feb 2021 12:44:30 -0800 +Subject: [PATCH] compiler-rt: Include stddef.h + +size_t is use in the source needs relevant header to include the +definition, fixes build on musl + +compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:82:61: error: unknown type name 'size_t'; did you mean 'std::size_t'? + +Signed-off-by: Khem Raj +--- + compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp +index b87798603fda..d5b0a42fd3fb 100644 +--- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp ++++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp +@@ -25,6 +25,7 @@ + } + + #include ++#include // for size_t + #include + #include // for dlsym() + diff --git a/recipes-devtools/clang/clang/0025-clang-Use-python3-in-python-scripts.patch b/recipes-devtools/clang/clang/0025-clang-Use-python3-in-python-scripts.patch deleted file mode 100644 index defbc8d..0000000 --- a/recipes-devtools/clang/clang/0025-clang-Use-python3-in-python-scripts.patch +++ /dev/null @@ -1,112 +0,0 @@ -From fd3696213eed77e8c217be0ded0e220c0b597f1e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 14 Oct 2020 22:19:57 -0700 -Subject: [PATCH] clang: Use python3 in python scripts - -Some scripts ask for python, but they work fine with python3 -and in OE python symlink is not exposed to build, only python3 is - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - .../find-all-symbols/tool/run-find-all-symbols.py | 2 +- - clang-tools-extra/clang-tidy/add_new_check.py | 2 +- - clang-tools-extra/clang-tidy/rename_check.py | 2 +- - clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py | 2 +- - clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | 2 +- - clang/tools/clang-format/clang-format-diff.py | 2 +- - clang/tools/clang-format/git-clang-format | 2 +- - clang/tools/scan-view/bin/scan-view | 2 +- - clang/utils/hmaptool/hmaptool | 2 +- - 9 files changed, 9 insertions(+), 9 deletions(-) - -diff --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 -index 8655af137bb2..e95ba59a421c 100755 ---- 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 -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # - #=- run-find-all-symbols.py - Parallel find-all-symbols runner -*- python -*-=# - # -diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py -index 14fcfe8d49ff..ee7e682690b7 100755 ---- a/clang-tools-extra/clang-tidy/add_new_check.py -+++ b/clang-tools-extra/clang-tidy/add_new_check.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # - #===- add_new_check.py - clang-tidy check generator ---------*- python -*--===# - # -diff --git a/clang-tools-extra/clang-tidy/rename_check.py b/clang-tools-extra/clang-tidy/rename_check.py -index 2410041fd5d2..976a02100cd6 100755 ---- a/clang-tools-extra/clang-tidy/rename_check.py -+++ b/clang-tools-extra/clang-tidy/rename_check.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # - #===- rename_check.py - clang-tidy check renamer ------------*- python -*--===# - # -diff --git a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py -index 17086d15053e..a20b1f1f46b2 100755 ---- a/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py -+++ b/clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # - #===- clang-tidy-diff.py - ClangTidy Diff Checker -----------*- python -*--===# - # -diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -index 313ecd2f9571..a298e38b1a45 100755 ---- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # - #===- run-clang-tidy.py - Parallel clang-tidy runner --------*- python -*--===# - # -diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py -index 6e653a134289..1c31192a4562 100755 ---- a/clang/tools/clang-format/clang-format-diff.py -+++ b/clang/tools/clang-format/clang-format-diff.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # - #===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===# - # -diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format -index ccd2f50fa4ad..cfcfb9fcbaef 100755 ---- a/clang/tools/clang-format/git-clang-format -+++ b/clang/tools/clang-format/git-clang-format -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - # - #===- git-clang-format - ClangFormat Git Integration ---------*- python -*--===# - # -diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view -index 04ad518a60cd..07effbca5969 100755 ---- a/clang/tools/scan-view/bin/scan-view -+++ b/clang/tools/scan-view/bin/scan-view -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2 -+#!/usr/bin/env python3 - - from __future__ import print_function - -diff --git a/clang/utils/hmaptool/hmaptool b/clang/utils/hmaptool/hmaptool -index e647cde6bc46..7ed2fdf674b1 100755 ---- a/clang/utils/hmaptool/hmaptool -+++ b/clang/utils/hmaptool/hmaptool -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python3 - from __future__ import absolute_import, division, print_function - - import json diff --git a/recipes-devtools/clang/clang/0025-llvm-Do-not-use-find_library-for-ncurses.patch b/recipes-devtools/clang/clang/0025-llvm-Do-not-use-find_library-for-ncurses.patch new file mode 100644 index 0000000..4c2d54c --- /dev/null +++ b/recipes-devtools/clang/clang/0025-llvm-Do-not-use-find_library-for-ncurses.patch @@ -0,0 +1,44 @@ +From 6db98ec43e4dab2d4638a97caa81e5ef4b3f7310 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 7 Feb 2021 23:58:41 -0800 +Subject: [PATCH] llvm: Do not use find_library for ncurses + +This ensures that it lets OE to decide which lib to link +otherwise it adds absolute paths to linker cmdline and confuses it +horribly with native and target libs when build clang for target + +TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/clang/12.0.0-r0/recipe-sysroot-native/usr/lib/libtinfo.so: error adding symbols: file in wrong format +clang-12: error: linker command failed with exit code 1 (use -v to see invocation) + +Signed-off-by: Khem Raj +--- + compiler-rt/cmake/config-ix.cmake | 2 +- + llvm/cmake/config-ix.cmake | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake +index 0b5b81259492..d9e6fd1083d8 100644 +--- a/compiler-rt/cmake/config-ix.cmake ++++ b/compiler-rt/cmake/config-ix.cmake +@@ -140,7 +140,7 @@ else() + set(MAYBE_REQUIRED) + endif() + if(LLVM_ENABLE_TERMINFO) +- find_library(COMPILER_RT_TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED}) ++ set(TERMINFO_LIB tinfo curses ncurses ncursesw) + endif() + if(COMPILER_RT_TERMINFO_LIB) + set(LLVM_ENABLE_TERMINFO 1) +diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake +index d4cbf37d19a2..a320cf97b306 100644 +--- a/llvm/cmake/config-ix.cmake ++++ b/llvm/cmake/config-ix.cmake +@@ -175,7 +175,7 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") + set(MAYBE_REQUIRED) + endif() + if(LLVM_ENABLE_TERMINFO) +- find_library(TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED}) ++ set(TERMINFO_LIB tinfo curses ncurses ncursesw) + endif() + if(TERMINFO_LIB) + set(LLVM_ENABLE_TERMINFO 1) diff --git a/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch b/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch deleted file mode 100644 index 801696e..0000000 --- a/recipes-devtools/clang/clang/0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 13dedb0bbf780f7d66ddad8b1b33b3a1e0de2d25 Mon Sep 17 00:00:00 2001 -From: Hongxu Jia -Date: Mon, 25 Jan 2021 16:14:35 +0800 -Subject: [PATCH] For x86_64, set Yocto based GCC install search path - -Under Yocto host, while using clang-native to build, it searches -install host gcc failed which causing the include file not found -[snip] -|clang++ -target x86_64-linux -MMD -MF src/base/files/file_path_constants.o.d -I../../../tools/gn/src -I. \ --isystem/tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/recipe-sysroot-native/usr/include -O2 -pipe \ --std=c++17 -c ../../../tools/gn/src/base/files/file_path_constants.cc -o src/base/files/file_path_constants.o -|../../../tools/gn/src/base/files/file_path_constants.cc:7:10: fatal error: 'iterator' file not found -|#include -| ^~~~~~~~ -[snip] - -Set three Yocto based GCC triple: poky, oe-core and wind river - -Before aplly the patch -[snip] -$ ../recipe-sysroot-native/usr/bin/clang++ -v -clang version 11.0.1 (https://github.com/llvm/llvm-project 43ff75f2c3feef64f9d73328230d34dac8832a91) -Target: x86_64-unknown-linux-gnu -Thread model: posix -InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin -[snip] - -After aplly the patch: -[snip] -$ ../recipe-sysroot-native/usr/bin/clang++ -v -clang version 11.0.1 (https://github.com/llvm/llvm-project 22c3241ff9a6224261df48d0258957fd8acc3d64) -Target: x86_64-unknown-linux-gnu -Thread model: posix -InstalledDir:tmp-glibc/work/x86_64-linux/gn-native/87.0.4280.141-r0/chromium-87.0.4280.141/../recipe-sysroot-native/usr/bin -Found candidate GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0 -Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.1.0 -Selected GCC installation: /usr/lib//x86_64-wrs-linux/10.1.0 -Candidate multilib: .;@m64 -Selected multilib: .;@m64 -[snip] - -BTW, it is hardly to insert a triple by the replacement of TARGET_SYS -(=${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}), since TARGET_VENDOR -is different between clang and clang-native - -The //CLANG_EXTRA_OE_VENDORS_TRIPLES string is replaced with list of -additional triples based on CLANG_EXTRA_OE_VENDORS variable in -recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors() - -Upstream-Status: Inappropriate [oe specific] - -Signed-off-by: Martin Jansa -Signed-off-by: Hongxu Jia -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Gnu.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 05d1d3003881..33b1d7fb7061 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -2109,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( - "x86_64-redhat-linux", "x86_64-suse-linux", - "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", - "x86_64-slackware-linux", "x86_64-unknown-linux", -+ "x86_64-oe-linux",//CLANG_EXTRA_OE_VENDORS_TRIPLES - "x86_64-amazon-linux", "x86_64-linux-android"}; - static const char *const X32LibDirs[] = {"/libx32"}; - static const char *const X86LibDirs[] = {"/lib32", "/lib"}; diff --git a/recipes-devtools/clang/clang/0026-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch b/recipes-devtools/clang/clang/0026-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch new file mode 100644 index 0000000..00daa04 --- /dev/null +++ b/recipes-devtools/clang/clang/0026-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch @@ -0,0 +1,32 @@ +From 09a9c6735b682a4c622930cff3e0d549e9d638d2 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 11 Feb 2021 16:42:49 -0800 +Subject: [PATCH] llvm: Insert anchor for adding OE distro vendor names + +This helps in making right detection for OE built gcc toolchains + +The //CLANG_EXTRA_OE_VENDORS_CASES string is replaced with list of +additional Ceses based on CLANG_EXTRA_OE_VENDORS variable in +recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors() + +Upstream-Status: Inappropriate [OE-specific] + +Signed-off-by: Khem Raj +Signed-off-by: Martin Jansa +--- + llvm/lib/Support/Triple.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp +index 88311546354b..8b2745deae88 100644 +--- a/llvm/lib/Support/Triple.cpp ++++ b/llvm/lib/Support/Triple.cpp +@@ -496,7 +496,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) { + .Case("amd", Triple::AMD) + .Case("mesa", Triple::Mesa) + .Case("suse", Triple::SUSE) +- .Case("oe", Triple::OpenEmbedded) ++ .Case("oe", Triple::OpenEmbedded)//CLANG_EXTRA_OE_VENDORS_CASES + .Default(Triple::UnknownVendor); + } + diff --git a/recipes-devtools/clang/clang/0027-compiler-rt-Include-stddef.h.patch b/recipes-devtools/clang/clang/0027-compiler-rt-Include-stddef.h.patch deleted file mode 100644 index 3bd41ea..0000000 --- a/recipes-devtools/clang/clang/0027-compiler-rt-Include-stddef.h.patch +++ /dev/null @@ -1,27 +0,0 @@ -From f5367ee64b6e74039c0957e1f7d81dc8d597804d Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 6 Feb 2021 12:44:30 -0800 -Subject: [PATCH] compiler-rt: Include stddef.h - -size_t is use in the source needs relevant header to include the -definition, fixes build on musl - -compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp:82:61: error: unknown type name 'size_t'; did you mean 'std::size_t'? - -Signed-off-by: Khem Raj ---- - compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp -index b87798603fda..34e11727d77b 100644 ---- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp -+++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp -@@ -26,6 +26,7 @@ - - #include - #include -+#include // for size_t - #include // for dlsym() - - static void *getFuncAddr(const char *name, uintptr_t wrapper_addr) { diff --git a/recipes-devtools/clang/clang/0027-compiler-rt-Use-mcr-based-barrier-on-armv6.patch b/recipes-devtools/clang/clang/0027-compiler-rt-Use-mcr-based-barrier-on-armv6.patch new file mode 100644 index 0000000..f015308 --- /dev/null +++ b/recipes-devtools/clang/clang/0027-compiler-rt-Use-mcr-based-barrier-on-armv6.patch @@ -0,0 +1,71 @@ +From 16ee97fc3d678472f761e7ab8254ffef12ad6502 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 24 Mar 2021 00:32:09 -0700 +Subject: [PATCH] compiler-rt: Use mcr based barrier on armv6 + +dsb is an armv7 instruction and wont work when we are building for armv6. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + compiler-rt/lib/builtins/arm/sync-ops.h | 8 ++++---- + compiler-rt/lib/builtins/assembly.h | 8 ++++++++ + 2 files changed, 12 insertions(+), 4 deletions(-) + +diff --git a/compiler-rt/lib/builtins/arm/sync-ops.h b/compiler-rt/lib/builtins/arm/sync-ops.h +index c9623249e5d2..7a26170741ad 100644 +--- a/compiler-rt/lib/builtins/arm/sync-ops.h ++++ b/compiler-rt/lib/builtins/arm/sync-ops.h +@@ -19,14 +19,14 @@ + .thumb; \ + .syntax unified; \ + DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ +- dmb; \ ++ DMB; \ + mov r12, r0; \ + LOCAL_LABEL(tryatomic_##op) : ldrex r0, [r12]; \ + op(r2, r0, r1); \ + strex r3, r2, [r12]; \ + cmp r3, #0; \ + bne LOCAL_LABEL(tryatomic_##op); \ +- dmb; \ ++ DMB; \ + bx lr + + #define SYNC_OP_8(op) \ +@@ -35,14 +35,14 @@ + .syntax unified; \ + DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ + push {r4, r5, r6, lr}; \ +- dmb; \ ++ DMB; \ + mov r12, r0; \ + LOCAL_LABEL(tryatomic_##op) : ldrexd r0, r1, [r12]; \ + op(r4, r5, r0, r1, r2, r3); \ + strexd r6, r4, r5, [r12]; \ + cmp r6, #0; \ + bne LOCAL_LABEL(tryatomic_##op); \ +- dmb; \ ++ DMB; \ + pop { r4, r5, r6, pc } + + #define MINMAX_4(rD, rN, rM, cmp_kind) \ +diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h +index 9c015059af5a..aec4ff59beb7 100644 +--- a/compiler-rt/lib/builtins/assembly.h ++++ b/compiler-rt/lib/builtins/assembly.h +@@ -183,6 +183,14 @@ + JMP(ip) + #endif + ++#if __ARM_ARCH >= 7 ++#define DMB dmb ++#elif __ARM_ARCH >= 6 ++#define DMB mcr p15, #0, r0, c7, c10, #5 ++#else ++#error Only use this with ARMv6+ ++#endif ++ + #if defined(USE_THUMB_2) + #define WIDE(op) op.w + #else diff --git a/recipes-devtools/clang/clang/0028-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch b/recipes-devtools/clang/clang/0028-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch new file mode 100644 index 0000000..d52eb94 --- /dev/null +++ b/recipes-devtools/clang/clang/0028-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch @@ -0,0 +1,28 @@ +From 43733c59ee8fb7a4867f6f51fda1f449d6ce9013 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 15 Apr 2021 18:58:07 -0700 +Subject: [PATCH] clang: Switch defaults to dwarf-5 debug info on Linux + +GCC 11 has defaulted to DWARF-5 as well, this matches +debug info formats, so mix and match of components with GCC 11 +works. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + clang/lib/Driver/ToolChains/Linux.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h +index b3544a0c7681..ae421580a017 100644 +--- a/clang/lib/Driver/ToolChains/Linux.h ++++ b/clang/lib/Driver/ToolChains/Linux.h +@@ -65,6 +65,8 @@ public: + const llvm::opt::ArgList &DriverArgs, const JobAction &JA, + const llvm::fltSemantics *FPType = nullptr) const override; + ++ unsigned GetDefaultDwarfVersion() const override { return 5; } ++ + protected: + Tool *buildAssembler() const override; + Tool *buildLinker() const override; diff --git a/recipes-devtools/clang/clang/0028-llvm-Do-not-use-find_library-for-ncurses.patch b/recipes-devtools/clang/clang/0028-llvm-Do-not-use-find_library-for-ncurses.patch deleted file mode 100644 index ef9b2ed..0000000 --- a/recipes-devtools/clang/clang/0028-llvm-Do-not-use-find_library-for-ncurses.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6660c7d48601df4276fb3f51156c96fff103fb79 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sun, 7 Feb 2021 23:58:41 -0800 -Subject: [PATCH] llvm: Do not use find_library for ncurses - -This ensures that it lets OE to decide which lib to link -otherwise it adds absolute paths to linker cmdline and confuses it -horribly with native and target libs when build clang for target - -TOPDIR/build/tmp/work/cortexa57-yoe-linux-musl/clang/12.0.0-r0/recipe-sysroot-native/usr/lib/libtinfo.so: error adding symbols: file in wrong format -clang-12: error: linker command failed with exit code 1 (use -v to see invocation) - -Signed-off-by: Khem Raj ---- - compiler-rt/cmake/config-ix.cmake | 2 +- - llvm/cmake/config-ix.cmake | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake -index 196aa62fd01c..49bbbd257d97 100644 ---- a/compiler-rt/cmake/config-ix.cmake -+++ b/compiler-rt/cmake/config-ix.cmake -@@ -140,7 +140,7 @@ else() - set(MAYBE_REQUIRED) - endif() - if(LLVM_ENABLE_TERMINFO) -- find_library(COMPILER_RT_TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED}) -+ set(TERMINFO_LIB tinfo curses ncurses ncursesw) - endif() - if(COMPILER_RT_TERMINFO_LIB) - set(LLVM_ENABLE_TERMINFO 1) -diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake -index 818fafbce148..2f8ad6652334 100644 ---- a/llvm/cmake/config-ix.cmake -+++ b/llvm/cmake/config-ix.cmake -@@ -175,7 +175,7 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") - set(MAYBE_REQUIRED) - endif() - if(LLVM_ENABLE_TERMINFO) -- find_library(TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED}) -+ set(TERMINFO_LIB tinfo curses ncurses ncursesw) - endif() - if(TERMINFO_LIB) - set(LLVM_ENABLE_TERMINFO 1) diff --git a/recipes-devtools/clang/clang/0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch b/recipes-devtools/clang/clang/0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch deleted file mode 100644 index a9658b3..0000000 --- a/recipes-devtools/clang/clang/0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 7bc8252aff944f2efeaad92c431b1f1c5cf606b1 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 11 Feb 2021 16:42:49 -0800 -Subject: [PATCH] llvm: Insert anchor for adding OE distro vendor names - -This helps in making right detection for OE built gcc toolchains - -The //CLANG_EXTRA_OE_VENDORS_CASES string is replaced with list of -additional Ceses based on CLANG_EXTRA_OE_VENDORS variable in -recipes-devtools/clang/llvm-project-source.inc:add_more_target_vendors() - -Upstream-Status: Inappropriate [OE-specific] - -Signed-off-by: Khem Raj -Signed-off-by: Martin Jansa ---- - llvm/lib/Support/Triple.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp -index 4f483c965282..ffd20d223133 100644 ---- a/llvm/lib/Support/Triple.cpp -+++ b/llvm/lib/Support/Triple.cpp -@@ -489,7 +489,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) { - .Case("amd", Triple::AMD) - .Case("mesa", Triple::Mesa) - .Case("suse", Triple::SUSE) -- .Case("oe", Triple::OpenEmbedded) -+ .Case("oe", Triple::OpenEmbedded)//CLANG_EXTRA_OE_VENDORS_CASES - .Default(Triple::UnknownVendor); - } - diff --git a/recipes-devtools/clang/clang/0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch b/recipes-devtools/clang/clang/0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch deleted file mode 100644 index 8093de0..0000000 --- a/recipes-devtools/clang/clang/0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 4d51447a11ee6796594fd55718ea62575ecebc78 Mon Sep 17 00:00:00 2001 -From: Alexander Kanavin -Date: Fri, 27 Nov 2020 10:11:08 +0000 -Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well - -Otherwise, there are instances which are identical in -every other field and therefore sort non-reproducibly -(which breaks binary and source reproducibiliy). - -Upstream-Status: Pending -Signed-off-by: Alexander Kanavin -Signed-off-by: Khem Raj ---- - llvm/utils/TableGen/AsmMatcherEmitter.cpp | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp -index 9d304910ba4e..d1b50b04fc71 100644 ---- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp -+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp -@@ -359,7 +359,10 @@ public: - // name of a class shouldn't be significant. However, some of the backends - // accidentally rely on this behaviour, so it will have to stay like this - // until they are fixed. -- return ValueName < RHS.ValueName; -+ if (ValueName != RHS.ValueName) -+ return ValueName < RHS.ValueName; -+ // All else being equal, we should sort by name, for source and binary reproducibility -+ return Name < RHS.Name; - } - }; - diff --git a/recipes-devtools/clang/clang/0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch b/recipes-devtools/clang/clang/0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch deleted file mode 100644 index 1f3af25..0000000 --- a/recipes-devtools/clang/clang/0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 4f45514fb8841a08d8d3bb68d9cb84b607e652f2 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 24 Mar 2021 00:32:09 -0700 -Subject: [PATCH] compiler-rt: Use mcr based barrier on armv6 - -dsb is an armv7 instruction and wont work when we are building for armv6. - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - compiler-rt/lib/builtins/arm/sync-ops.h | 8 ++++---- - compiler-rt/lib/builtins/assembly.h | 8 ++++++++ - 2 files changed, 12 insertions(+), 4 deletions(-) - -diff --git a/compiler-rt/lib/builtins/arm/sync-ops.h b/compiler-rt/lib/builtins/arm/sync-ops.h -index c9623249e5d2..7a26170741ad 100644 ---- a/compiler-rt/lib/builtins/arm/sync-ops.h -+++ b/compiler-rt/lib/builtins/arm/sync-ops.h -@@ -19,14 +19,14 @@ - .thumb; \ - .syntax unified; \ - DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ -- dmb; \ -+ DMB; \ - mov r12, r0; \ - LOCAL_LABEL(tryatomic_##op) : ldrex r0, [r12]; \ - op(r2, r0, r1); \ - strex r3, r2, [r12]; \ - cmp r3, #0; \ - bne LOCAL_LABEL(tryatomic_##op); \ -- dmb; \ -+ DMB; \ - bx lr - - #define SYNC_OP_8(op) \ -@@ -35,14 +35,14 @@ - .syntax unified; \ - DEFINE_COMPILERRT_THUMB_FUNCTION(__sync_fetch_and_##op) \ - push {r4, r5, r6, lr}; \ -- dmb; \ -+ DMB; \ - mov r12, r0; \ - LOCAL_LABEL(tryatomic_##op) : ldrexd r0, r1, [r12]; \ - op(r4, r5, r0, r1, r2, r3); \ - strexd r6, r4, r5, [r12]; \ - cmp r6, #0; \ - bne LOCAL_LABEL(tryatomic_##op); \ -- dmb; \ -+ DMB; \ - pop { r4, r5, r6, pc } - - #define MINMAX_4(rD, rN, rM, cmp_kind) \ -diff --git a/compiler-rt/lib/builtins/assembly.h b/compiler-rt/lib/builtins/assembly.h -index f6ce6a9fccff..5c6cd9376ac4 100644 ---- a/compiler-rt/lib/builtins/assembly.h -+++ b/compiler-rt/lib/builtins/assembly.h -@@ -181,6 +181,14 @@ - JMP(ip) - #endif - -+#if __ARM_ARCH >= 7 -+#define DMB dmb -+#elif __ARM_ARCH >= 6 -+#define DMB mcr p15, #0, r0, c7, c10, #5 -+#else -+#error Only use this with ARMv6+ -+#endif -+ - #if defined(USE_THUMB_2) - #define WIDE(op) op.w - #else diff --git a/recipes-devtools/clang/clang/0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch b/recipes-devtools/clang/clang/0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch deleted file mode 100644 index a022a71..0000000 --- a/recipes-devtools/clang/clang/0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 1d07b3e71bf073da0a25b30efb135adaa876e3df Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 15 Apr 2021 18:58:07 -0700 -Subject: [PATCH] clang: Switch defaults to dwarf-5 debug info on Linux - -GCC 11 has defaulted to DWARF-5 as well, this matches -debug info formats, so mix and match of components with GCC 11 -works. - -Upstream-Status: Pending -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Linux.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h -index 582d4bef81df..82c9494c744e 100644 ---- a/clang/lib/Driver/ToolChains/Linux.h -+++ b/clang/lib/Driver/ToolChains/Linux.h -@@ -58,6 +58,8 @@ public: - const llvm::opt::ArgList &DriverArgs, const JobAction &JA, - const llvm::fltSemantics *FPType = nullptr) const override; - -+ unsigned GetDefaultDwarfVersion() const override { return 5; } -+ - protected: - Tool *buildAssembler() const override; - Tool *buildLinker() const override; diff --git a/recipes-devtools/clang/clang/0034-CMake-Installable-find-modules-for-terminfo-and-libf.patch b/recipes-devtools/clang/clang/0034-CMake-Installable-find-modules-for-terminfo-and-libf.patch index cefbf02..68b8e44 100644 --- a/recipes-devtools/clang/clang/0034-CMake-Installable-find-modules-for-terminfo-and-libf.patch +++ b/recipes-devtools/clang/clang/0034-CMake-Installable-find-modules-for-terminfo-and-libf.patch @@ -1,7 +1,7 @@ -From 9583baa3f6787236a2452937bbf962a2418f6423 Mon Sep 17 00:00:00 2001 +From 81360dd267eae6c34c4ab1000a1343b6488d84d5 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 5 Dec 2021 14:45:33 -0500 -Subject: [PATCH] [CMake] Installable find modules for terminfo and libffi +Subject: [PATCH] Installable find modules for terminfo and libffi Improves cross-distro portability of LLVM cmake package by resolving paths for terminfo and libffi via import targets. @@ -16,6 +16,7 @@ environment of the LLVM package importer. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D114327 + --- llvm/cmake/config-ix.cmake | 50 +++--------- llvm/cmake/modules/FindFFI.cmake | 81 +++++++++++++++++++ @@ -28,7 +29,7 @@ Differential Revision: https://reviews.llvm.org/D114327 create mode 100644 llvm/cmake/modules/FindTerminfo.cmake diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake -index 2f8ad6652334..ea0cd107a783 100644 +index a320cf97b306..21cadf1893c6 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -169,18 +169,13 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") @@ -56,7 +57,7 @@ index 2f8ad6652334..ea0cd107a783 100644 endif() else() set(LLVM_ENABLE_TERMINFO 0) -@@ -318,38 +313,19 @@ if (LLVM_ENABLE_DOXYGEN) +@@ -325,38 +320,19 @@ if (LLVM_ENABLE_DOXYGEN) llvm_find_program(dot) endif () @@ -100,8 +101,8 @@ index 2f8ad6652334..ea0cd107a783 100644 -endif( LLVM_ENABLE_FFI ) +endif() - # Whether we can use std::is_trivially_copyable to verify llvm::is_trivially_copyable. - CHECK_CXX_SOURCE_COMPILES(" + check_symbol_exists(proc_pid_rusage "libproc.h" HAVE_PROC_PID_RUSAGE) + diff --git a/llvm/cmake/modules/FindFFI.cmake b/llvm/cmake/modules/FindFFI.cmake new file mode 100644 index 000000000000..b0d859af8959 @@ -239,7 +240,7 @@ index 000000000000..65edb80fa69a + endif() +endif() diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in -index ac053141b008..42c1ea819717 100644 +index a71bef19fd0c..5a2fea5be399 100644 --- a/llvm/cmake/modules/LLVMConfig.cmake.in +++ b/llvm/cmake/modules/LLVMConfig.cmake.in @@ -2,6 +2,9 @@ @@ -294,7 +295,7 @@ index 9930e01559e9..14522ba2a1bf 100644 + target_link_libraries( LLVMInterpreter PRIVATE FFI::ffi ) endif() diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt -index cdee11412eb5..5909eeef056a 100644 +index 2242b0ec60ab..5cf80c1bb59d 100644 --- a/llvm/lib/Support/CMakeLists.txt +++ b/llvm/lib/Support/CMakeLists.txt @@ -24,7 +24,7 @@ elseif( CMAKE_HOST_UNIX ) @@ -306,7 +307,7 @@ index cdee11412eb5..5909eeef056a 100644 endif() if( LLVM_ENABLE_THREADS AND (HAVE_LIBATOMIC OR HAVE_CXX_LIBATOMICS64) ) set(system_libs ${system_libs} atomic) -@@ -249,7 +249,10 @@ if(LLVM_ENABLE_ZLIB) +@@ -256,7 +256,10 @@ if(LLVM_ENABLE_ZLIB) endif() if(LLVM_ENABLE_TERMINFO) diff --git a/recipes-devtools/clang/clang/0036-libc-LWG2993-reference_wrapper-T-conversion-from-U.patch b/recipes-devtools/clang/clang/0036-libc-LWG2993-reference_wrapper-T-conversion-from-U.patch deleted file mode 100644 index aa9b2e7..0000000 --- a/recipes-devtools/clang/clang/0036-libc-LWG2993-reference_wrapper-T-conversion-from-U.patch +++ /dev/null @@ -1,379 +0,0 @@ -From eec04092d67b94f47439a9065b6bd4cd60165be2 Mon Sep 17 00:00:00 2001 -From: Arthur O'Dwyer -Date: Sat, 5 Dec 2020 19:37:41 -0500 -Subject: [PATCH] [libc++] [LWG2993] reference_wrapper conversion from U&& -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Implement the resolution of LWG2993. Replace a deleted constructor -with a constructor that SFINAEs away in appropriate circumstances. -Also, now that the constructor is templated, we must have an -explicit deduction guide to make CTAD work. - -Some tests have been merged in from Agustín Bergé's D40259. - -Differential Revision: https://reviews.llvm.org/D92725 - -Upstream-Status: Backport - ---- - libcxx/docs/Cxx2aStatusIssuesStatus.csv | 2 +- - libcxx/include/__functional_base | 21 ++++- - libcxx/include/functional | 7 +- - .../refwrap.assign/copy_assign.pass.cpp | 20 +++++ - .../refwrap/refwrap.const/deduct.pass.cpp | 31 +++++++ - .../refwrap.const/type_conv_ctor.pass.cpp | 81 +++++++++++++++++++ - .../refwrap.const/type_conv_ctor2.pass.cpp | 61 ++++++++++++++ - .../refwrap/refwrap.const/type_ctor.pass.cpp | 17 ++++ - 8 files changed, 234 insertions(+), 6 deletions(-) - create mode 100644 libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/deduct.pass.cpp - create mode 100644 libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp - create mode 100644 libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor2.pass.cpp - -diff --git a/libcxx/docs/Cxx2aStatusIssuesStatus.csv b/libcxx/docs/Cxx2aStatusIssuesStatus.csv -index d2adde69d9d2..b411f12d0ce3 100644 ---- a/libcxx/docs/Cxx2aStatusIssuesStatus.csv -+++ b/libcxx/docs/Cxx2aStatusIssuesStatus.csv -@@ -35,7 +35,7 @@ - "`2981 `__","Remove redundant deduction guides from standard library","Albuquerque","","" - "`2982 `__","Making size_type consistent in associative container deduction guides","Albuquerque","","" - "`2988 `__","Clause 32 cleanup missed one typename","Albuquerque","","" --"`2993 `__","reference_wrapper conversion from T&&","Albuquerque","","" -+"`2993 `__","reference_wrapper conversion from T&&","Albuquerque","|Complete|","13.0" - "`2998 `__","Requirements on function objects passed to {``forward_``,}list-specific algorithms","Albuquerque","|Nothing To Do|","" - "`3001 `__","weak_ptr::element_type needs remove_extent_t","Albuquerque","","" - "`3024 `__","variant's copies must be deleted instead of disabled via SFINAE","Albuquerque","|Complete|","" -diff --git a/libcxx/include/__functional_base b/libcxx/include/__functional_base -index 1c02e960d5f0..caa746036bf5 100644 ---- a/libcxx/include/__functional_base -+++ b/libcxx/include/__functional_base -@@ -380,13 +380,24 @@ public: - private: - type* __f_; - -+#ifndef _LIBCPP_CXX03_LANG -+ static void __fun(_Tp&) _NOEXCEPT; -+ static void __fun(_Tp&&) = delete; -+#endif -+ - public: - // construct/copy/destroy -- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -+#ifdef _LIBCPP_CXX03_LANG -+ _LIBCPP_INLINE_VISIBILITY - reference_wrapper(type& __f) _NOEXCEPT - : __f_(_VSTD::addressof(__f)) {} --#ifndef _LIBCPP_CXX03_LANG -- private: reference_wrapper(type&&); public: // = delete; // do not bind to temps -+#else -+ template ::value, decltype(__fun(_VSTD::declval<_Up>())) >> -+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -+ reference_wrapper(_Up&& __u) _NOEXCEPT_(noexcept(__fun(_VSTD::declval<_Up>()))) { -+ type& __f = static_cast<_Up&&>(__u); -+ __f_ = _VSTD::addressof(__f); -+ } - #endif - - // access -@@ -511,6 +522,10 @@ public: - #endif // _LIBCPP_CXX03_LANG - }; - -+#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES -+template -+reference_wrapper(_Tp&) -> reference_wrapper<_Tp>; -+#endif - - template - inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 -diff --git a/libcxx/include/functional b/libcxx/include/functional -index 67baa5bd4b77..f8565e7e6e67 100644 ---- a/libcxx/include/functional -+++ b/libcxx/include/functional -@@ -42,8 +42,8 @@ public: - typedef see below result_type; // Not always defined - - // construct/copy/destroy -- reference_wrapper(T&) noexcept; -- reference_wrapper(T&&) = delete; // do not bind to temps -+ template -+ reference_wrapper(U&&); - reference_wrapper(const reference_wrapper& x) noexcept; - - // assignment -@@ -59,6 +59,9 @@ public: - operator() (ArgTypes&&...) const; - }; - -+template -+ reference_wrapper(T&) -> reference_wrapper; -+ - template reference_wrapper ref(T& t) noexcept; - template void ref(const T&& t) = delete; - template reference_wrapper ref(reference_wrappert) noexcept; -diff --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp -index f82ee72de915..5058a7477581 100644 ---- a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp -+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.assign/copy_assign.pass.cpp -@@ -21,6 +21,12 @@ class functor1 - { - }; - -+struct convertible_to_int_ref { -+ int val = 0; -+ operator int&() { return val; } -+ operator int const&() const { return val; } -+}; -+ - template - void - test(T& t) -@@ -56,5 +62,19 @@ int main(int, char**) - const int j = 0; - test(j); - -+#if TEST_STD_VER >= 11 -+ convertible_to_int_ref convi; -+ test(convi); -+ convertible_to_int_ref const convic; -+ test(convic); -+ -+ { -+ using Ref = std::reference_wrapper; -+ static_assert((std::is_assignable::value), ""); -+ static_assert((!std::is_assignable::value), ""); -+ static_assert((!std::is_assignable::value), ""); -+ } -+#endif -+ - return 0; - } -diff --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/deduct.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/deduct.pass.cpp -new file mode 100644 -index 000000000000..4e197e8fc3f3 ---- /dev/null -+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/deduct.pass.cpp -@@ -0,0 +1,31 @@ -+//===----------------------------------------------------------------------===// -+// -+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -+// See https://llvm.org/LICENSE.txt for license information. -+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -+// -+//===----------------------------------------------------------------------===// -+ -+// UNSUPPORTED: c++03, c++11, c++14 -+// UNSUPPORTED: libcpp-no-deduction-guides -+ -+// -+ -+// template -+// reference_wrapper(T&) -> reference_wrapper; -+ -+#include -+ -+int main() -+{ -+ int i = 0; -+ std::reference_wrapper ri(i); -+ static_assert(std::is_same_v>); -+ std::reference_wrapper ri2(ri); -+ static_assert(std::is_same_v>); -+ const int j = 0; -+ std::reference_wrapper rj(j); -+ static_assert(std::is_same_v>); -+ std::reference_wrapper rj2(rj); -+ static_assert(std::is_same_v>); -+} -diff --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp -new file mode 100644 -index 000000000000..d8ad18215fb7 ---- /dev/null -+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor.pass.cpp -@@ -0,0 +1,81 @@ -+//===----------------------------------------------------------------------===// -+// -+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -+// See https://llvm.org/LICENSE.txt for license information. -+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -+// -+//===----------------------------------------------------------------------===// -+ -+// UNSUPPORTED: c++03 -+ -+// -+// -+// reference_wrapper -+// -+// template -+// reference_wrapper(U&&) noexcept(see below); -+ -+#include -+#include -+ -+struct convertible_to_int_ref { -+ int val = 0; -+ operator int&() { return val; } -+ operator int const&() const { return val; } -+}; -+ -+template -+struct nothrow_convertible { -+ int val = 0; -+ operator int&() noexcept(IsNothrow) { return val; } -+}; -+ -+struct convertible_from_int { -+ convertible_from_int(int) {} -+}; -+ -+void meow(std::reference_wrapper) {} -+void meow(convertible_from_int) {} -+ -+int gi; -+std::reference_wrapper purr() { return gi; }; -+ -+template -+void -+test(T& t) -+{ -+ std::reference_wrapper r(t); -+ assert(&r.get() == &t); -+} -+ -+void f() {} -+ -+int main() -+{ -+ convertible_to_int_ref convi; -+ test(convi); -+ convertible_to_int_ref const convic; -+ test(convic); -+ -+ { -+ using Ref = std::reference_wrapper; -+ static_assert((std::is_nothrow_constructible>::value), ""); -+ static_assert((!std::is_nothrow_constructible>::value), ""); -+ } -+ -+ { -+ meow(0); -+ (true) ? purr() : 0; -+ } -+ -+#ifdef __cpp_deduction_guides -+ { -+ int i = 0; -+ std::reference_wrapper ri(i); -+ static_assert((std::is_same>::value), "" ); -+ const int j = 0; -+ std::reference_wrapper rj(j); -+ static_assert((std::is_same>::value), "" ); -+ } -+#endif -+} -diff --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor2.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor2.pass.cpp -new file mode 100644 -index 000000000000..debdc12c8588 ---- /dev/null -+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_conv_ctor2.pass.cpp -@@ -0,0 +1,61 @@ -+//===----------------------------------------------------------------------===// -+// -+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -+// See https://llvm.org/LICENSE.txt for license information. -+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -+// -+//===----------------------------------------------------------------------===// -+ -+// UNSUPPORTED: c++03 -+ -+// -+// -+// reference_wrapper -+// -+// template -+// reference_wrapper(U&&); -+ -+#include -+#include -+ -+struct B {} b; -+ -+struct A1 { -+ operator B& () const { return b; } -+}; -+struct A2 { -+ operator B& () const noexcept { return b; } -+}; -+ -+int main() -+{ -+ { -+ std::reference_wrapper b1 = A1(); -+ assert(&b1.get() == &b); -+ b1 = A1(); -+ assert(&b1.get() == &b); -+ -+ static_assert(std::is_convertible>::value, ""); -+ static_assert(!std::is_nothrow_constructible, A1>::value, ""); -+#if TEST_STD_VER >= 20 -+ static_assert(!std::is_nothrow_convertible_v>); -+#endif -+ static_assert(std::is_assignable, A1>::value, ""); -+ static_assert(!std::is_nothrow_assignable, A1>::value, ""); -+ } -+ -+ { -+ std::reference_wrapper b2 = A2(); -+ assert(&b2.get() == &b); -+ b2 = A2(); -+ assert(&b2.get() == &b); -+ -+ static_assert(std::is_convertible>::value, ""); -+ static_assert(std::is_nothrow_constructible, A2>::value, ""); -+#if TEST_STD_VER >= 20 -+ static_assert(std::is_nothrow_convertible_v>); -+#endif -+ static_assert(std::is_assignable, A2>::value, ""); -+ static_assert(std::is_nothrow_assignable, A2>::value, ""); -+ } -+} -diff --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp -index 4d536a20411d..af2273452612 100644 ---- a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp -+++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.const/type_ctor.pass.cpp -@@ -14,6 +14,7 @@ - - #include - #include -+#include - - #include "test_macros.h" - -@@ -43,5 +44,21 @@ int main(int, char**) - const int j = 0; - test(j); - -+ { -+ using Ref = std::reference_wrapper; -+ static_assert((std::is_constructible::value), ""); -+ static_assert((!std::is_constructible::value), ""); -+ static_assert((!std::is_constructible::value), ""); -+ } -+ -+#if TEST_STD_VER >= 11 -+ { -+ using Ref = std::reference_wrapper; -+ static_assert((std::is_nothrow_constructible::value), ""); -+ static_assert((!std::is_nothrow_constructible::value), ""); -+ static_assert((!std::is_nothrow_constructible::value), ""); -+ } -+#endif -+ - return 0; - } --- -2.34.1 - diff --git a/recipes-devtools/clang/clang_git.bb b/recipes-devtools/clang/clang_git.bb index b0c81f1..a7a9822 100644 --- a/recipes-devtools/clang/clang_git.bb +++ b/recipes-devtools/clang/clang_git.bb @@ -86,7 +86,7 @@ LLVM_ENABLE_RTTI;LLVM_ENABLE_EH;LLVM_BUILD_EXTERNAL_COMPILER_RT;CMAKE_SYSTEM_NAM CMAKE_BUILD_TYPE;BUILD_SHARED_LIBS;LLVM_ENABLE_PROJECTS;LLVM_BINUTILS_INCDIR;\ LLVM_TARGETS_TO_BUILD;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;PYTHON_EXECUTABLE;\ PYTHON_LIBRARY;PYTHON_INCLUDE_DIR;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;LLDB_EDITLINE_USE_WCHAR;\ -LLVM_ENABLE_LIBEDIT;LLDB_ENABLE_LIBEDIT; \ +LLVM_ENABLE_LIBEDIT;LLDB_ENABLE_LIBEDIT;LLDB_PYTHON_RELATIVE_PATH;\ CMAKE_C_FLAGS_RELEASE;CMAKE_CXX_FLAGS_RELEASE;CMAKE_ASM_FLAGS_RELEASE;\ " # @@ -134,7 +134,7 @@ EXTRA_OECMAKE_append_class-native = "\ " EXTRA_OECMAKE_append_class-nativesdk = "\ -DCMAKE_CROSSCOMPILING:BOOL=ON \ - -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain-native.cmake' \ + -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} -DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain-native.cmake' \ -DCMAKE_RANLIB=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ranlib \ -DCMAKE_AR=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-ar \ -DCMAKE_NM=${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}llvm-nm \ @@ -143,11 +143,13 @@ EXTRA_OECMAKE_append_class-nativesdk = "\ -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \ -DLLDB_TABLEGEN=${STAGING_BINDIR_NATIVE}/lldb-tblgen \ -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \ + -DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \ -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \ -DPYTHON_EXECUTABLE='${PYTHON}' \ " EXTRA_OECMAKE_append_class-target = "\ -DCMAKE_CROSSCOMPILING:BOOL=ON \ + -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR}' \ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen \ -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \ -DLLDB_TABLEGEN=${STAGING_BINDIR_NATIVE}/lldb-tblgen \ @@ -158,6 +160,7 @@ EXTRA_OECMAKE_append_class-target = "\ -DLLVM_TARGET_ARCH=${@get_clang_target_arch(bb, d)} \ -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_SYS}${HF} \ -DLLVM_HOST_TRIPLE=${TARGET_SYS}${HF} \ + -DLLDB_PYTHON_RELATIVE_PATH=${PYTHON_SITEPACKAGES_DIR} \ -DPYTHON_LIBRARY=${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so \ -DPYTHON_INCLUDE_DIR=${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI} \ -DLLVM_LIBDIR_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \ diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index ed3c2c0..06a5ecb 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc @@ -13,37 +13,33 @@ SRC_URI = "\ file://0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch \ file://0003-compiler-rt-support-a-new-embedded-linux-target.patch \ file://0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch \ - file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ - file://0007-llvm-allow-env-override-of-exe-path.patch \ - file://0008-clang-driver-Check-sysroot-for-ldso-path.patch \ - file://0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch \ - file://0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch \ - file://0011-clang-Prepend-trailing-to-sysroot.patch \ - file://0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch \ - file://0013-clang-Define-releative-gcc-installation-dir.patch \ - file://0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch \ - file://0015-clang-scan-view-needs-python-2.x.patch \ - file://0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \ - file://0017-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \ - file://0018-Check-for-atomic-double-intrinsics.patch \ - file://0019-clang-Enable-SSP-and-PIE-by-default.patch \ - file://0020-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \ - file://0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \ - file://0022-clang-Fix-resource-dir-location-for-cross-toolchains.patch \ - file://0023-fix-path-to-libffi.patch \ - file://0024-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch \ - file://0025-clang-Use-python3-in-python-scripts.patch \ - file://0026-For-x86_64-set-Yocto-based-GCC-install-search-path.patch \ - file://0027-compiler-rt-Include-stddef.h.patch \ - file://0028-llvm-Do-not-use-find_library-for-ncurses.patch \ - file://0029-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch \ - file://0030-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ - file://0031-compiler-rt-Use-mcr-based-barrier-on-armv6.patch \ - file://0032-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch \ + file://0005-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ + file://0006-llvm-allow-env-override-of-exe-path.patch \ + file://0007-clang-driver-Check-sysroot-for-ldso-path.patch \ + file://0008-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch \ + file://0009-clang-musl-ppc-does-not-support-128-bit-long-double.patch \ + file://0010-clang-Prepend-trailing-to-sysroot.patch \ + file://0011-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch \ + file://0012-clang-Define-releative-gcc-installation-dir.patch \ + file://0013-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \ + file://0014-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \ + file://0015-Check-for-atomic-double-intrinsics.patch \ + file://0016-clang-Enable-SSP-and-PIE-by-default.patch \ + file://0017-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \ + file://0018-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \ + file://0019-clang-Fix-resource-dir-location-for-cross-toolchains.patch \ + file://0020-fix-path-to-libffi.patch \ + file://0021-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch \ + file://0022-clang-Use-python3-in-python-scripts.patch \ + file://0023-For-x86_64-set-Yocto-based-GCC-install-search-path.patch \ + file://0024-compiler-rt-Include-stddef.h.patch \ + file://0025-llvm-Do-not-use-find_library-for-ncurses.patch \ + file://0026-llvm-Insert-anchor-for-adding-OE-distro-vendor-names.patch \ + file://0027-compiler-rt-Use-mcr-based-barrier-on-armv6.patch \ + file://0028-clang-Switch-defaults-to-dwarf-5-debug-info-on-Linux.patch \ file://0033-compiler-rt-Link-scudo-with-SANITIZER_CXX_ABI_LIBRAR.patch \ file://0034-CMake-Installable-find-modules-for-terminfo-and-libf.patch \ file://0035-llvm-Do-not-use-standard-search-paths-in-find_librar.patch \ - file://0036-libc-LWG2993-reference_wrapper-T-conversion-from-U.patch \ " # Fallback to no-PIE if not set GCCPIE ??= "" -- cgit v1.2.3-54-g00ecf