From 64aa45cebb8d1dea90bf81e84a802f0ef103db14 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 20 Jan 2020 09:13:11 -0800 Subject: clang: Upgrade clang to 10.x release (RC2) Signed-off-by: Khem Raj --- 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 +- ...0005-compiler-rt-Disable-tsan-on-OE-glibc.patch | 10 +- ...LibraryInfo-Undefine-libc-functions-if-th.patch | 2 +- .../0007-llvm-allow-env-override-of-exe-path.patch | 4 +- ...-clang-driver-Check-sysroot-for-ldso-path.patch | 61 ++++ .../0008-llvm-Enhance-path-prefix-mapping.patch | 172 ---------- ...iver-tools.cpp-Add-lssp_nonshared-on-musl.patch | 31 ++ .../0009-clang-Enable-SSP-and-PIE-by-default.patch | 60 ---- ...-clang-driver-Check-sysroot-for-ldso-path.patch | 60 ---- ...-ppc-does-not-support-128-bit-long-double.patch | 25 ++ ...iver-tools.cpp-Add-lssp_nonshared-on-musl.patch | 31 -- .../0011-clang-Prepend-trailing-to-sysroot.patch | 38 +++ ...inside-the-target-sysroot-for-compiler-ru.patch | 40 +++ ...-ppc-does-not-support-128-bit-long-double.patch | 25 -- ...ang-Define-releative-gcc-installation-dir.patch | 29 ++ .../0013-clang-Prepend-trailing-to-sysroot.patch | 38 --- ...dso-for-musl-on-x86-and-x32-architectures.patch | 41 +++ ...inside-the-target-sysroot-for-compiler-ru.patch | 40 --- ...ang-Define-releative-gcc-installation-dir.patch | 29 -- .../0015-clang-scan-view-needs-python-2.x.patch | 24 ++ ...pthread-and-ldl-along-with-lunwind-for-st.patch | 40 +++ ...dso-for-musl-on-x86-and-x32-architectures.patch | 41 --- .../0017-clang-scan-view-needs-python-2.x.patch | 24 -- ...lang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch | 33 ++ ..._EXECUTABLE-when-cross-compiling-for-nati.patch | 23 ++ ...al-implementation-of-fmacro-prefix-map-an.patch | 380 --------------------- .../0019-Check-for-atomic-double-intrinsics.patch | 32 ++ ...pthread-and-ldl-along-with-lunwind-for-st.patch | 36 -- .../0020-clang-Enable-SSP-and-PIE-by-default.patch | 313 +++++++++++++++++ ...clang-default-to-lp64d-ABI-and-rv64gc-ISA.patch | 49 --- ...upport-for-floating-point-registers-in-in.patch | 103 ------ ...-llvm-Add-lz-to-linker-cmdline-if-enabled.patch | 28 ++ ..._EXECUTABLE-when-cross-compiling-for-nati.patch | 22 -- ...compiler-runtime-library-to-link-step-for.patch | 37 ++ ...cmake-Fix-configure-for-packages-using-fi.patch | 140 ++++++++ ...023-openmp-Recognise-ARMv7ve-machine-arch.patch | 28 -- .../0024-Check-for-atomic-double-intrinsics.patch | 32 -- .../0025-llvm-Let-llvm-ar-name-contain-lib.patch | 150 -------- ...lang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch | 33 -- ...ix-sanitizer-common-build-with-glibc-2.31.patch | 81 ----- .../0028-Add-libgcc-to-link-step-for-libcxx.patch | 30 -- ...cmake-Fix-configure-for-packages-using-fi.patch | 138 -------- recipes-devtools/clang/common.inc | 38 +-- 48 files changed, 974 insertions(+), 1647 deletions(-) create mode 100644 recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch delete mode 100644 recipes-devtools/clang/clang/0008-llvm-Enhance-path-prefix-mapping.patch create mode 100644 recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch delete mode 100644 recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch delete mode 100644 recipes-devtools/clang/clang/0010-clang-driver-Check-sysroot-for-ldso-path.patch create mode 100644 recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch delete mode 100644 recipes-devtools/clang/clang/0011-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch create mode 100644 recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch create mode 100644 recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch delete mode 100644 recipes-devtools/clang/clang/0012-clang-musl-ppc-does-not-support-128-bit-long-double.patch create mode 100644 recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch delete mode 100644 recipes-devtools/clang/clang/0013-clang-Prepend-trailing-to-sysroot.patch create mode 100644 recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch delete mode 100644 recipes-devtools/clang/clang/0014-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch delete mode 100644 recipes-devtools/clang/clang/0015-clang-Define-releative-gcc-installation-dir.patch create mode 100644 recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch create mode 100644 recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch delete mode 100644 recipes-devtools/clang/clang/0016-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch delete mode 100644 recipes-devtools/clang/clang/0017-clang-scan-view-needs-python-2.x.patch create mode 100644 recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch create mode 100644 recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch delete mode 100644 recipes-devtools/clang/clang/0018-clang-Initial-implementation-of-fmacro-prefix-map-an.patch create mode 100644 recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch delete mode 100644 recipes-devtools/clang/clang/0019-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch create mode 100644 recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch delete mode 100644 recipes-devtools/clang/clang/0020-clang-default-to-lp64d-ABI-and-rv64gc-ISA.patch delete mode 100644 recipes-devtools/clang/clang/0021-RISCV-Add-support-for-floating-point-registers-in-in.patch create mode 100644 recipes-devtools/clang/clang/0021-llvm-Add-lz-to-linker-cmdline-if-enabled.patch delete mode 100644 recipes-devtools/clang/clang/0022-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch create mode 100644 recipes-devtools/clang/clang/0022-libcxx-Add-compiler-runtime-library-to-link-step-for.patch create mode 100644 recipes-devtools/clang/clang/0023-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch delete mode 100644 recipes-devtools/clang/clang/0023-openmp-Recognise-ARMv7ve-machine-arch.patch delete mode 100644 recipes-devtools/clang/clang/0024-Check-for-atomic-double-intrinsics.patch delete mode 100644 recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch delete mode 100644 recipes-devtools/clang/clang/0026-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch delete mode 100644 recipes-devtools/clang/clang/0027-Fix-sanitizer-common-build-with-glibc-2.31.patch delete mode 100644 recipes-devtools/clang/clang/0028-Add-libgcc-to-link-step-for-libcxx.patch delete mode 100644 recipes-devtools/clang/clang/0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch diff --git a/conf/layer.conf b/conf/layer.conf index 73b473a..2ca07f2 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -29,7 +29,7 @@ INHERIT += "clang" # include clang in SDK CLANGSDK ??= "1" -LLVMVERSION = "9.0.1" +LLVMVERSION = "10.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 84e692d..804e68c 100644 --- a/recipes-devtools/clang/clang.inc +++ b/recipes-devtools/clang/clang.inc @@ -4,11 +4,11 @@ LLVM_DIR = "llvm${LLVM_RELEASE}" LLVM_GIT ?= "git://github.com/llvm" LLVM_GIT_PROTOCOL ?= "https" -MAJOR_VER = "9" +MAJOR_VER = "10" MINOR_VER = "0" -PATCH_VER = "1" +PATCH_VER = "0" -SRCREV ?= "c1a0a213378a458fbea1a5c77b315c7dce08fd05" +SRCREV ?= "5175565cf154aede57354336102a7f6e15a16a20" PV = "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}" BRANCH = "release/${MAJOR_VER}.x" 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 439701b..d0d1d13 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 364c720b5291ed32d14162fd2ddd5975a55fdbe9 Mon Sep 17 00:00:00 2001 +From 47e9c3e1a066cd17828b819937b1296e6ebc6403 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 4bb8d363b57..3b58c36c641 100644 +index 2e9bb402227..bfad6703c65 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt -@@ -148,7 +148,7 @@ if (APPLE) +@@ -149,7 +149,7 @@ if (APPLE) list(APPEND EXTRA_LIBS xml2) else () if (LIBXML2_FOUND) 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 a3c1256..b3c8199 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 d3caf3ac407c6d53f62f18dcec3ecb2cb33166ba Mon Sep 17 00:00:00 2001 +From 9bea240c28ad2d202b42d729f3c5a1afe175ead8 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 aa0b124fc3c..e1503837f33 100644 +index 59d99971a76..b0f51ebee3e 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt -@@ -455,14 +455,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}") +@@ -497,14 +497,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}") # Setup Source Code #=============================================================================== @@ -36,7 +36,7 @@ index aa0b124fc3c..e1503837f33 100644 PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES} ${LIBCXXABI_LIBUNWIND_PATH}/include ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES} -@@ -473,15 +468,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) +@@ -515,15 +510,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 916ac00..df021cd 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 438cdfa2636eb5c180de004feb4527f70c6c1f88 Mon Sep 17 00:00:00 2001 +From dc01fa05b36c1623cdc1988be94dc6118b47cfe9 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 daa6079..cb5dea1 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 0d904bb5f9f9876e09392cadf36e053e983951c3 Mon Sep 17 00:00:00 2001 +From 82e0350c47f0d22e7081b64caff4dec9f48e3d7f 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 f26ae25ada3..1c68cd96d3a 100644 +index 8d768a404f2..1b1a29dc25a 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-compiler-rt-Disable-tsan-on-OE-glibc.patch b/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch index 310e8d0..6189ae8 100644 --- a/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch +++ b/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch @@ -1,4 +1,4 @@ -From c82435d462420d64e4fd249bd6673a12ef38d433 Mon Sep 17 00:00:00 2001 +From d9a483714b1ca13903024e4256b0b1beb5a1e2f6 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 18 Jul 2016 08:05:02 +0000 Subject: [PATCH] compiler-rt: Disable tsan on OE/glibc @@ -13,10 +13,10 @@ Signed-off-by: Khem Raj 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake -index 3cc4c22304e..9da891b62e9 100644 +index 3aad08e8896..a979d38c7a6 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake -@@ -619,7 +619,7 @@ else() +@@ -653,7 +653,7 @@ else() endif() if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND @@ -26,10 +26,10 @@ index 3cc4c22304e..9da891b62e9 100644 else() set(COMPILER_RT_HAS_TSAN FALSE) diff --git a/compiler-rt/test/sanitizer_common/CMakeLists.txt b/compiler-rt/test/sanitizer_common/CMakeLists.txt -index 48fccf05855..b4a7f0adf14 100644 +index fcd651ebe42..821de915be8 100644 --- a/compiler-rt/test/sanitizer_common/CMakeLists.txt +++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt -@@ -6,7 +6,7 @@ set(SANITIZER_COMMON_TESTSUITES) +@@ -11,7 +11,7 @@ set(SANITIZER_COMMON_TESTSUITES) # FIXME(dliew): We should switch to COMPILER_RT_SANITIZERS_TO_BUILD instead of # the hard coded `SUPPORTED_TOOLS_INIT` list once we know that the other # sanitizers work. 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 index bcc8c6d..08d0c24 100644 --- 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 @@ -1,4 +1,4 @@ -From 9076572a14be8f881d1395f144d07b0740f71c69 Mon Sep 17 00:00:00 2001 +From 1a61e23b599d194450cec2923e28c712d8f27fe5 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 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 index d71005f..c135135 100644 --- 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 @@ -1,4 +1,4 @@ -From 58d9492746d605752409824db350ce4e299c9739 Mon Sep 17 00:00:00 2001 +From ebbc3bc8bef3bdab0d11e18049fe925ea24cb8e1 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 @@ -15,7 +15,7 @@ Signed-off-by: Khem Raj 1 file changed, 7 insertions(+) diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp -index 7ef7c46a262..a4f7ed82c7b 100644 +index 6c31df3e173..f34f3a935ad 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp @@ -225,6 +225,13 @@ Typical components:\n\ 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 new file mode 100644 index 0000000..b630aa6 --- /dev/null +++ b/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch @@ -0,0 +1,61 @@ +From d3ab7b54689301d94d3fa8eacfe56c1395cf2c23 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 bff1ab1009b..02e3d676567 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -596,11 +596,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); +@@ -622,6 +630,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"; +@@ -636,6 +648,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; + } + } diff --git a/recipes-devtools/clang/clang/0008-llvm-Enhance-path-prefix-mapping.patch b/recipes-devtools/clang/clang/0008-llvm-Enhance-path-prefix-mapping.patch deleted file mode 100644 index bc89cfd..0000000 --- a/recipes-devtools/clang/clang/0008-llvm-Enhance-path-prefix-mapping.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 8fe2337421af15dee7f0d2af7ed27695e2967723 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 15 Feb 2019 11:32:09 -0800 -Subject: [PATCH] llvm: Enhance path prefix mapping - -Upstream-Status: Submitted [https://reviews.llvm.org/D56769] -Signed-off-by: Khem Raj ---- - llvm/include/llvm/Support/Path.h | 25 +++++++++++++++--- - llvm/lib/Support/Path.cpp | 44 +++++++++++++++++++++++++------- - llvm/unittests/Support/Path.cpp | 29 +++++++++++++++++++++ - 3 files changed, 85 insertions(+), 13 deletions(-) - -diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h -index 5c0bee58f18..20332c09852 100644 ---- a/llvm/include/llvm/Support/Path.h -+++ b/llvm/include/llvm/Support/Path.h -@@ -150,18 +150,35 @@ void replace_extension(SmallVectorImpl &path, const Twine &extension, - /// - /// @code - /// /foo, /old, /new => /foo -+/// /old, /old, /new => /new -+/// /old, /old/, /new, false => /old -+/// /old, /old/, /new, true => /new - /// /old/foo, /old, /new => /new/foo -+/// /old/foo, /old/, /new => /new/foo -+/// /old/foo, /old/, /new/ => /new/foo -+/// /oldfoo, /old, /new => /oldfoo - /// /foo, , /new => /new/foo --/// /old/foo, /old, => /foo -+/// /foo, , new => new/foo -+/// /old/foo, /old, , false => /foo -+/// /old/foo, /old, , true => foo - /// @endcode - /// - /// @param Path If \a Path starts with \a OldPrefix modify to instead - /// start with \a NewPrefix. --/// @param OldPrefix The path prefix to strip from \a Path. -+/// @param OldPrefix The path prefix to strip from \a Path. Any trailing -+/// path separator is ignored if strict is true. - /// @param NewPrefix The path prefix to replace \a NewPrefix with. --void replace_path_prefix(SmallVectorImpl &Path, -+/// @param style The path separator style -+/// @param strict Strict prefix path checking -+/// @result true if \a Path begins with OldPrefix -+bool replace_path_prefix(SmallVectorImpl &Path, - const StringRef &OldPrefix, const StringRef &NewPrefix, -- Style style = Style::native); -+ Style style = Style::native, bool strict = false); -+static inline bool replace_path_prefix(SmallVectorImpl &Path, -+ const StringRef &OldPrefix, const StringRef &NewPrefix, -+ bool strict, Style style = Style::native) { -+ return replace_path_prefix(Path, OldPrefix, NewPrefix, style, strict); -+} - - /// Append to path. - /// -diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp -index c49260125db..89a1c193d14 100644 ---- a/llvm/lib/Support/Path.cpp -+++ b/llvm/lib/Support/Path.cpp -@@ -496,27 +496,53 @@ void replace_extension(SmallVectorImpl &path, const Twine &extension, - path.append(ext.begin(), ext.end()); - } - --void replace_path_prefix(SmallVectorImpl &Path, -+bool replace_path_prefix(SmallVectorImpl &Path, - const StringRef &OldPrefix, const StringRef &NewPrefix, -- Style style) { -+ Style style, bool strict) { - if (OldPrefix.empty() && NewPrefix.empty()) -- return; -+ return false; - - StringRef OrigPath(Path.begin(), Path.size()); -- if (!OrigPath.startswith(OldPrefix)) -- return; -+ StringRef OldPrefixDir; -+ -+ if (!strict && OldPrefix.size() > OrigPath.size()) -+ return false; -+ -+ if (!strict && OldPrefix.size() > OrigPath.size()) -+ return false; -+ -+ // Ensure OldPrefixDir does not have a trailing separator. -+ if (!OldPrefix.empty() && is_separator(OldPrefix.back())) -+ OldPrefixDir = parent_path(OldPrefix, style); -+ else -+ OldPrefixDir = OldPrefix; -+ -+ if (!OrigPath.startswith(OldPrefixDir)) -+ return false; -+ -+ if (OrigPath.size() > OldPrefixDir.size()) -+ if (!is_separator(OrigPath[OldPrefixDir.size()], style) && strict) -+ return false; - - // If prefixes have the same size we can simply copy the new one over. -- if (OldPrefix.size() == NewPrefix.size()) { -+ if (OldPrefixDir.size() == NewPrefix.size() && !strict) { - llvm::copy(NewPrefix, Path.begin()); -- return; -+ return true; - } - -- StringRef RelPath = OrigPath.substr(OldPrefix.size()); -+ StringRef RelPath = OrigPath.substr(OldPrefixDir.size()); - SmallString<256> NewPath; - path::append(NewPath, style, NewPrefix); -- path::append(NewPath, style, RelPath); -+ if (!RelPath.empty()) { -+ if (!is_separator(RelPath[0], style) || !strict) -+ path::append(NewPath, style, RelPath); -+ else -+ path::append(NewPath, style, relative_path(RelPath, style)); -+ } -+ - Path.swap(NewPath); -+ -+ return true; - } - - void native(const Twine &path, SmallVectorImpl &result, Style style) { -diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp -index ccd72d7f176..13af998d8f8 100644 ---- a/llvm/unittests/Support/Path.cpp -+++ b/llvm/unittests/Support/Path.cpp -@@ -1219,7 +1219,9 @@ TEST(Support, RemoveDots) { - TEST(Support, ReplacePathPrefix) { - SmallString<64> Path1("/foo"); - SmallString<64> Path2("/old/foo"); -+ SmallString<64> Path3("/oldnew/foo"); - SmallString<64> OldPrefix("/old"); -+ SmallString<64> OldPrefixSep("/old/"); - SmallString<64> NewPrefix("/new"); - SmallString<64> NewPrefix2("/longernew"); - SmallString<64> EmptyPrefix(""); -@@ -1239,6 +1241,33 @@ TEST(Support, ReplacePathPrefix) { - Path = Path2; - path::replace_path_prefix(Path, OldPrefix, EmptyPrefix); - EXPECT_EQ(Path, "/foo"); -+ Path = Path2; -+ path::replace_path_prefix(Path, OldPrefix, EmptyPrefix, true); -+ EXPECT_EQ(Path, "foo"); -+ Path = Path3; -+ path::replace_path_prefix(Path, OldPrefix, NewPrefix, false); -+ EXPECT_EQ(Path, "/newnew/foo"); -+ Path = Path3; -+ path::replace_path_prefix(Path, OldPrefix, NewPrefix, true); -+ EXPECT_EQ(Path, "/oldnew/foo"); -+ Path = Path3; -+ path::replace_path_prefix(Path, OldPrefixSep, NewPrefix, true); -+ EXPECT_EQ(Path, "/oldnew/foo"); -+ Path = Path1; -+ path::replace_path_prefix(Path, EmptyPrefix, NewPrefix); -+ EXPECT_EQ(Path, "/new/foo"); -+ Path = OldPrefix; -+ path::replace_path_prefix(Path, OldPrefix, NewPrefix); -+ EXPECT_EQ(Path, "/new"); -+ Path = OldPrefixSep; -+ path::replace_path_prefix(Path, OldPrefix, NewPrefix); -+ EXPECT_EQ(Path, "/new/"); -+ Path = OldPrefix; -+ path::replace_path_prefix(Path, OldPrefixSep, NewPrefix, false); -+ EXPECT_EQ(Path, "/old"); -+ Path = OldPrefix; -+ path::replace_path_prefix(Path, OldPrefixSep, NewPrefix, true); -+ EXPECT_EQ(Path, "/new"); - } - - TEST_F(FileSystemTest, OpenFileForRead) { 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 new file mode 100644 index 0000000..4820682 --- /dev/null +++ b/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch @@ -0,0 +1,31 @@ +From 8a7e28da4aa95eb2e19dce222542e787f79a444c 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 da197e47662..4821cfebc21 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -583,6 +583,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-Enable-SSP-and-PIE-by-default.patch b/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch deleted file mode 100644 index d5795d6..0000000 --- a/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 421fd7dbd379d6d2d89ee58527eca10da8cc643c Mon Sep 17 00:00:00 2001 -From: Evangelos Foutras -Date: Thu, 20 Sep 2018 06:20:28 +0300 -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) ---- - clang/lib/Driver/ToolChains/Linux.cpp | 14 ++++++++++++-- - clang/lib/Driver/ToolChains/Linux.h | 1 + - 2 files changed, 13 insertions(+), 2 deletions(-) - -diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp -index 7f59bc77f52..ed907549929 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -975,8 +975,18 @@ 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; -+} -+ -+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const { -+ return 2; - } - - bool Linux::isNoExecStackDefault() const { -diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h -index 4c61994691c..66134a3a327 100644 ---- a/clang/lib/Driver/ToolChains/Linux.h -+++ b/clang/lib/Driver/ToolChains/Linux.h -@@ -39,6 +39,7 @@ public: - CXXStdlibType GetDefaultCXXStdlibType() const override; - bool isPIEDefault() const override; - bool isNoExecStackDefault() const override; -+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override; - bool IsMathErrnoDefault() const override; - SanitizerMask getSupportedSanitizers() const override; - void addProfileRTLibs(const llvm::opt::ArgList &Args, diff --git a/recipes-devtools/clang/clang/0010-clang-driver-Check-sysroot-for-ldso-path.patch b/recipes-devtools/clang/clang/0010-clang-driver-Check-sysroot-for-ldso-path.patch deleted file mode 100644 index bbbc020..0000000 --- a/recipes-devtools/clang/clang/0010-clang-driver-Check-sysroot-for-ldso-path.patch +++ /dev/null @@ -1,60 +0,0 @@ -From dad564a1081f62fe1957175e2b060ca1778ff72b 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 ---- - 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 ed907549929..6adf581a882 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -596,11 +596,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); -@@ -622,6 +630,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"; -@@ -636,6 +648,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; - } - } 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 new file mode 100644 index 0000000..934b49d --- /dev/null +++ b/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch @@ -0,0 +1,25 @@ +From 978921116f4f0947b1131767743a0a093c7d2b72 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 270aa7ff918..8b1bb167818 100644 +--- a/clang/lib/Basic/Targets/PPC.h ++++ b/clang/lib/Basic/Targets/PPC.h +@@ -364,6 +364,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-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch b/recipes-devtools/clang/clang/0011-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch deleted file mode 100644 index a95b838..0000000 --- a/recipes-devtools/clang/clang/0011-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 3beedc96c33d7c7b0e3b1f9c402b7cda71764d4b 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 33cdd3585c2..8b14b8ea9cb 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -579,6 +579,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/0011-clang-Prepend-trailing-to-sysroot.patch b/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch new file mode 100644 index 0000000..6074a98 --- /dev/null +++ b/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch @@ -0,0 +1,38 @@ +From 29b016e8af2283abd9dbbe5c229727c3facb8b4c 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 02e3d676567..d95da11e351 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -223,7 +223,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() + "/"; + + // Cross-compiling binutils and GCC installations (vanilla and openSUSE at + // least) put various tools in a triple-prefixed directory off of the parent 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 new file mode 100644 index 0000000..d43e705 --- /dev/null +++ b/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch @@ -0,0 +1,40 @@ +From c9802082e3c3014e68040efdc7520a4cee1a38f6 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 cab97b1a601..059a5e62c40 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" +@@ -379,7 +380,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/0012-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/recipes-devtools/clang/clang/0012-clang-musl-ppc-does-not-support-128-bit-long-double.patch deleted file mode 100644 index 22c1b3b..0000000 --- a/recipes-devtools/clang/clang/0012-clang-musl-ppc-does-not-support-128-bit-long-double.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 971efedff8fa505ac8c3786e190bec7e3bd2a544 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 6e5df097921..107cef297e2 100644 ---- a/clang/lib/Basic/Targets/PPC.h -+++ b/clang/lib/Basic/Targets/PPC.h -@@ -354,6 +354,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/0013-clang-Define-releative-gcc-installation-dir.patch b/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch new file mode 100644 index 0000000..7a6fc28 --- /dev/null +++ b/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch @@ -0,0 +1,29 @@ +From 3c21ecdc6dfd9e78c6cb464826f31cd005879dd0 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 | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index 4821cfebc21..0c8d9e2f475 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2428,6 +2428,9 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( + {"gcc-cross/" + CandidateTriple.str(), "../..", + TargetTriple.getOS() != llvm::Triple::Solaris}, + ++ // OE cross-compilers path structures ++ {"/" + CandidateTriple.str(), "..", true}, ++ + // 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 diff --git a/recipes-devtools/clang/clang/0013-clang-Prepend-trailing-to-sysroot.patch b/recipes-devtools/clang/clang/0013-clang-Prepend-trailing-to-sysroot.patch deleted file mode 100644 index 87ccffd..0000000 --- a/recipes-devtools/clang/clang/0013-clang-Prepend-trailing-to-sysroot.patch +++ /dev/null @@ -1,38 +0,0 @@ -From cfc6e9f9deb0ef42ac024762cd2e7052641a0515 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 8cee2490cc7..33037dafb57 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -223,7 +223,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() + "/"; - - // Cross-compiling binutils and GCC installations (vanilla and openSUSE at - // least) put various tools in a triple-prefixed directory off of the parent 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 new file mode 100644 index 0000000..0c265f7 --- /dev/null +++ b/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch @@ -0,0 +1,41 @@ +From 416ec373ef2bc7df1e63e8f371cf28dc7794230a 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 d95da11e351..0a4644dab9f 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -519,6 +519,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: +@@ -531,6 +532,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/0014-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch b/recipes-devtools/clang/clang/0014-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch deleted file mode 100644 index 40c19a7..0000000 --- a/recipes-devtools/clang/clang/0014-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch +++ /dev/null @@ -1,40 +0,0 @@ -From e4b89d394dec7b9019faf2d3ad788142032b34b4 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 b1fddb0af55..6eb8fbb8de4 100644 ---- a/clang/lib/Driver/ToolChain.cpp -+++ b/clang/lib/Driver/ToolChain.cpp -@@ -12,6 +12,7 @@ - #include "ToolChains/Clang.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" -@@ -352,7 +353,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/0015-clang-Define-releative-gcc-installation-dir.patch b/recipes-devtools/clang/clang/0015-clang-Define-releative-gcc-installation-dir.patch deleted file mode 100644 index d8ec5d7..0000000 --- a/recipes-devtools/clang/clang/0015-clang-Define-releative-gcc-installation-dir.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e8650cb2729787e0fa8edbfe6c32474472a673b8 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 | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 8b14b8ea9cb..20517a369f7 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -2355,6 +2355,9 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( - {"gcc-cross/" + CandidateTriple.str(), "../..", - TargetTriple.getOS() != llvm::Triple::Solaris}, - -+ // OE cross-compilers path structures -+ {"/" + CandidateTriple.str(), "..", true}, -+ - // 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 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 new file mode 100644 index 0000000..f5b3f1c --- /dev/null +++ b/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch @@ -0,0 +1,24 @@ +From cd53f8bef787fc6c3790db8d31f93916eae7be71 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 6165432e7af..04ad518a60c 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 new file mode 100644 index 0000000..90572d9 --- /dev/null +++ b/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch @@ -0,0 +1,40 @@ +From 751e7b29c02c935987cc9b4d5b17a9db576737f0 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 37ec7346857..c849b2242e9 100644 +--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp ++++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp +@@ -1211,8 +1211,13 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D, + case ToolChain::UNW_CompilerRT: + if (LGT == LibGccType::StaticLibGcc) + CmdArgs.push_back("-l:libunwind.a"); +- 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-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch b/recipes-devtools/clang/clang/0016-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch deleted file mode 100644 index 04d9da7..0000000 --- a/recipes-devtools/clang/clang/0016-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 9d30864a94bced63a95a1fc300dbfad37a3d6038 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 33037dafb57..ff671fe27d2 100644 ---- a/clang/lib/Driver/ToolChains/Linux.cpp -+++ b/clang/lib/Driver/ToolChains/Linux.cpp -@@ -519,6 +519,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: -@@ -531,6 +532,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/0017-clang-scan-view-needs-python-2.x.patch b/recipes-devtools/clang/clang/0017-clang-scan-view-needs-python-2.x.patch deleted file mode 100644 index 82b016e..0000000 --- a/recipes-devtools/clang/clang/0017-clang-scan-view-needs-python-2.x.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 9ec21455fc581e3755ff59af0828c7f7f9529968 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 6165432e7af..04ad518a60c 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/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch b/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch new file mode 100644 index 0000000..e96ef14 --- /dev/null +++ b/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch @@ -0,0 +1,33 @@ +From 1f320fea9755b4616b12656ffa32191e8fe0aca3 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 11 Dec 2019 10:23:15 -0800 +Subject: [PATCH] libclang: Use CMAKE_DL_LIBS for deducing libdl + +This helps in getting right settings for libdl irrespective of platform +it also fixes build with -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON + +Fixes + +tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexer.cpp.o: In function clang::CIndexer::getClangResourcesPath[abi:cxx11]()': 2019-12-06T06:04:39.2987601Z | CIndexer.cpp:(.text._ZN5clang8CIndexer21getClangResourcesPathB5cxx11Ev+0x8b): undefined reference to dladdr' + +Signed-off-by: Khem Raj +--- + clang/tools/libclang/CMakeLists.txt | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt +index bd0c945a5e1..723fa95f14b 100644 +--- a/clang/tools/libclang/CMakeLists.txt ++++ b/clang/tools/libclang/CMakeLists.txt +@@ -60,9 +60,8 @@ if (TARGET clangTidyPlugin) + endif() + endif () + +-find_library(DL_LIBRARY_PATH dl) +-if (DL_LIBRARY_PATH) +- list(APPEND LIBS dl) ++if (HAVE_LIBDL) ++ list(APPEND LIBS ${CMAKE_DL_LIBS}) + endif() + + option(LIBCLANG_BUILD_STATIC diff --git a/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch b/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch new file mode 100644 index 0000000..0546bf5 --- /dev/null +++ b/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch @@ -0,0 +1,23 @@ +From af836c13a28a7537170a59343c96eb34d2b4e7fe 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 8a6e880c4e2..259211df18e 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/0018-clang-Initial-implementation-of-fmacro-prefix-map-an.patch b/recipes-devtools/clang/clang/0018-clang-Initial-implementation-of-fmacro-prefix-map-an.patch deleted file mode 100644 index b9e67d4..0000000 --- a/recipes-devtools/clang/clang/0018-clang-Initial-implementation-of-fmacro-prefix-map-an.patch +++ /dev/null @@ -1,380 +0,0 @@ -From 3a6bf36829e16fd7ab1c2eb6b93ed6caa8210cd1 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 15 Feb 2019 10:02:52 -0800 -Subject: [PATCH] clang: Initial implementation of -fmacro-prefix-map and - -ffile-prefix-map - -Upstream-Status: Submitted [https://reviews.llvm.org/D49466] -Signed-off-by: Khem Raj ---- - .../clang/Basic/DiagnosticDriverKinds.td | 4 +- - clang/include/clang/Driver/Options.td | 6 +++ - clang/include/clang/Lex/PreprocessorOptions.h | 3 ++ - clang/lib/CodeGen/CGDebugInfo.cpp | 9 +++-- - clang/lib/CodeGen/CGDebugInfo.h | 2 +- - clang/lib/Driver/ToolChains/Clang.cpp | 20 +++++++++- - clang/lib/Driver/ToolChains/FreeBSD.cpp | 14 +++++++ - clang/lib/Driver/ToolChains/Gnu.cpp | 12 ++++++ - clang/lib/Frontend/CompilerInvocation.cpp | 3 ++ - clang/lib/Lex/PPMacroExpansion.cpp | 13 ++++++- - clang/test/CodeGen/debug-prefix-map.c | 2 + - clang/test/Driver/debug-prefix-map.S | 1 + - clang/test/Driver/debug-prefix-map.c | 37 ++++++++++++++----- - clang/test/Preprocessor/file_test.c | 22 +++++++++++ - clang/test/Preprocessor/file_test.h | 2 + - 15 files changed, 132 insertions(+), 18 deletions(-) - create mode 100644 clang/test/Preprocessor/file_test.c - create mode 100644 clang/test/Preprocessor/file_test.h - -diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td -index 12f1a7f6c48..0f8e94dad66 100644 ---- a/clang/include/clang/Basic/DiagnosticDriverKinds.td -+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td -@@ -141,8 +141,8 @@ def err_drv_missing_arg_mtp : Error< - "missing argument to '%0'">; - def err_drv_invalid_libcxx_deployment : Error< - "invalid deployment target for -stdlib=libc++ (requires %0 or later)">; --def err_drv_invalid_argument_to_fdebug_prefix_map : Error< -- "invalid argument '%0' to -fdebug-prefix-map">; -+def err_drv_invalid_argument_to_option : Error< -+ "invalid argument '%0' to -%1">; - def err_drv_malformed_sanitizer_blacklist : Error< - "malformed sanitizer blacklist: '%0'">; - def err_drv_duplicate_config : Error< -diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td -index 4ea8bfff097..cf73c9ca465 100644 ---- a/clang/include/clang/Driver/Options.td -+++ b/clang/include/clang/Driver/Options.td -@@ -1866,10 +1866,16 @@ def fsplit_dwarf_inlining: Flag <["-"], "fsplit-dwarf-inlining">, Group - Flags<[CC1Option]>, HelpText<"Provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF">; - def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, Group, - Flags<[CC1Option]>; -+def ffile_prefix_map_EQ -+ : Joined<["-"], "ffile-prefix-map=">, Group, Flags<[CC1Option]>, -+ HelpText<"remap file source paths in debug info and predefined preprocessor macros">; - def fdebug_prefix_map_EQ - : Joined<["-"], "fdebug-prefix-map=">, Group, - Flags<[CC1Option,CC1AsOption]>, - HelpText<"remap file source paths in debug info">; -+def fmacro_prefix_map_EQ -+ : Joined<["-"], "fmacro-prefix-map=">, Group, Flags<[CC1Option]>, -+ HelpText<"remap file source paths in predefined preprocessor macros">; - def g_Flag : Flag<["-"], "g">, Group, - HelpText<"Generate source-level debug information">; - def gline_tables_only : Flag<["-"], "gline-tables-only">, Group, -diff --git a/clang/include/clang/Lex/PreprocessorOptions.h b/clang/include/clang/Lex/PreprocessorOptions.h -index 1480548c7fb..712b423e679 100644 ---- a/clang/include/clang/Lex/PreprocessorOptions.h -+++ b/clang/include/clang/Lex/PreprocessorOptions.h -@@ -169,6 +169,9 @@ public: - /// build it again. - std::shared_ptr FailedModules; - -+ /// A prefix map for __FILE__ and __BASE_FILE__ -+ std::map> MacroPrefixMap; -+ - public: - PreprocessorOptions() : PrecompiledPreambleBytes(0, false) {} - -diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp -index f6ee7ee26d4..8a190558533 100644 ---- a/clang/lib/CodeGen/CGDebugInfo.cpp -+++ b/clang/lib/CodeGen/CGDebugInfo.cpp -@@ -475,10 +475,13 @@ CGDebugInfo::createFile(StringRef FileName, - } - - std::string CGDebugInfo::remapDIPath(StringRef Path) const { -+ SmallString<256> p = Path; - for (const auto &Entry : DebugPrefixMap) -- if (Path.startswith(Entry.first)) -- return (Twine(Entry.second) + Path.substr(Entry.first.size())).str(); -- return Path.str(); -+ if (llvm::sys::path::replace_path_prefix(p, Entry.first, Entry.second)) -+ break; -+ while (llvm::sys::path::is_separator(p.back())) -+ p.set_size(p.size() - 1); -+ return p.str(); - } - - unsigned CGDebugInfo::getLineNumber(SourceLocation Loc) { -diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h -index 7edbea86633..7077d0f043c 100644 ---- a/clang/lib/CodeGen/CGDebugInfo.h -+++ b/clang/lib/CodeGen/CGDebugInfo.h -@@ -83,7 +83,7 @@ class CGDebugInfo { - /// Cache of previously constructed Types. - llvm::DenseMap TypeCache; - -- llvm::SmallDenseMap DebugPrefixMap; -+ std::map> DebugPrefixMap; - - /// Cache that maps VLA types to size expressions for that type, - /// represented by instantiated Metadata nodes. -diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp -index dd461a1976d..08165a60206 100644 ---- a/clang/lib/Driver/ToolChains/Clang.cpp -+++ b/clang/lib/Driver/ToolChains/Clang.cpp -@@ -618,16 +618,30 @@ static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) { - - /// Add a CC1 and CC1AS option to specify the debug file path prefix map. - static void addDebugPrefixMapArg(const Driver &D, const ArgList &Args, ArgStringList &CmdArgs) { -- for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) { -+ for (const Arg *A : Args.filtered(options::OPT_ffile_prefix_map_EQ, -+ options::OPT_fdebug_prefix_map_EQ)) { - StringRef Map = A->getValue(); - if (Map.find('=') == StringRef::npos) -- D.Diag(diag::err_drv_invalid_argument_to_fdebug_prefix_map) << Map; -+ D.Diag(diag::err_drv_invalid_argument_to_option) << Map << A->getOption().getName(); - else - CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); - A->claim(); - } - } - -+/// Add a CC1 and CC1AS option to specify the macro file path prefix map. -+static void addMacroPrefixMapArg(const Driver &D, const ArgList &Args, ArgStringList &CmdArgs) { -+ for (const Arg *A : Args.filtered(options::OPT_ffile_prefix_map_EQ, -+ options::OPT_fmacro_prefix_map_EQ)) { -+ StringRef Map = A->getValue(); -+ if (Map.find('=') == StringRef::npos) -+ D.Diag(diag::err_drv_invalid_argument_to_option) << Map << A->getOption().getName(); -+ else -+ CmdArgs.push_back(Args.MakeArgString("-fmacro-prefix-map=" + Map)); -+ A->claim(); -+ } -+} -+ - /// Vectorize at all optimization levels greater than 1 except for -Oz. - /// For -Oz the loop vectorizer is disabled, while the slp vectorizer is - /// enabled. -@@ -1317,6 +1331,8 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA, - // For IAMCU add special include arguments. - getToolChain().AddIAMCUIncludeArgs(Args, CmdArgs); - } -+ -+ addMacroPrefixMapArg(D, Args, CmdArgs); - } - - // FIXME: Move to target hook. -diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp -index 3a0bab8d07f..6eea9f04620 100644 ---- a/clang/lib/Driver/ToolChains/FreeBSD.cpp -+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp -@@ -12,6 +12,7 @@ - #include "Arch/Sparc.h" - #include "CommonArgs.h" - #include "clang/Driver/Compilation.h" -+#include "clang/Driver/DriverDiagnostic.h" - #include "clang/Driver/Options.h" - #include "clang/Driver/SanitizerArgs.h" - #include "llvm/Option/ArgList.h" -@@ -30,6 +31,7 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, - const char *LinkingOutput) const { - claimNoWarnArgs(Args); - ArgStringList CmdArgs; -+ const auto &D = getToolChain().getDriver(); - - // When building 32-bit code on FreeBSD/amd64, we have to explicitly - // instruct as in the base system to assemble 32-bit code. -@@ -103,6 +105,18 @@ void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA, - } - } - -+ for (const Arg *A : Args.filtered(options::OPT_ffile_prefix_map_EQ, -+ options::OPT_fdebug_prefix_map_EQ)) { -+ StringRef Map = A->getValue(); -+ if (Map.find('=') == StringRef::npos) -+ D.Diag(diag::err_drv_invalid_argument_to_option) << Map << A->getOption().getName(); -+ else { -+ CmdArgs.push_back(Args.MakeArgString("--debug-prefix-map")); -+ CmdArgs.push_back(Args.MakeArgString(Map)); -+ } -+ A->claim(); -+ } -+ - Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler); - - CmdArgs.push_back("-o"); -diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp -index 20517a369f7..ebb315d9c15 100644 ---- a/clang/lib/Driver/ToolChains/Gnu.cpp -+++ b/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -874,6 +874,18 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C, - } - } - -+ for (const Arg *A : Args.filtered(options::OPT_ffile_prefix_map_EQ, -+ options::OPT_fdebug_prefix_map_EQ)) { -+ StringRef Map = A->getValue(); -+ if (Map.find('=') == StringRef::npos) -+ D.Diag(diag::err_drv_invalid_argument_to_option) << Map << A->getOption().getName(); -+ else { -+ CmdArgs.push_back(Args.MakeArgString("--debug-prefix-map")); -+ CmdArgs.push_back(Args.MakeArgString(Map)); -+ } -+ A->claim(); -+ } -+ - Args.AddAllArgs(CmdArgs, options::OPT_I); - Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler); - -diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp -index bc54e38a1a6..ff68adb865d 100644 ---- a/clang/lib/Frontend/CompilerInvocation.cpp -+++ b/clang/lib/Frontend/CompilerInvocation.cpp -@@ -3180,6 +3180,9 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args, - for (const auto *A : Args.filtered(OPT_error_on_deserialized_pch_decl)) - Opts.DeserializedPCHDeclsToErrorOn.insert(A->getValue()); - -+ for (const auto &A : Args.getAllArgValues(OPT_fmacro_prefix_map_EQ)) -+ Opts.MacroPrefixMap.insert(StringRef(A).split('=')); -+ - if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) { - StringRef Value(A->getValue()); - size_t Comma = Value.find(','); -diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp -index 687b9a9d3b7..9fffe35d924 100644 ---- a/clang/lib/Lex/PPMacroExpansion.cpp -+++ b/clang/lib/Lex/PPMacroExpansion.cpp -@@ -28,6 +28,7 @@ - #include "clang/Lex/MacroInfo.h" - #include "clang/Lex/Preprocessor.h" - #include "clang/Lex/PreprocessorLexer.h" -+#include "clang/Lex/PreprocessorOptions.h" - #include "clang/Lex/Token.h" - #include "llvm/ADT/ArrayRef.h" - #include "llvm/ADT/DenseMap.h" -@@ -1436,6 +1437,15 @@ static bool isTargetEnvironment(const TargetInfo &TI, - return TI.getTriple().getEnvironment() == Env.getEnvironment(); - } - -+static void remapMacroPath( -+ SmallString<256> &Path, -+ const std::map> -+ &MacroPrefixMap) { -+ for (const auto &Entry : MacroPrefixMap) -+ if (llvm::sys::path::replace_path_prefix(Path, Entry.first, Entry.second)) -+ break; -+} -+ - /// ExpandBuiltinMacro - If an identifier token is read that is to be expanded - /// as a builtin macro, handle it and return the next token as 'Tok'. - void Preprocessor::ExpandBuiltinMacro(Token &Tok) { -@@ -1502,7 +1512,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { - } - - // Escape this filename. Turn '\' -> '\\' '"' -> '\"' -- SmallString<128> FN; -+ SmallString<256> FN; - if (PLoc.isValid()) { - // __FILE_NAME__ is a Clang-specific extension that expands to the - // the last part of __FILE__. -@@ -1518,6 +1528,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { - FN += PLoc.getFilename(); - } - Lexer::Stringify(FN); -+ remapMacroPath(FN, PPOpts->MacroPrefixMap); - OS << '"' << FN << '"'; - } - Tok.setKind(tok::string_literal); -diff --git a/clang/test/CodeGen/debug-prefix-map.c b/clang/test/CodeGen/debug-prefix-map.c -index f755ba47a29..e57808f03f9 100644 ---- a/clang/test/CodeGen/debug-prefix-map.c -+++ b/clang/test/CodeGen/debug-prefix-map.c -@@ -2,6 +2,8 @@ - // RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=/UNLIKELY_PATH=empty %s -emit-llvm -o - | FileCheck %s -check-prefix CHECK-EVIL - // RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -main-file-name debug-prefix-map.c | FileCheck %s - // RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty %s -emit-llvm -o - -fdebug-compilation-dir %p | FileCheck %s -check-prefix CHECK-COMPILATION-DIR -+// RUN: %clang -g -fdebug-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s -+// RUN: %clang -g -ffile-prefix-map=%p=/UNLIKELY_PATH/empty -S -c %s -emit-llvm -o - | FileCheck %s - - #include "Inputs/stdio.h" - -diff --git a/clang/test/Driver/debug-prefix-map.S b/clang/test/Driver/debug-prefix-map.S -index 2ba66be0edf..7d12a174797 100644 ---- a/clang/test/Driver/debug-prefix-map.S -+++ b/clang/test/Driver/debug-prefix-map.S -@@ -1,4 +1,5 @@ - // RUN: %clang -### -g -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -+// RUN: %clang -### -g -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s - - // CHECK: cc1as - // CHECK-SAME: -fdebug-prefix-map=old=new -diff --git a/clang/test/Driver/debug-prefix-map.c b/clang/test/Driver/debug-prefix-map.c -index b4f3859f982..f2c87cb7c11 100644 ---- a/clang/test/Driver/debug-prefix-map.c -+++ b/clang/test/Driver/debug-prefix-map.c -@@ -1,9 +1,28 @@ --// RUN: %clang -### -fdebug-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-INVALID --// RUN: %clang -### -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-SIMPLE --// RUN: %clang -### -fdebug-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-COMPLEX --// RUN: %clang -### -fdebug-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-EMPTY -- --// CHECK-INVALID: error: invalid argument 'old' to -fdebug-prefix-map --// CHECK-SIMPLE: fdebug-prefix-map=old=new --// CHECK-COMPLEX: fdebug-prefix-map=old=n=ew --// CHECK-EMPTY: fdebug-prefix-map=old= -+// RUN: %clang -### -fdebug-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-INVALID -+// RUN: %clang -### -fmacro-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-INVALID -+// RUN: %clang -### -ffile-prefix-map=old %s 2>&1 | FileCheck %s -check-prefix CHECK-FILE-INVALID -+ -+// RUN: %clang -### -fdebug-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE -+// RUN: %clang -### -fmacro-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE -+// RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-SIMPLE -+// RUN: %clang -### -ffile-prefix-map=old=new %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-SIMPLE -+ -+// RUN: %clang -### -fdebug-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX -+// RUN: %clang -### -fmacro-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX -+// RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-COMPLEX -+// RUN: %clang -### -ffile-prefix-map=old=n=ew %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-COMPLEX -+ -+// RUN: %clang -### -fdebug-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY -+// RUN: %clang -### -fmacro-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY -+// RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-DEBUG-EMPTY -+// RUN: %clang -### -ffile-prefix-map=old= %s 2>&1 | FileCheck %s -check-prefix CHECK-MACRO-EMPTY -+ -+// CHECK-DEBUG-INVALID: error: invalid argument 'old' to -fdebug-prefix-map -+// CHECK-MACRO-INVALID: error: invalid argument 'old' to -fmacro-prefix-map -+// CHECK-FILE-INVALID: error: invalid argument 'old' to -ffile-prefix-map -+// CHECK-DEBUG-SIMPLE: fdebug-prefix-map=old=new -+// CHECK-MACRO-SIMPLE: fmacro-prefix-map=old=new -+// CHECK-DEBUG-COMPLEX: fdebug-prefix-map=old=n=ew -+// CHECK-MACRO-COMPLEX: fmacro-prefix-map=old=n=ew -+// CHECK-DEBUG-EMPTY: fdebug-prefix-map=old= -+// CHECK-MACRO-EMPTY: fmacro-prefix-map=old= -diff --git a/clang/test/Preprocessor/file_test.c b/clang/test/Preprocessor/file_test.c -new file mode 100644 -index 00000000000..bdc5f1df659 ---- /dev/null -+++ b/clang/test/Preprocessor/file_test.c -@@ -0,0 +1,22 @@ -+// RUN: %clang -E -ffile-prefix-map=%p=/UNLIKELY_PATH/empty -c -o - %s | FileCheck %s -+// RUN: %clang -E -fmacro-prefix-map=%p=/UNLIKELY_PATH/empty -c -o - %s | FileCheck %s -+// RUN: %clang -E -fmacro-prefix-map=%p=/UNLIKELY_PATH=empty -c -o - %s | FileCheck %s -check-prefix CHECK-EVIL -+// RUN: %clang -E -fmacro-prefix-map=%p/= -c -o - %s | FileCheck %s --check-prefix CHECK-REMOVE -+ -+filename: __FILE__ -+#include "file_test.h" -+ -+// CHECK: filename: "/UNLIKELY_PATH/empty{{[/\\]}}file_test.c" -+// CHECK: filename: "/UNLIKELY_PATH/empty{{[/\\]}}file_test.h" -+// CHECK: basefile: "/UNLIKELY_PATH/empty{{[/\\]}}file_test.c" -+// CHECK-NOT: filename: -+ -+// CHECK-EVIL: filename: "/UNLIKELY_PATH=empty{{[/\\]}}file_test.c" -+// CHECK-EVIL: filename: "/UNLIKELY_PATH=empty{{[/\\]}}file_test.h" -+// CHECK-EVIL: basefile: "/UNLIKELY_PATH=empty{{[/\\]}}file_test.c" -+// CHECK-EVIL-NOT: filename: -+ -+// CHECK-REMOVE: filename: "file_test.c" -+// CHECK-REMOVE: filename: "file_test.h" -+// CHECK-REMOVE: basefile: "file_test.c" -+// CHECK-REMOVE-NOT: filename: -diff --git a/clang/test/Preprocessor/file_test.h b/clang/test/Preprocessor/file_test.h -new file mode 100644 -index 00000000000..c289e5c8362 ---- /dev/null -+++ b/clang/test/Preprocessor/file_test.h -@@ -0,0 +1,2 @@ -+filename: __FILE__ -+basefile: __BASE_FILE__ diff --git a/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch b/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch new file mode 100644 index 0000000..d552d9c --- /dev/null +++ b/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch @@ -0,0 +1,32 @@ +From b6594af3414070fae4d2fd66a1b92a31c5fd3234 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 29f3bdd57f0..6460842cf63 100644 +--- a/llvm/cmake/modules/CheckAtomic.cmake ++++ b/llvm/cmake/modules/CheckAtomic.cmake +@@ -26,9 +26,10 @@ 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); +- return 0; ++ return int(y); + } + " ${varname}) + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) diff --git a/recipes-devtools/clang/clang/0019-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch b/recipes-devtools/clang/clang/0019-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch deleted file mode 100644 index 0a023ea..0000000 --- a/recipes-devtools/clang/clang/0019-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a761afb9da0223ec9475288831f35c72c145a905 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 | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp -index 99691cb43dc..92b3bfbd77f 100644 ---- a/clang/lib/Driver/ToolChains/CommonArgs.cpp -+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp -@@ -1185,6 +1185,10 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D, - } - case ToolChain::UNW_CompilerRT: - CmdArgs.push_back("-lunwind"); -+ if (Args.hasArg(options::OPT_static)) { -+ CmdArgs.push_back("-lpthread"); -+ CmdArgs.push_back("-ldl"); -+ } - break; - } - diff --git a/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch b/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch new file mode 100644 index 0000000..29bb041 --- /dev/null +++ b/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch @@ -0,0 +1,313 @@ +From 9fd60731726031748f2640ae9daae10ad479fb81 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 | 14 ++++++++++++-- + clang/lib/Driver/ToolChains/Linux.h | 1 + + 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, 43 insertions(+), 30 deletions(-) + +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index 0a4644dab9f..fb579e7ad60 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -941,8 +941,18 @@ 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; ++} ++ ++unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const { ++ return 2; + } + + bool Linux::isNoExecStackDefault() const { +diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h +index f5518eac218..2d4973cf40c 100644 +--- a/clang/lib/Driver/ToolChains/Linux.h ++++ b/clang/lib/Driver/ToolChains/Linux.h +@@ -37,6 +37,7 @@ public: + bool isPIEDefault() const override; + bool isNoExecStackDefault() const override; + bool IsMathErrnoDefault() const override; ++ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override; + 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 6c2dab26069..c28c5653e34 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 0371bc91c4a..ea89f525121 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 f02f94d8c5a..358917588c7 100644 +--- a/clang/test/Driver/fsanitize.c ++++ b/clang/test/Driver/fsanitize.c +@@ -328,15 +328,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" +@@ -661,12 +661,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 6c872f4255c..f5006d1dd9a 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 44bff6f703a..6575d032f5d 100644 +--- a/clang/test/Driver/hexagon-toolchain-elf.c ++++ b/clang/test/Driver/hexagon-toolchain-elf.c +@@ -470,7 +470,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 77ac05f3094..cb474f32898 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 51227550b52..d01d6627131 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 acc4981a2ee..0d465516762 100644 +--- a/clang/test/Driver/ppc-abi.c ++++ b/clang/test/Driver/ppc-abi.c +@@ -32,11 +32,11 @@ + + // 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-ELFv1-QPX: "-mrelocation-model" "static" + // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx" +-// 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 2ff3a585bda..f923b728c0f 100644 +--- a/clang/test/Driver/riscv32-toolchain.c ++++ b/clang/test/Driver/riscv32-toolchain.c +@@ -76,7 +76,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" +@@ -91,7 +91,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 42cac51de59..42a05e02fcc 100644 +--- a/clang/test/Driver/riscv64-toolchain.c ++++ b/clang/test/Driver/riscv64-toolchain.c +@@ -76,7 +76,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" +@@ -91,7 +91,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 a3e40b50eed..dfffe0d6cf8 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/0020-clang-default-to-lp64d-ABI-and-rv64gc-ISA.patch b/recipes-devtools/clang/clang/0020-clang-default-to-lp64d-ABI-and-rv64gc-ISA.patch deleted file mode 100644 index f9d4733..0000000 --- a/recipes-devtools/clang/clang/0020-clang-default-to-lp64d-ABI-and-rv64gc-ISA.patch +++ /dev/null @@ -1,49 +0,0 @@ -From a11464585a13998f97e837a62b299bf66e2f90f0 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 12 Aug 2019 08:59:28 -0700 -Subject: [PATCH] clang: default to lp64d ABI and rv64gc ISA - -Signed-off-by: Khem Raj ---- - clang/lib/Driver/ToolChains/Arch/RISCV.cpp | 9 ++++++++- - clang/lib/Driver/ToolChains/Clang.cpp | 2 +- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp -index b6768de4d29..9671ea270ef 100644 ---- a/clang/lib/Driver/ToolChains/Arch/RISCV.cpp -+++ b/clang/lib/Driver/ToolChains/Arch/RISCV.cpp -@@ -350,6 +350,13 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const ArgList &Args, - - // Handle all other types of extensions. - getExtensionFeatures(D, Args, Features, MArch, OtherExts); -+ } else { -+ // Default to imafdc aka gc -+ Features.push_back("+m"); -+ Features.push_back("+a"); -+ Features.push_back("+f"); -+ Features.push_back("+d"); -+ Features.push_back("+c"); - } - - // -mrelax is default, unless -mno-relax is specified. -@@ -375,5 +382,5 @@ StringRef riscv::getRISCVABI(const ArgList &Args, const llvm::Triple &Triple) { - if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) - return A->getValue(); - -- return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32" : "lp64"; -+ return Triple.getArch() == llvm::Triple::riscv32 ? "ilp32" : "lp64d"; - } -diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp -index 08165a60206..c6882f74e93 100644 ---- a/clang/lib/Driver/ToolChains/Clang.cpp -+++ b/clang/lib/Driver/ToolChains/Clang.cpp -@@ -1878,7 +1878,7 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args, - else if (Triple.getArch() == llvm::Triple::riscv32) - ABIName = "ilp32"; - else if (Triple.getArch() == llvm::Triple::riscv64) -- ABIName = "lp64"; -+ ABIName = "lp64d"; - else - llvm_unreachable("Unexpected triple!"); - diff --git a/recipes-devtools/clang/clang/0021-RISCV-Add-support-for-floating-point-registers-in-in.patch b/recipes-devtools/clang/clang/0021-RISCV-Add-support-for-floating-point-registers-in-in.patch deleted file mode 100644 index b36d260..0000000 --- a/recipes-devtools/clang/clang/0021-RISCV-Add-support-for-floating-point-registers-in-in.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 19de4c98078a98a0663e945d419fa2147a70fe9c Mon Sep 17 00:00:00 2001 -From: Simon Cook -Date: Wed, 31 Jul 2019 09:12:00 +0000 -Subject: [PATCH] [RISCV] Add support for floating point registers in inlineasm - -This adds support for parsing/emitting in IR the floating-point RISC-V -registers in inline assembly clobber lists. - -Differential Revision: https://reviews.llvm.org/D64737 - -llvm-svn: 367399 ---- - clang/lib/Basic/Targets/RISCV.cpp | 33 ++++++++++++++++++++++--------- - clang/test/Sema/riscv-asm.c | 28 ++++++++++++++++++++++++++ - 2 files changed, 52 insertions(+), 9 deletions(-) - create mode 100644 clang/test/Sema/riscv-asm.c - -diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp -index 930b825e94d..d1166d90df4 100644 ---- a/clang/lib/Basic/Targets/RISCV.cpp -+++ b/clang/lib/Basic/Targets/RISCV.cpp -@@ -19,23 +19,38 @@ using namespace clang::targets; - - ArrayRef RISCVTargetInfo::getGCCRegNames() const { - static const char *const GCCRegNames[] = { -+ // Integer registers - "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", - "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15", - "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", -- "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31"}; -+ "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31", -+ -+ // Floating point registers -+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", -+ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", -+ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", -+ "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"}; - return llvm::makeArrayRef(GCCRegNames); - } - - ArrayRef RISCVTargetInfo::getGCCRegAliases() const { - static const TargetInfo::GCCRegAlias GCCRegAliases[] = { -- {{"zero"}, "x0"}, {{"ra"}, "x1"}, {{"sp"}, "x2"}, {{"gp"}, "x3"}, -- {{"tp"}, "x4"}, {{"t0"}, "x5"}, {{"t1"}, "x6"}, {{"t2"}, "x7"}, -- {{"s0"}, "x8"}, {{"s1"}, "x9"}, {{"a0"}, "x10"}, {{"a1"}, "x11"}, -- {{"a2"}, "x12"}, {{"a3"}, "x13"}, {{"a4"}, "x14"}, {{"a5"}, "x15"}, -- {{"a6"}, "x16"}, {{"a7"}, "x17"}, {{"s2"}, "x18"}, {{"s3"}, "x19"}, -- {{"s4"}, "x20"}, {{"s5"}, "x21"}, {{"s6"}, "x22"}, {{"s7"}, "x23"}, -- {{"s8"}, "x24"}, {{"s9"}, "x25"}, {{"s10"}, "x26"}, {{"s11"}, "x27"}, -- {{"t3"}, "x28"}, {{"t4"}, "x29"}, {{"t5"}, "x30"}, {{"t6"}, "x31"}}; -+ {{"zero"}, "x0"}, {{"ra"}, "x1"}, {{"sp"}, "x2"}, {{"gp"}, "x3"}, -+ {{"tp"}, "x4"}, {{"t0"}, "x5"}, {{"t1"}, "x6"}, {{"t2"}, "x7"}, -+ {{"s0"}, "x8"}, {{"s1"}, "x9"}, {{"a0"}, "x10"}, {{"a1"}, "x11"}, -+ {{"a2"}, "x12"}, {{"a3"}, "x13"}, {{"a4"}, "x14"}, {{"a5"}, "x15"}, -+ {{"a6"}, "x16"}, {{"a7"}, "x17"}, {{"s2"}, "x18"}, {{"s3"}, "x19"}, -+ {{"s4"}, "x20"}, {{"s5"}, "x21"}, {{"s6"}, "x22"}, {{"s7"}, "x23"}, -+ {{"s8"}, "x24"}, {{"s9"}, "x25"}, {{"s10"}, "x26"}, {{"s11"}, "x27"}, -+ {{"t3"}, "x28"}, {{"t4"}, "x29"}, {{"t5"}, "x30"}, {{"t6"}, "x31"}, -+ {{"ft0"}, "f0"}, {{"ft1"}, "f1"}, {{"ft2"}, "f2"}, {{"ft3"}, "f3"}, -+ {{"ft4"}, "f4"}, {{"ft5"}, "f5"}, {{"ft6"}, "f6"}, {{"ft7"}, "f7"}, -+ {{"fs0"}, "f8"}, {{"fs1"}, "f9"}, {{"fa0"}, "f10"}, {{"fa1"}, "f11"}, -+ {{"fa2"}, "f12"}, {{"fa3"}, "f13"}, {{"fa4"}, "f14"}, {{"fa5"}, "f15"}, -+ {{"fa6"}, "f16"}, {{"fa7"}, "f17"}, {{"fs2"}, "f18"}, {{"fs3"}, "f19"}, -+ {{"fs4"}, "f20"}, {{"fs5"}, "f21"}, {{"fs6"}, "f22"}, {{"fs7"}, "f23"}, -+ {{"fs8"}, "f24"}, {{"fs9"}, "f25"}, {{"fs10"}, "f26"}, {{"fs11"}, "f27"}, -+ {{"ft8"}, "f28"}, {{"ft9"}, "f29"}, {{"ft10"}, "f30"}, {{"ft11"}, "f31"}}; - return llvm::makeArrayRef(GCCRegAliases); - } - -diff --git a/clang/test/Sema/riscv-asm.c b/clang/test/Sema/riscv-asm.c -new file mode 100644 -index 00000000000..82664c01317 ---- /dev/null -+++ b/clang/test/Sema/riscv-asm.c -@@ -0,0 +1,28 @@ -+// RUN: %clang_cc1 %s -triple riscv32 -verify -fsyntax-only -+// RUN: %clang_cc1 %s -triple riscv64 -verify -fsyntax-only -+ -+// expected-no-diagnostics -+ -+void i (void) { -+ asm volatile ("" ::: "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7"); -+ asm volatile ("" ::: "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15"); -+ asm volatile ("" ::: "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23"); -+ asm volatile ("" ::: "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31"); -+ -+ asm volatile ("" ::: "zero", "ra", "sp", "gp", "tp", "t0", "t1", "t2"); -+ asm volatile ("" ::: "s0", "s1", "a0", "a1", "a2", "a3", "a4", "a5"); -+ asm volatile ("" ::: "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7"); -+ asm volatile ("" ::: "s8", "s9", "s10", "s11", "t3", "t4", "t5", "t6"); -+} -+ -+void f (void) { -+ asm volatile ("" ::: "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7"); -+ asm volatile ("" ::: "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"); -+ asm volatile ("" ::: "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23"); -+ asm volatile ("" ::: "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31"); -+ -+ asm volatile ("" ::: "ft0", "ft1", "ft2", "ft3", "ft4", "ft5", "ft6", "ft7"); -+ asm volatile ("" ::: "fs0", "fs1", "fa0", "fa1", "fa2", "fa3", "fa4", "fa5"); -+ asm volatile ("" ::: "fa6", "fa7", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7"); -+ asm volatile ("" ::: "fs8", "fs9", "fs10", "fs11", "ft8", "ft9", "ft10", "ft11"); -+} diff --git a/recipes-devtools/clang/clang/0021-llvm-Add-lz-to-linker-cmdline-if-enabled.patch b/recipes-devtools/clang/clang/0021-llvm-Add-lz-to-linker-cmdline-if-enabled.patch new file mode 100644 index 0000000..8a8d35a --- /dev/null +++ b/recipes-devtools/clang/clang/0021-llvm-Add-lz-to-linker-cmdline-if-enabled.patch @@ -0,0 +1,28 @@ +From d46267d3d548dbfae92f4958090af4567778c4bd Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 4 Jan 2020 01:00:06 -0800 +Subject: [PATCH] llvm: Add -lz to linker cmdline if enabled + +cmake's detection mechanism confuses libz.so during cross build and ends +up linking with libz from build host which could be a different +architecture and fail link + +see +https://reviews.llvm.org/D70764#1803559 + +Signed-off-by: Khem Raj +--- + llvm/lib/Support/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt +index 26332d4f539..8b58516330b 100644 +--- a/llvm/lib/Support/CMakeLists.txt ++++ b/llvm/lib/Support/CMakeLists.txt +@@ -1,5 +1,5 @@ + if(LLVM_ENABLE_ZLIB) +- set(system_libs ${ZLIB_LIBRARY}) ++ set(system_libs z) + endif() + + if( MSVC OR MINGW ) diff --git a/recipes-devtools/clang/clang/0022-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch b/recipes-devtools/clang/clang/0022-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch deleted file mode 100644 index b799916..0000000 --- a/recipes-devtools/clang/clang/0022-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 5864ac955ccfc19fc5a09f68b5a5e9961be18694 Mon Sep 17 00:00:00 2001 -From: Anuj Mittal -Date: Wed, 18 Sep 2019 12:56:58 +0800 -Subject: [PATCH] Pass PYTHON_EXECUTABLE when cross compiling for native build - -Signed-off-by: Anuj Mittal ---- - 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 d6b416131fe..7fae1080df7 100644 ---- a/llvm/cmake/modules/CrossCompile.cmake -+++ b/llvm/cmake/modules/CrossCompile.cmake -@@ -62,6 +62,7 @@ function(llvm_create_cross_target_internal target_name toolchain buildtype) - -DLLVM_ENABLE_PROJECTS="${llvm_enable_projects_arg}" - -DLLVM_EXTERNAL_PROJECTS="${llvm_external_projects_arg}" - -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}" -+ -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" - ${build_type_flags} ${linker_flag} ${external_clang_dir} - WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} - DEPENDS CREATE_LLVM_${target_name} diff --git a/recipes-devtools/clang/clang/0022-libcxx-Add-compiler-runtime-library-to-link-step-for.patch b/recipes-devtools/clang/clang/0022-libcxx-Add-compiler-runtime-library-to-link-step-for.patch new file mode 100644 index 0000000..9cdce5b --- /dev/null +++ b/recipes-devtools/clang/clang/0022-libcxx-Add-compiler-runtime-library-to-link-step-for.patch @@ -0,0 +1,37 @@ +From ecde714829d04ed0a3ee30827e60502aabc516b0 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 120505fe18d..b337fa2e403 100644 +--- a/libcxx/src/CMakeLists.txt ++++ b/libcxx/src/CMakeLists.txt +@@ -160,7 +160,7 @@ if (LIBCXX_ENABLE_SHARED) + if(COMMAND llvm_setup_rpath) + llvm_setup_rpath(cxx_shared) + endif() +- target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES}) ++ target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)") + set_target_properties(cxx_shared + PROPERTIES + COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" +@@ -238,7 +238,7 @@ endif() + # Build the static library. + if (LIBCXX_ENABLE_STATIC) + add_library(cxx_static STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) +- target_link_libraries(cxx_static PRIVATE ${LIBCXX_LIBRARIES}) ++ target_link_libraries(cxx_static 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/0023-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/recipes-devtools/clang/clang/0023-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch new file mode 100644 index 0000000..c97158e --- /dev/null +++ b/recipes-devtools/clang/clang/0023-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch @@ -0,0 +1,140 @@ +From 8c28658ad591489e35690a245f82b519ae37929e 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 577cc11ab01..5c859d86069 100644 +--- a/clang/cmake/modules/AddClang.cmake ++++ b/clang/cmake/modules/AddClang.cmake +@@ -151,15 +151,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}) + +@@ -168,7 +161,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 fce36ba2125..554ad0b4ade 100644 +--- a/llvm/cmake/modules/AddLLVM.cmake ++++ b/llvm/cmake/modules/AddLLVM.cmake +@@ -1033,15 +1033,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}) + +@@ -1052,9 +1045,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) + +@@ -1092,15 +1082,8 @@ macro(add_llvm_utility name) + set_target_properties(${name} PROPERTIES FOLDER "Utils") + if (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}) + +@@ -1109,7 +1092,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 9d2fcd9a793..acdb898149d 100644 +--- a/llvm/cmake/modules/TableGen.cmake ++++ b/llvm/cmake/modules/TableGen.cmake +@@ -161,14 +161,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) +@@ -177,5 +171,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/0023-openmp-Recognise-ARMv7ve-machine-arch.patch b/recipes-devtools/clang/clang/0023-openmp-Recognise-ARMv7ve-machine-arch.patch deleted file mode 100644 index 59ee7b6..0000000 --- a/recipes-devtools/clang/clang/0023-openmp-Recognise-ARMv7ve-machine-arch.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 68d9f584ed5e3b65af21548fb1a9f3547a14cd59 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Sat, 5 Oct 2019 14:47:37 -0700 -Subject: [PATCH] openmp: Recognise ARMv7ve machine arch - --march in clang when set to armv7ve emits __ARM_ARCH_7VE__ internal -define and not __ARM_ARCH_7A__, hence the condition fails and openmp can -not be compiled, this makes sure that __ARM_ARCH_7VE__ is taken into -consideration as KMP_ARCH_ARMV7 as well - -Signed-off-by: Khem Raj ---- - openmp/runtime/src/kmp_platform.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/openmp/runtime/src/kmp_platform.h b/openmp/runtime/src/kmp_platform.h -index e4f2e06b962..335b91f3575 100644 ---- a/openmp/runtime/src/kmp_platform.h -+++ b/openmp/runtime/src/kmp_platform.h -@@ -139,7 +139,7 @@ - #endif - - #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7R__) || \ -- defined(__ARM_ARCH_7A__) -+ defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7VE__) - #define KMP_ARCH_ARMV7 1 - #endif - diff --git a/recipes-devtools/clang/clang/0024-Check-for-atomic-double-intrinsics.patch b/recipes-devtools/clang/clang/0024-Check-for-atomic-double-intrinsics.patch deleted file mode 100644 index 842002e..0000000 --- a/recipes-devtools/clang/clang/0024-Check-for-atomic-double-intrinsics.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 376f2f44fbfb5d08742e478b193a9da667dab9bd 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 9a4cdf12a62..e70ce924df9 100644 ---- a/llvm/cmake/modules/CheckAtomic.cmake -+++ b/llvm/cmake/modules/CheckAtomic.cmake -@@ -26,9 +26,10 @@ 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); -- return 0; -+ return int(y); - } - " ${varname}) - set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS}) diff --git a/recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch b/recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch deleted file mode 100644 index 0d5baab..0000000 --- a/recipes-devtools/clang/clang/0025-llvm-Let-llvm-ar-name-contain-lib.patch +++ /dev/null @@ -1,150 +0,0 @@ -From e709fa8c221d21bce717b22fa4076c94d51f011e Mon Sep 17 00:00:00 2001 -From: Fangrui Song -Date: Tue, 10 Dec 2019 15:56:05 -0800 -Subject: [PATCH] llvm: Let llvm-ar name contain 'lib' - -In cross-compile cases canonical names are created using symlinks but -they fail to execute because the name confuses 'lib' instead of toolname - -In multilib(lib32) case, the arm-pokymllib32-linux-gnueabi-llvm-ar (${TARGET_PREFIX}llvm-ar) gives: -qc: no such file or directory - -Which is because when the llvm-ar symbol link's name contains "lib", it would be considered as llvm-lib: - -Signed-off-by: Fangrui Song -Signed-off-by: Khem Raj ---- - llvm/test/tools/llvm-ar/tool-name.test | 15 ++++++++++++++ - llvm/test/tools/llvm-dlltool/tool-name.test | 13 ++++++++++++ - llvm/test/tools/llvm-lib/tool-name.test | 14 +++++++++++++ - llvm/test/tools/llvm-ranlib/tool-name.test | 13 ++++++++++++ - llvm/tools/llvm-ar/llvm-ar.cpp | 23 ++++++++++++++------- - 5 files changed, 71 insertions(+), 7 deletions(-) - create mode 100644 llvm/test/tools/llvm-ar/tool-name.test - create mode 100644 llvm/test/tools/llvm-dlltool/tool-name.test - create mode 100644 llvm/test/tools/llvm-lib/tool-name.test - create mode 100644 llvm/test/tools/llvm-ranlib/tool-name.test - -diff --git a/llvm/test/tools/llvm-ar/tool-name.test b/llvm/test/tools/llvm-ar/tool-name.test -new file mode 100644 -index 00000000000..cb656d3b47f ---- /dev/null -+++ b/llvm/test/tools/llvm-ar/tool-name.test -@@ -0,0 +1,15 @@ -+## Don't make symlinks on Windows. -+# UNSUPPORTED: system-windows -+ -+# RUN: rm -rf %t -+# RUN: mkdir %t -+# RUN: ln -s llvm-ar %t/llvm-ar-9 -+# RUN: ln -s llvm-ar %t/ar.exe -+# RUN: ln -s llvm-ar %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 -+ -+# RUN: llvm-ar h | FileCheck %s -+# RUN: %t/llvm-ar-9 h | FileCheck %s -+# RUN: %t/ar.exe h | FileCheck %s -+# RUN: %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 h | FileCheck %s -+ -+# CHECK: USAGE: llvm-ar -diff --git a/llvm/test/tools/llvm-dlltool/tool-name.test b/llvm/test/tools/llvm-dlltool/tool-name.test -new file mode 100644 -index 00000000000..e9d8680322d ---- /dev/null -+++ b/llvm/test/tools/llvm-dlltool/tool-name.test -@@ -0,0 +1,13 @@ -+## Don't make symlinks on Windows. -+# UNSUPPORTED: system-windows -+ -+# RUN: rm -rf %t -+# RUN: mkdir %t -+# RUN: ln -s llvm-dlltool %t/dlltool.exe -+# RUN: ln -s llvm-dlltool %t/dlltool-10 -+ -+# RUN: not llvm-dlltool 2>&1 | FileCheck %s -+# RUN: not %t/dlltool.exe 2>&1 | FileCheck %s -+# RUN: not %t/dlltool-10 2>&1 | FileCheck %s -+ -+# CHECK: USAGE: llvm-dlltool -diff --git a/llvm/test/tools/llvm-lib/tool-name.test b/llvm/test/tools/llvm-lib/tool-name.test -new file mode 100644 -index 00000000000..9c0f7b5de73 ---- /dev/null -+++ b/llvm/test/tools/llvm-lib/tool-name.test -@@ -0,0 +1,14 @@ -+## Don't make symlinks on Windows. -+# UNSUPPORTED: system-windows -+ -+# RUN: rm -rf %t -+# RUN: mkdir %t -+## See D44808, MSBuild runs Lib.exe -+# RUN: ln -s llvm-lib %t/Lib.exe -+# RUN: ln -s llvm-lib %t/llvm-lib-10 -+ -+# RUN: llvm-lib '/?' | FileCheck %s -+# RUN: %t/Lib.exe '/?' | FileCheck %s -+# RUN: %t/llvm-lib-10 '/?' | FileCheck %s -+ -+# CHECK: USAGE: llvm-lib -diff --git a/llvm/test/tools/llvm-ranlib/tool-name.test b/llvm/test/tools/llvm-ranlib/tool-name.test -new file mode 100644 -index 00000000000..bd2b4965331 ---- /dev/null -+++ b/llvm/test/tools/llvm-ranlib/tool-name.test -@@ -0,0 +1,13 @@ -+## Don't make symlinks on Windows. -+# UNSUPPORTED: system-windows -+ -+# RUN: rm -rf %t -+# RUN: mkdir %t -+# RUN: ln -s llvm-ranlib %t/llvm-ranlib-9 -+# RUN: ln -s llvm-ranlib %t/ranlib.exe -+ -+# RUN: llvm-ranlib -h | FileCheck %s -+# RUN: %t/llvm-ranlib-9 -h | FileCheck %s -+# RUN: %t/ranlib.exe -h | FileCheck %s -+ -+# CHECK: USAGE: llvm-ranlib -diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp -index 91746d0fab3..a7118371f1e 100644 ---- a/llvm/tools/llvm-ar/llvm-ar.cpp -+++ b/llvm/tools/llvm-ar/llvm-ar.cpp -@@ -11,6 +11,7 @@ - // - //===----------------------------------------------------------------------===// - -+#include "llvm/ADT/StringExtras.h" - #include "llvm/ADT/StringSwitch.h" - #include "llvm/ADT/Triple.h" - #include "llvm/IR/LLVMContext.h" -@@ -1125,16 +1126,24 @@ int main(int argc, char **argv) { - llvm::InitializeAllAsmParsers(); - - Stem = sys::path::stem(ToolName); -- if (Stem.contains_lower("dlltool")) -+ auto Is = [](StringRef Tool) { -+ // We need to recognize the following filenames. -+ // -+ // Lib.exe -> lib (see D44808, MSBuild runs Lib.exe) -+ // dlltool.exe -> dlltool -+ // arm-pokymllib32-linux-gnueabi-llvm-ar-10 -> ar -+ auto I = Stem.rfind_lower(Tool); -+ return I != StringRef::npos && -+ (I + Tool.size() == Stem.size() || !isAlnum(Stem[I + Tool.size()])); -+ }; -+ -+ if (Is("dlltool")) - return dlltoolDriverMain(makeArrayRef(argv, argc)); -- -- if (Stem.contains_lower("ranlib")) -+ if (Is("ranlib")) - return ranlib_main(argc, argv); -- -- if (Stem.contains_lower("lib")) -+ if (Is("lib")) - return libDriverMain(makeArrayRef(argv, argc)); -- -- if (Stem.contains_lower("ar")) -+ if (Is("ar")) - return ar_main(argc, argv); - fail("Not ranlib, ar, lib or dlltool!"); - } diff --git a/recipes-devtools/clang/clang/0026-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch b/recipes-devtools/clang/clang/0026-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch deleted file mode 100644 index 18008c3..0000000 --- a/recipes-devtools/clang/clang/0026-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 9c37e644d96de108d931a6bcce1819a666ae91d8 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Wed, 11 Dec 2019 10:23:15 -0800 -Subject: [PATCH] libclang: Use CMAKE_DL_LIBS for deducing libdl - -This helps in getting right settings for libdl irrespective of platform -it also fixes build with -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON - -Fixes - -tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexer.cpp.o: In function clang::CIndexer::getClangResourcesPath[abi:cxx11]()': 2019-12-06T06:04:39.2987601Z | CIndexer.cpp:(.text._ZN5clang8CIndexer21getClangResourcesPathB5cxx11Ev+0x8b): undefined reference to dladdr' - -Signed-off-by: Khem Raj ---- - clang/tools/libclang/CMakeLists.txt | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt -index 613ead1a36b..9d5cd0ba9df 100644 ---- a/clang/tools/libclang/CMakeLists.txt -+++ b/clang/tools/libclang/CMakeLists.txt -@@ -58,9 +58,8 @@ if (TARGET clangTidyPlugin) - endif() - endif () - --find_library(DL_LIBRARY_PATH dl) --if (DL_LIBRARY_PATH) -- list(APPEND LIBS dl) -+if (HAVE_LIBDL) -+ list(APPEND LIBS ${CMAKE_DL_LIBS}) - endif() - - option(LIBCLANG_BUILD_STATIC diff --git a/recipes-devtools/clang/clang/0027-Fix-sanitizer-common-build-with-glibc-2.31.patch b/recipes-devtools/clang/clang/0027-Fix-sanitizer-common-build-with-glibc-2.31.patch deleted file mode 100644 index 4c05fc6..0000000 --- a/recipes-devtools/clang/clang/0027-Fix-sanitizer-common-build-with-glibc-2.31.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 322766bb272ca8f818fe26a74ac1254a3d2b0201 Mon Sep 17 00:00:00 2001 -From: Evgenii Stepanov -Date: Mon, 25 Nov 2019 13:52:17 -0800 -Subject: [PATCH] Fix sanitizer-common build with glibc 2.31 - -Summary: -As mentioned in D69104, glibc changed ABI recently with the [[ https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2f959dfe849e0646e27403f2e4091536496ac0f0| 2f959dfe ]] change. -D69104 dealt with just 32-bit ARM, but that is just one of the many affected architectures. -E.g. x86_64, i?86, riscv64, sparc 32-bit, s390 31-bit are affected too (and various others). - -This patch instead of adding a long list of further architectures that wouldn't be checked ever next to arm 32-bit changes the structures to match the 2.31 layout and performs the checking on Linux for ipc_perm mode position/size only on non-Linux or on Linux with glibc 2.31 or later. I think this matches what is done for aarch64 already. -If needed, we could list architectures that haven't changed ABI (e.g. powerpc), so that they would be checked even with older glibcs. AFAIK sanitizers don't actually use ipc_perm.mode and -so all they care about is the size and alignment of the whole structure. - -Note, s390 31-bit and arm 32-bit big-endian changed ABI even further, there will now be shmctl with old symbol version and shmctl@@GLIBC_2.31 which will be incompatible. I'm afraid this isn't really solvable unless the sanitizer libraries are symbol versioned and use matching symbol versions to glibc symbols for stuff they intercept, plus use dlvsym. -This patch doesn't try to address that. - -Patch by Jakub Jelinek. - -Reviewers: kcc, eugenis, dvyukov - -Reviewed By: eugenis - -Subscribers: jyknight, kristof.beyls, fedor.sergeev, simoncook, PkmX, s.egerton, steven.zhang, #sanitizers, llvm-commits - -Tags: #sanitizers, #llvm - -Differential Revision: https://reviews.llvm.org/D70662 ---- - .../sanitizer_platform_limits_posix.cc | 5 +++-- - .../sanitizer_platform_limits_posix.h | 15 +-------------- - 2 files changed, 4 insertions(+), 16 deletions(-) - -diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -index b7fa6e8f7e0..abdf7941b5c 100644 ---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc -@@ -1126,8 +1126,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); - CHECK_SIZE_AND_OFFSET(ipc_perm, gid); - CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); - CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); --#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) --/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ -+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) -+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit -+ on many architectures. */ - CHECK_SIZE_AND_OFFSET(ipc_perm, mode); - #endif - -diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h -index f1a4fd7d370..029a209fc03 100644 ---- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h -+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h -@@ -203,26 +203,13 @@ namespace __sanitizer { - u64 __unused1; - u64 __unused2; - #elif defined(__sparc__) --#if defined(__arch64__) - unsigned mode; -- unsigned short __pad1; --#else -- unsigned short __pad1; -- unsigned short mode; - unsigned short __pad2; --#endif - unsigned short __seq; - unsigned long long __unused1; - unsigned long long __unused2; --#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) -- unsigned int mode; -- unsigned short __seq; -- unsigned short __pad1; -- unsigned long __unused1; -- unsigned long __unused2; - #else -- unsigned short mode; -- unsigned short __pad1; -+ unsigned int mode; - unsigned short __seq; - unsigned short __pad2; - #if defined(__x86_64__) && !defined(_LP64) diff --git a/recipes-devtools/clang/clang/0028-Add-libgcc-to-link-step-for-libcxx.patch b/recipes-devtools/clang/clang/0028-Add-libgcc-to-link-step-for-libcxx.patch deleted file mode 100644 index 9316599..0000000 --- a/recipes-devtools/clang/clang/0028-Add-libgcc-to-link-step-for-libcxx.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 397bd558b83ce7ff3ea69c1c8fb6f36c624b9ca6 Mon Sep 17 00:00:00 2001 -From: Jeremy Puhlman -Date: Thu, 16 Jan 2020 21:16:10 +0000 -Subject: [PATCH] Add libgcc to link step for libcxx - -This corrects "undefined reference to __divti3" - -Upstream-Status: Inappropriate [configuration] - -Signed-off-by: Jeremy Puhlman ---- - libcxx/src/CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt -index 31cd24333a5..d8ae826d7f5 100644 ---- a/libcxx/src/CMakeLists.txt -+++ b/libcxx/src/CMakeLists.txt -@@ -234,7 +234,7 @@ if (LIBCXX_ENABLE_SHARED) - llvm_setup_rpath(cxx_shared) - endif() - cxx_link_system_libraries(cxx_shared) -- target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES}) -+ target_link_libraries(cxx_shared PRIVATE ${LIBCXX_LIBRARIES} "$$($$CC --print-libgcc-file-name)") - set_target_properties(cxx_shared - PROPERTIES - COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" --- -2.13.3 - diff --git a/recipes-devtools/clang/clang/0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/recipes-devtools/clang/clang/0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch deleted file mode 100644 index fd27440..0000000 --- a/recipes-devtools/clang/clang/0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch +++ /dev/null @@ -1,138 +0,0 @@ -From b79837a3b7aa677b44110de4e9e7576fa34a96e3 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 | 9 --------- - llvm/cmake/modules/AddLLVM.cmake | 20 -------------------- - llvm/cmake/modules/TableGen.cmake | 8 -------- - 3 files changed, 37 deletions(-) - -diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake -index cbd618e18af..b864c2b2303 100644 ---- a/clang/cmake/modules/AddClang.cmake -+++ b/clang/cmake/modules/AddClang.cmake -@@ -146,15 +146,7 @@ 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}) - -@@ -163,7 +155,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 619e986b8aa..ab4b2234fa5 100644 ---- a/llvm/cmake/modules/AddLLVM.cmake -+++ b/llvm/cmake/modules/AddLLVM.cmake -@@ -898,15 +898,7 @@ 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}) - -@@ -917,9 +909,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) - -@@ -946,15 +935,7 @@ macro(add_llvm_utility name) - set_target_properties(${name} PROPERTIES FOLDER "Utils") - if (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}) - -@@ -963,7 +944,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 36c026b5c0f..c588ce6e38b 100644 ---- a/llvm/cmake/modules/TableGen.cmake -+++ b/llvm/cmake/modules/TableGen.cmake -@@ -148,15 +148,7 @@ macro(add_tablegen target project) - endif() - - if (${project} STREQUAL LLVM 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} - RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR}) - endif() -- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target}) - endmacro() --- -2.17.1 - diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index 16df75c..7b8ca85 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc @@ -15,28 +15,22 @@ SRC_URI = "\ file://0005-compiler-rt-Disable-tsan-on-OE-glibc.patch \ file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch \ file://0007-llvm-allow-env-override-of-exe-path.patch \ - file://0008-llvm-Enhance-path-prefix-mapping.patch \ - file://0009-clang-Enable-SSP-and-PIE-by-default.patch \ - file://0010-clang-driver-Check-sysroot-for-ldso-path.patch \ - file://0011-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch \ - file://0012-clang-musl-ppc-does-not-support-128-bit-long-double.patch \ - file://0013-clang-Prepend-trailing-to-sysroot.patch \ - file://0014-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch \ - file://0015-clang-Define-releative-gcc-installation-dir.patch \ - file://0016-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch \ - file://0017-clang-scan-view-needs-python-2.x.patch \ - file://0018-clang-Initial-implementation-of-fmacro-prefix-map-an.patch \ - file://0019-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \ - file://0020-clang-default-to-lp64d-ABI-and-rv64gc-ISA.patch \ - file://0021-RISCV-Add-support-for-floating-point-registers-in-in.patch \ - file://0022-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \ - file://0023-openmp-Recognise-ARMv7ve-machine-arch.patch \ - file://0024-Check-for-atomic-double-intrinsics.patch \ - file://0025-llvm-Let-llvm-ar-name-contain-lib.patch \ - file://0026-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch \ - file://0027-Fix-sanitizer-common-build-with-glibc-2.31.patch \ - file://0028-Add-libgcc-to-link-step-for-libcxx.patch \ - file://0029-clang-llvm-cmake-Fix-configure-for-packages-using-fi.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-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch \ + file://0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch \ + file://0019-Check-for-atomic-double-intrinsics.patch \ + file://0020-clang-Enable-SSP-and-PIE-by-default.patch \ + file://0021-llvm-Add-lz-to-linker-cmdline-if-enabled.patch \ + file://0022-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \ + file://0023-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \ " # Fallback to no-PIE if not set -- cgit v1.2.3-54-g00ecf