summaryrefslogtreecommitdiffstats
path: root/external/meta-clang/recipes-devtools/clang/clang
diff options
context:
space:
mode:
Diffstat (limited to 'external/meta-clang/recipes-devtools/clang/clang')
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch56
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch)17
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch28
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch)26
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch27
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch42
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch)42
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch65
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch)19
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch44
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch40
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch)35
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch)19
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch61
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch27
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch)21
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch25
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch)21
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch)26
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch)19
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch)21
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch24
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch40
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch33
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch23
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch32
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch (renamed from external/meta-clang/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch)213
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0020-clang-link-libgcc_eh-when-using-compiler-rt.patch24
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch37
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch140
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch41
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch28
-rw-r--r--external/meta-clang/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch69
33 files changed, 829 insertions, 556 deletions
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch b/external/meta-clang/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch
deleted file mode 100644
index 2b06da25..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-clang-driver-Use-lib-for-ldso-on-OE.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From 06033c7fa2d575a9a68b377f5ce9324433c23806 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 21 May 2016 21:52:36 -0700
-Subject: [PATCH 1/8] clang: driver: Use /lib for ldso on OE
-
-OE does not follow the default base_libdir
-that clang has, therefore adjust it for OE
-it wont be able to support multilib since
-in multilib case OE switches the base libdir
-for 64bit to /lib64 instead of /lib
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- lib/Driver/ToolChains/Linux.cpp | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index f8f3623918..e662b6b262 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -566,12 +566,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
- Loader = "ld.so.1";
- break;
- case llvm::Triple::ppc64:
-- LibDir = "lib64";
-+ LibDir = "lib";
- Loader =
- (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
- break;
- case llvm::Triple::ppc64le:
-- LibDir = "lib64";
-+ LibDir = "lib";
- Loader =
- (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
- break;
-@@ -593,7 +593,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
- Loader = "ld-linux.so.2";
- break;
- case llvm::Triple::sparcv9:
-- LibDir = "lib64";
-+ LibDir = "lib";
- Loader = "ld-linux.so.2";
- break;
- case llvm::Triple::systemz:
-@@ -607,7 +607,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
- case llvm::Triple::x86_64: {
- bool X32 = Triple.getEnvironment() == llvm::Triple::GNUX32;
-
-- LibDir = X32 ? "libx32" : "lib64";
-+ LibDir = "lib";
- Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
- break;
- }
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch b/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
index c331e7a7..1a606f43 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0002-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Add-lxml2-to-linker-cmdline-of-xml-is-found.patch
@@ -1,7 +1,7 @@
-From fa140ec90e72da40d49301e674c84854fdac804b Mon Sep 17 00:00:00 2001
+From 9f0c90da3de0706e3dd699ed0eb92744d4d9ea80 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 22 May 2017 17:36:16 -0700
-Subject: [PATCH 2/2] lldb: Add -lxml2 to linker cmdline of xml is found
+Subject: [PATCH] lldb: Add -lxml2 to linker cmdline of xml is found
When cross compiling for systems where static libs
for libxml are not available cmake's detection mechanism
@@ -19,13 +19,13 @@ Fixes
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- source/Host/CMakeLists.txt | 2 +-
+ lldb/source/Host/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/source/Host/CMakeLists.txt b/source/Host/CMakeLists.txt
-index 5a92447ed..22ce6eee4 100644
---- a/source/Host/CMakeLists.txt
-+++ b/source/Host/CMakeLists.txt
+diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt
+index 2e9bb402227..bfad6703c65 100644
+--- a/lldb/source/Host/CMakeLists.txt
++++ b/lldb/source/Host/CMakeLists.txt
@@ -149,7 +149,7 @@ if (APPLE)
list(APPEND EXTRA_LIBS xml2)
else ()
@@ -35,6 +35,3 @@ index 5a92447ed..22ce6eee4 100644
endif()
endif ()
if (HAVE_LIBDL)
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch b/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch
deleted file mode 100644
index 1c42931f..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-lldb-Include-limits.h-for-PATH_MAX-definition.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From ff8d7137ed4d62e9db6d31581822a2ce06d5cbc6 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 18 May 2017 23:12:34 -0700
-Subject: [PATCH 1/2] lldb: Include limits.h for PATH_MAX definition
-
-Helps compiling on musl targets
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- source/Utility/FileSpec.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/source/Utility/FileSpec.cpp b/source/Utility/FileSpec.cpp
-index b6952f7e3..2cedf5d90 100644
---- a/source/Utility/FileSpec.cpp
-+++ b/source/Utility/FileSpec.cpp
-@@ -29,7 +29,7 @@
- #include <assert.h> // for assert
- #include <stdio.h> // for size_t, NULL, snpr...
- #include <string.h> // for strcmp
--
-+#include <limits.h> // for PATH_MAX
- using namespace lldb;
- using namespace lldb_private;
-
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch b/external/meta-clang/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
index 297b56d1..65fb23d6 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch
@@ -1,4 +1,4 @@
-From a122717a9bc31e0ab44197e743aa466711c4bf79 Mon Sep 17 00:00:00 2001
+From a268e2fb21b30cce26f76536bf133b7a706e460f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 27 Aug 2017 10:37:49 -0700
Subject: [PATCH] libcxxabi: Find libunwind headers when
@@ -13,14 +13,14 @@ LIBCXXABI_LIBUNWIND_INCLUDES if its there in environment
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- CMakeLists.txt | 21 +++++++++++----------
+ libcxxabi/CMakeLists.txt | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index d6648ed..12c02f2 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -434,15 +434,10 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
+diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
+index 59d99971a76..b0f51ebee3e 100644
+--- a/libcxxabi/CMakeLists.txt
++++ b/libcxxabi/CMakeLists.txt
+@@ -497,14 +497,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
# Setup Source Code
#===============================================================================
@@ -31,13 +31,12 @@ index d6648ed..12c02f2 100644
-
include_directories(include)
if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
- find_path(
-- LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL
-+ LIBCXXABI_LIBUNWIND_INCLUDES
- libunwind.h
+- find_path(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL libunwind.h
++ find_path(LIBCXXABI_LIBUNWIND_INCLUDES libunwind.h
PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
${LIBCXXABI_LIBUNWIND_PATH}/include
-@@ -454,15 +449,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
+ ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
+@@ -515,15 +510,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
NO_CMAKE_FIND_ROOT_PATH
)
@@ -63,6 +62,3 @@ index d6648ed..12c02f2 100644
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...
add_subdirectory(src)
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/external/meta-clang/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch
deleted file mode 100644
index 868fc3b6..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0003-clang-musl-ppc-does-not-support-128-bit-long-double.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 48fa180df65f7ee63a85dd69fd2c1382609c5e95 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 10 May 2016 02:00:11 -0700
-Subject: [PATCH 3/8] clang: musl/ppc does not support 128-bit long double
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- lib/Basic/Targets/PPC.h | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/lib/Basic/Targets/PPC.h b/lib/Basic/Targets/PPC.h
-index 439c73a0e3..8da698ee21 100644
---- a/lib/Basic/Targets/PPC.h
-+++ b/lib/Basic/Targets/PPC.h
-@@ -328,7 +328,8 @@ public:
- break;
- }
-
-- if (getTriple().getOS() == llvm::Triple::FreeBSD) {
-+ if (getTriple().getOS() == llvm::Triple::FreeBSD
-+ || getTriple().isMusl()) {
- LongDoubleWidth = LongDoubleAlign = 64;
- LongDoubleFormat = &llvm::APFloat::IEEEdouble();
- }
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch b/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch
deleted file mode 100644
index 8f45c2b8..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-Disable-tsan-on-OE-glibc.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From c7d41a6e4dd61733530d2f44c377b91e13004b71 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 18 Jul 2016 08:05:02 +0000
-Subject: [PATCH 3/4] compiler-rt: Disable tsan on OE/glibc
-
-It does not build see
-http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- cmake/config-ix.cmake | 2 +-
- test/sanitizer_common/CMakeLists.txt | 1 -
- 2 files changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
-index f3935ffd6..2c651b756 100644
---- a/cmake/config-ix.cmake
-+++ b/cmake/config-ix.cmake
-@@ -564,7 +564,7 @@ else()
- endif()
-
- if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
-- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD")
-+ OS_NAME MATCHES "Darwin|FreeBSD|Android|NetBSD")
- set(COMPILER_RT_HAS_TSAN TRUE)
- else()
- set(COMPILER_RT_HAS_TSAN FALSE)
-diff --git a/test/sanitizer_common/CMakeLists.txt b/test/sanitizer_common/CMakeLists.txt
-index 4e2c80390..990315f11 100644
---- a/test/sanitizer_common/CMakeLists.txt
-+++ b/test/sanitizer_common/CMakeLists.txt
-@@ -8,7 +8,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|SunOS")
- list(APPEND SUPPORTED_TOOLS asan)
- endif()
- if(CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID))
-- list(APPEND SUPPORTED_TOOLS tsan)
- list(APPEND SUPPORTED_TOOLS msan)
- list(APPEND SUPPORTED_TOOLS ubsan)
- endif()
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch b/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch
index 8b0c9feb..4c8bc631 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-compiler-rt-support-a-new-embedded-linux-target.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0003-compiler-rt-support-a-new-embedded-linux-target.patch
@@ -1,36 +1,35 @@
-From 8b0d5d19e8ebec9b6508b51701cb0c64069091cb Mon Sep 17 00:00:00 2001
+From 57ba81bfe82f18899b1c846bee6276b1b43ce4cf Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 19 Apr 2015 15:16:23 -0700
-Subject: [PATCH 1/4] compiler-rt: support a new embedded linux target
+Subject: [PATCH] compiler-rt: support a new embedded linux target
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/builtins/int_util.c | 3 +-
- make/platform/clang_linux_embedded.mk | 286 ++++++++++++++++++
+ compiler-rt/lib/builtins/int_util.c | 2 +-
+ .../make/platform/clang_linux_embedded.mk | 286 ++++++++++++++++++
.../clang_linux_embedded_test_input.c | 0
- 3 files changed, 287 insertions(+), 2 deletions(-)
- create mode 100644 make/platform/clang_linux_embedded.mk
- create mode 100644 make/platform/clang_linux_embedded_test_input.c
+ 3 files changed, 287 insertions(+), 1 deletion(-)
+ create mode 100644 compiler-rt/make/platform/clang_linux_embedded.mk
+ create mode 100644 compiler-rt/make/platform/clang_linux_embedded_test_input.c
-diff --git a/lib/builtins/int_util.c b/lib/builtins/int_util.c
-index de87410db..0d5b56fe1 100644
---- a/lib/builtins/int_util.c
-+++ b/lib/builtins/int_util.c
-@@ -58,8 +58,7 @@ void compilerrt_abort_impl(const char *file, int line, const char *function) {
+diff --git a/compiler-rt/lib/builtins/int_util.c b/compiler-rt/lib/builtins/int_util.c
+index 226a6e93440..efc977acbb3 100644
+--- a/compiler-rt/lib/builtins/int_util.c
++++ b/compiler-rt/lib/builtins/int_util.c
+@@ -54,7 +54,7 @@ void __compilerrt_abort_impl(const char *file, int line, const char *function) {
#else
- /* Get the system definition of abort() */
+ // Get the system definition of abort()
-#include <stdlib.h>
--
+extern void abort (void) __attribute__ ((__noreturn__));
+
#ifndef _WIN32
__attribute__((weak))
- __attribute__((visibility("hidden")))
-diff --git a/make/platform/clang_linux_embedded.mk b/make/platform/clang_linux_embedded.mk
+diff --git a/compiler-rt/make/platform/clang_linux_embedded.mk b/compiler-rt/make/platform/clang_linux_embedded.mk
new file mode 100644
-index 000000000..d0a890075
+index 00000000000..d0a890075a1
--- /dev/null
-+++ b/make/platform/clang_linux_embedded.mk
++++ b/compiler-rt/make/platform/clang_linux_embedded.mk
@@ -0,0 +1,286 @@
+# These are the functions which clang needs when it is targeting a previous
+# version of the OS. The issue is that the backend may use functions which were
@@ -318,9 +317,6 @@ index 000000000..d0a890075
+
+FUNCTIONS.hard_static.x86_64 := $(FUNCTIONS_X86_64)
+FUNCTIONS.hard_pic.x86_64 := $(FUNCTIONS_X86_64)
-diff --git a/make/platform/clang_linux_embedded_test_input.c b/make/platform/clang_linux_embedded_test_input.c
+diff --git a/compiler-rt/make/platform/clang_linux_embedded_test_input.c b/compiler-rt/make/platform/clang_linux_embedded_test_input.c
new file mode 100644
-index 000000000..e69de29bb
---
-2.20.1
-
+index 00000000000..e69de29bb2d
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch b/external/meta-clang/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch
deleted file mode 100644
index 9f665e36..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0003-llvm-Disable-calls-to-_finite-and-other-glibc-only-f.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From cb1b6f021d2ce82d7d0084758b7efaa3917640f5 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sun, 26 Aug 2018 22:43:19 -0700
-Subject: [PATCH 3/3] llvm: Disable calls to *_finite and other glibc-only
- functions on Musl.
-
-glibc's finite lib calls are generated when possible.
-However, they are not supported on Musl/linux. This change also
-disables other functions not available on Musl.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- lib/Analysis/TargetLibraryInfo.cpp | 29 +++++++++++++++--------------
- 1 file changed, 15 insertions(+), 14 deletions(-)
-
-diff --git a/lib/Analysis/TargetLibraryInfo.cpp b/lib/Analysis/TargetLibraryInfo.cpp
-index 102135fbf31..5bc4d2b47f5 100644
---- a/lib/Analysis/TargetLibraryInfo.cpp
-+++ b/lib/Analysis/TargetLibraryInfo.cpp
-@@ -415,27 +415,28 @@ static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
-
- // The following functions are available on Linux,
- // but Android uses bionic instead of glibc.
-- if (!T.isOSLinux() || T.isAndroid()) {
-+ if (!T.isOSLinux() || T.isAndroid() || T.isMusl()) {
- TLI.setUnavailable(LibFunc_dunder_strdup);
- TLI.setUnavailable(LibFunc_dunder_strtok_r);
- TLI.setUnavailable(LibFunc_dunder_isoc99_scanf);
- TLI.setUnavailable(LibFunc_dunder_isoc99_sscanf);
- TLI.setUnavailable(LibFunc_under_IO_getc);
- TLI.setUnavailable(LibFunc_under_IO_putc);
-- // But, Android has memalign.
-- if (!T.isAndroid())
-+ // But, Android/Musl has memalign.
-+ if (!T.isAndroid() || !T.isMusl() )
- TLI.setUnavailable(LibFunc_memalign);
-- TLI.setUnavailable(LibFunc_fopen64);
-- TLI.setUnavailable(LibFunc_fseeko64);
-- TLI.setUnavailable(LibFunc_fstat64);
-- TLI.setUnavailable(LibFunc_fstatvfs64);
-- TLI.setUnavailable(LibFunc_ftello64);
-- TLI.setUnavailable(LibFunc_lstat64);
-- TLI.setUnavailable(LibFunc_open64);
-- TLI.setUnavailable(LibFunc_stat64);
-- TLI.setUnavailable(LibFunc_statvfs64);
-- TLI.setUnavailable(LibFunc_tmpfile64);
--
-+ if (!T.isMusl()) {
-+ TLI.setUnavailable(LibFunc_fopen64);
-+ TLI.setUnavailable(LibFunc_fseeko64);
-+ TLI.setUnavailable(LibFunc_fstat64);
-+ TLI.setUnavailable(LibFunc_fstatvfs64);
-+ TLI.setUnavailable(LibFunc_ftello64);
-+ TLI.setUnavailable(LibFunc_lstat64);
-+ TLI.setUnavailable(LibFunc_open64);
-+ TLI.setUnavailable(LibFunc_stat64);
-+ TLI.setUnavailable(LibFunc_statvfs64);
-+ TLI.setUnavailable(LibFunc_tmpfile64);
-+ }
- // Relaxed math functions are included in math-finite.h on Linux (GLIBC).
- TLI.setUnavailable(LibFunc_acos_finite);
- TLI.setUnavailable(LibFunc_acosf_finite);
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch b/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
index 2ff903b1..dfbfb53d 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0002-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch
@@ -1,7 +1,7 @@
-From 5ee148af76169aa327bfa0bfc1c2618a68e873fb Mon Sep 17 00:00:00 2001
+From 1ecabb645e30330b82754b133f685d96c3e1ee42 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 19 May 2016 23:11:45 -0700
-Subject: [PATCH 2/4] compiler-rt: Simplify cross-compilation. Don't use
+Subject: [PATCH] compiler-rt: Simplify cross-compilation. Don't use
native-compiled llvm-config.
Note: AddLLVM.cmake does not expose the LLVM source directory.
@@ -16,14 +16,14 @@ https://us.codeaurora.org/patches/quic/llvm/50683/compiler-rt-cross-compilation.
Signed-off-by: Greg Fitzgerald <gregf@codeaurora.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- CMakeLists.txt | 11 ++++++++++-
+ compiler-rt/CMakeLists.txt | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 86ca2b3ef..07d894c8a 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -63,7 +63,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOLEAN
+diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
+index 8d768a404f2..1b1a29dc25a 100644
+--- a/compiler-rt/CMakeLists.txt
++++ b/compiler-rt/CMakeLists.txt
+@@ -74,7 +74,16 @@ set(COMPILER_RT_BAREMETAL_BUILD OFF CACHE BOOL
"Build for a bare-metal target.")
if (COMPILER_RT_STANDALONE_BUILD)
@@ -41,6 +41,3 @@ index 86ca2b3ef..07d894c8a 100644
if (TARGET intrinsics_gen)
# Loading the llvm config causes this target to be imported so place it
# under the appropriate folder in an IDE.
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch b/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch
deleted file mode 100644
index 0356e2a6..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0004-compiler-rt-cmake-mips-Do-not-specify-target-with-OE.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From b29deaeb42a8f56bb5dd72b5a8c3e2c755a6bb9e Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 11 Feb 2017 17:54:33 +0000
-Subject: [PATCH 4/4] compiler-rt: cmake/mips: Do not specify --target with OE
-
-OE already specifies cross compiler correctly, adding this additional
---target confuses the clang driver and it resorts to invoke host assembler
-when using -no-integrated-as
-
-Fixes errors e.g.
-| Assembler messages:
-|
-| Fatal error: invalid -march= option: `mips32r2'
-|
-| clang-4.0: error: assembler command failed with exit code 1
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- cmake/base-config-ix.cmake | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
-index 91fe2494b..789b80628 100644
---- a/cmake/base-config-ix.cmake
-+++ b/cmake/base-config-ix.cmake
-@@ -191,11 +191,11 @@ macro(test_targets)
- # clang's default CPU's. In the 64-bit case, we must also specify the ABI
- # since the default ABI differs between gcc and clang.
- # FIXME: Ideally, we would build the N32 library too.
-- test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu")
-- test_target_arch(mips64el "" "-mips64r2" "--target=mips64el-linux-gnu" "-mabi=64")
-+ test_target_arch(mipsel "" "-mips32r2")
-+ test_target_arch(mips64el "" "-mips64r2" "-mabi=64")
- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
-- test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
-- test_target_arch(mips64 "" "-mips64r2" "--target=mips64-linux-gnu" "-mabi=64")
-+ test_target_arch(mips "" "-mips32r2")
-+ test_target_arch(mips64 "" "-mips64r2" "-mabi=64")
- elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm")
- if(WIN32)
- test_target_arch(arm "" "" "")
---
-2.20.1
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch b/external/meta-clang/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch
new file mode 100644
index 00000000..59d774c0
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0005-compiler-rt-Disable-tsan-on-OE-glibc.patch
@@ -0,0 +1,40 @@
+From 7730422bbca50431386391ed341c5d5ed649d14e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 18 Jul 2016 08:05:02 +0000
+Subject: [PATCH] compiler-rt: Disable tsan on OE/glibc
+
+It does not build see
+http://lists.llvm.org/pipermail/llvm-dev/2016-July/102235.html
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ compiler-rt/cmake/config-ix.cmake | 2 +-
+ compiler-rt/test/sanitizer_common/CMakeLists.txt | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
+index 3aad08e8896..a979d38c7a6 100644
+--- a/compiler-rt/cmake/config-ix.cmake
++++ b/compiler-rt/cmake/config-ix.cmake
+@@ -653,7 +653,7 @@ else()
+ endif()
+
+ if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
+- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Android|NetBSD")
++ OS_NAME MATCHES "Darwin|FreeBSD|Android|NetBSD")
+ set(COMPILER_RT_HAS_TSAN TRUE)
+ 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 fcd651ebe42..821de915be8 100644
+--- a/compiler-rt/test/sanitizer_common/CMakeLists.txt
++++ b/compiler-rt/test/sanitizer_common/CMakeLists.txt
+@@ -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.
+-set(SUPPORTED_TOOLS_INIT asan lsan msan tsan ubsan)
++set(SUPPORTED_TOOLS_INIT asan lsan msan ubsan)
+ set(SUPPORTED_TOOLS)
+ foreach(SANITIZER_TOOL ${SUPPORTED_TOOLS_INIT})
+ string(TOUPPER ${SANITIZER_TOOL} SANITIZER_TOOL_UPPER)
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch b/external/meta-clang/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
index de8da745..fd58c681 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0001-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch
@@ -1,22 +1,22 @@
-From fc9904be5d4ee1d1e92a1ff86b01218fbf91b12f Mon Sep 17 00:00:00 2001
+From c3f0b7eb02d4b13400f0cf8d8e77f9e898f189e9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 21 May 2016 00:33:20 +0000
-Subject: [PATCH 1/3] llvm: TargetLibraryInfo: Undefine libc functions if they
- are macros
+Subject: [PATCH] llvm: TargetLibraryInfo: Undefine libc functions if they are
+ macros
musl defines some functions as macros and not inline functions
if this is the case then make sure to undefine them
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- include/llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++++
+ .../llvm/Analysis/TargetLibraryInfo.def | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
-diff --git a/include/llvm/Analysis/TargetLibraryInfo.def b/include/llvm/Analysis/TargetLibraryInfo.def
-index f94debba9c5..e92dbc98c55 100644
---- a/include/llvm/Analysis/TargetLibraryInfo.def
-+++ b/include/llvm/Analysis/TargetLibraryInfo.def
-@@ -707,6 +707,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
+diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
+index afed404f04c..876888656f2 100644
+--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.def
++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.def
+@@ -782,6 +782,9 @@ TLI_DEFINE_STRING_INTERNAL("fmodl")
TLI_DEFINE_ENUM_INTERNAL(fopen)
TLI_DEFINE_STRING_INTERNAL("fopen")
/// FILE *fopen64(const char *filename, const char *opentype)
@@ -25,8 +25,8 @@ index f94debba9c5..e92dbc98c55 100644
+#endif
TLI_DEFINE_ENUM_INTERNAL(fopen64)
TLI_DEFINE_STRING_INTERNAL("fopen64")
- /// int fprintf(FILE *stream, const char *format, ...);
-@@ -751,6 +754,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
+ /// int fork();
+@@ -829,6 +832,9 @@ TLI_DEFINE_STRING_INTERNAL("fseek")
/// int fseeko(FILE *stream, off_t offset, int whence);
TLI_DEFINE_ENUM_INTERNAL(fseeko)
TLI_DEFINE_STRING_INTERNAL("fseeko")
@@ -36,7 +36,7 @@ index f94debba9c5..e92dbc98c55 100644
/// int fseeko64(FILE *stream, off64_t offset, int whence)
TLI_DEFINE_ENUM_INTERNAL(fseeko64)
TLI_DEFINE_STRING_INTERNAL("fseeko64")
-@@ -761,6 +767,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
+@@ -839,6 +845,9 @@ TLI_DEFINE_STRING_INTERNAL("fsetpos")
TLI_DEFINE_ENUM_INTERNAL(fstat)
TLI_DEFINE_STRING_INTERNAL("fstat")
/// int fstat64(int filedes, struct stat64 *buf)
@@ -46,7 +46,7 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(fstat64)
TLI_DEFINE_STRING_INTERNAL("fstat64")
/// int fstatvfs(int fildes, struct statvfs *buf);
-@@ -776,6 +785,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
+@@ -854,6 +863,9 @@ TLI_DEFINE_STRING_INTERNAL("ftell")
TLI_DEFINE_ENUM_INTERNAL(ftello)
TLI_DEFINE_STRING_INTERNAL("ftello")
/// off64_t ftello64(FILE *stream)
@@ -56,7 +56,7 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(ftello64)
TLI_DEFINE_STRING_INTERNAL("ftello64")
/// int ftrylockfile(FILE *file);
-@@ -902,6 +914,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
+@@ -980,6 +992,9 @@ TLI_DEFINE_STRING_INTERNAL("logl")
TLI_DEFINE_ENUM_INTERNAL(lstat)
TLI_DEFINE_STRING_INTERNAL("lstat")
/// int lstat64(const char *path, struct stat64 *buf);
@@ -66,7 +66,7 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(lstat64)
TLI_DEFINE_STRING_INTERNAL("lstat64")
/// void *malloc(size_t size);
-@@ -1127,6 +1142,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
+@@ -1205,6 +1220,9 @@ TLI_DEFINE_STRING_INTERNAL("sscanf")
TLI_DEFINE_ENUM_INTERNAL(stat)
TLI_DEFINE_STRING_INTERNAL("stat")
/// int stat64(const char *path, struct stat64 *buf);
@@ -76,7 +76,7 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(stat64)
TLI_DEFINE_STRING_INTERNAL("stat64")
/// int statvfs(const char *path, struct statvfs *buf);
-@@ -1256,6 +1274,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
+@@ -1340,6 +1358,9 @@ TLI_DEFINE_STRING_INTERNAL("times")
TLI_DEFINE_ENUM_INTERNAL(tmpfile)
TLI_DEFINE_STRING_INTERNAL("tmpfile")
/// FILE *tmpfile64(void)
@@ -86,6 +86,3 @@ index f94debba9c5..e92dbc98c55 100644
TLI_DEFINE_ENUM_INTERNAL(tmpfile64)
TLI_DEFINE_STRING_INTERNAL("tmpfile64")
/// int toascii(int c);
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch b/external/meta-clang/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch
index fa49e677..804cde9e 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0002-llvm-allow-env-override-of-exe-path.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0007-llvm-allow-env-override-of-exe-path.patch
@@ -1,7 +1,7 @@
-From c65c0af4a5721e3c0dfcc56c15ef3310a54e0008 Mon Sep 17 00:00:00 2001
+From f9e72bc861144d8f77505ce833fc0c8397520e9b Mon Sep 17 00:00:00 2001
From: Martin Kelly <mkelly@xevo.com>
Date: Fri, 19 May 2017 00:22:57 -0700
-Subject: [PATCH 2/3] llvm: allow env override of exe path
+Subject: [PATCH] llvm: allow env override of exe path
When using a native llvm-config from inside a sysroot, we need llvm-config to
return the libraries, include directories, etc. from inside the sysroot rather
@@ -11,14 +11,14 @@ llvm-config from a target sysroot.
Signed-off-by: Martin Kelly <mkelly@xevo.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- tools/llvm-config/llvm-config.cpp | 7 +++++++
+ llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++
1 file changed, 7 insertions(+)
-diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
-index 892adc3b9dd..38f190ecbd1 100644
---- a/tools/llvm-config/llvm-config.cpp
-+++ b/tools/llvm-config/llvm-config.cpp
-@@ -226,6 +226,13 @@ Typical components:\n\
+diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
+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\
/// Compute the path to the main executable.
std::string GetExecutablePath(const char *Argv0) {
@@ -32,6 +32,3 @@ index 892adc3b9dd..38f190ecbd1 100644
// This just needs to be some symbol in the binary; C++ doesn't
// allow taking the address of ::main however.
void *P = (void *)(intptr_t)GetExecutablePath;
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch b/external/meta-clang/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch
new file mode 100644
index 00000000..2d0cb1cb
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0008-clang-driver-Check-sysroot-for-ldso-path.patch
@@ -0,0 +1,61 @@
+From 2aa9b771b258b45e7de0bef6a99bcdd248ce3b17 Mon Sep 17 00:00:00 2001
+From: Dan McGregor <dan.mcgregor@usask.ca>
+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 <dan.mcgregor@usask.ca>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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/external/meta-clang/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch b/external/meta-clang/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch
deleted file mode 100644
index c55b309e..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0008-clang-scan-view-needs-python-2.x.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 846e59787ec12b6cd817640151d1f23d3b78d6b5 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Tue, 15 May 2018 10:28:43 -0700
-Subject: [PATCH 8/8] 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 <raj.khem@gmail.com>
----
- tools/scan-view/bin/scan-view | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/scan-view/bin/scan-view b/tools/scan-view/bin/scan-view
-index 1b6e8ba90d..7c5867d1be 100755
---- a/tools/scan-view/bin/scan-view
-+++ b/tools/scan-view/bin/scan-view
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/env python2
-
- """The clang static analyzer results viewer.
- """
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch b/external/meta-clang/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
index f73b1c0f..51ce7208 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0002-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0009-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch
@@ -1,7 +1,7 @@
-From fc628b03a5ac41a446fd2dfea0ecbe03331e54d8 Mon Sep 17 00:00:00 2001
+From 42800fd6bf0040ddd0abf280ea205407e9e004b5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 19 May 2016 21:11:06 -0700
-Subject: [PATCH 2/8] clang: Driver/tools.cpp: Add -lssp_nonshared on musl
+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
@@ -9,14 +9,14 @@ compiler cmdline
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Gnu.cpp | 6 ++++++
+ clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++
1 file changed, 6 insertions(+)
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index 3755673250..766c650b3c 100644
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -503,6 +503,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+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");
@@ -26,9 +26,6 @@ index 3755673250..766c650b3c 100644
+ Args.hasArg(options::OPT_fstack_protector_all))) {
+ CmdArgs.push_back("-lssp_nonshared");
+ }
- if (Args.hasArg(options::OPT_static))
+ if (IsStatic || IsStaticPIE)
CmdArgs.push_back("--end-group");
else
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch b/external/meta-clang/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch
new file mode 100644
index 00000000..2de66187
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0010-clang-musl-ppc-does-not-support-128-bit-long-double.patch
@@ -0,0 +1,25 @@
+From d4719b78a4d59d572b9de7397d8179a5ed7460e9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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/external/meta-clang/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch b/external/meta-clang/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch
index 03c6babf..418afba3 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0004-clang-Prepend-trailing-to-sysroot.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0011-clang-Prepend-trailing-to-sysroot.patch
@@ -1,7 +1,7 @@
-From 4764d8f8b613631de2e3c9a3614427d07c599017 Mon Sep 17 00:00:00 2001
+From 90ac3c6f6407ed40aa76e779ddbcfc0d24c58780 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 16 Mar 2017 09:02:13 -0700
-Subject: [PATCH 4/8] clang: Prepend trailing '/' to sysroot
+Subject: [PATCH] clang: Prepend trailing '/' to sysroot
This is needed to handle a case where clang
isntall and target sysroot are perilously same
@@ -20,22 +20,19 @@ installation and not sysroot
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Linux.cpp | 2 +-
+ clang/lib/Driver/ToolChains/Linux.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index e662b6b262..5bca972cc2 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -211,7 +211,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
- GCCInstallation.init(Triple, Args);
+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
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch b/external/meta-clang/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
index 8425f8d8..9316157d 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0005-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0012-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
@@ -1,8 +1,7 @@
-From e02d9f3e1c724a4161709952a3ef59f81432fc06 Mon Sep 17 00:00:00 2001
+From 805b4ce637faedee91bb92fdae273b01bd5aa363 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 16 Mar 2017 19:06:26 -0700
-Subject: [PATCH 5/8] clang: Look inside the target sysroot for compiler
- runtime
+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
@@ -12,22 +11,22 @@ Specific to cross compiling the way yocto/OE works
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChain.cpp | 6 +++++-
+ clang/lib/Driver/ToolChain.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
-diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
-index cf3db34688..dae3178380 100644
---- a/lib/Driver/ToolChain.cpp
-+++ b/lib/Driver/ToolChain.cpp
-@@ -13,6 +13,7 @@
- #include "ToolChains/Clang.h"
+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/Basic/VirtualFileSystem.h"
#include "clang/Config/config.h"
#include "clang/Driver/Action.h"
-@@ -343,7 +344,10 @@ StringRef ToolChain::getOSLibName() const {
+ #include "clang/Driver/Driver.h"
+@@ -379,7 +380,10 @@ StringRef ToolChain::getOSLibName() const {
}
std::string ToolChain::getCompilerRTPath() const {
@@ -39,6 +38,3 @@ index cf3db34688..dae3178380 100644
if (Triple.isOSUnknown()) {
llvm::sys::path::append(Path, "lib");
} else {
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch b/external/meta-clang/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch
index b611dd50..b1b3f05a 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0006-clang-Define-releative-gcc-installation-dir.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0013-clang-Define-releative-gcc-installation-dir.patch
@@ -1,7 +1,7 @@
-From e6232d22df73b80ced3784fd85166ebe24e6c31b Mon Sep 17 00:00:00 2001
+From 56a43865d296b6b3293cd35f3e4732dac8b00523 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 21 May 2017 15:38:25 -0700
-Subject: [PATCH 6/8] clang: Define / releative gcc installation dir
+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
@@ -10,14 +10,14 @@ installation in OE
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Gnu.cpp | 3 +++
+ clang/lib/Driver/ToolChains/Gnu.cpp | 3 +++
1 file changed, 3 insertions(+)
-diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
-index 766c650b3c..777526e063 100644
---- a/lib/Driver/ToolChains/Gnu.cpp
-+++ b/lib/Driver/ToolChains/Gnu.cpp
-@@ -2190,6 +2190,9 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
+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},
@@ -27,6 +27,3 @@ index 766c650b3c..777526e063 100644
// The Freescale PPC SDK has the gcc libraries in
// <sysroot>/usr/lib/<triple>/x.y.z so have a look there as well. Only do
// this on Freescale triples, though, since some systems put a *lot* of
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch b/external/meta-clang/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
index b456a59d..71c1c528 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0007-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0014-clang-Fix-ldso-for-musl-on-x86-and-x32-architectures.patch
@@ -1,7 +1,7 @@
-From 5840f5a6756f8f67dbba1b47015e75c8c3264b2b Mon Sep 17 00:00:00 2001
+From b11d1668890778d6d55cadeaec4f6c2e291b583b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 16 Aug 2017 15:16:15 -0700
-Subject: [PATCH 7/8] clang: Fix ldso for musl on x86 and x32 architectures
+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
@@ -10,14 +10,14 @@ arch is i586, which is not the right thing
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Linux.cpp | 8 ++++++++
+ clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
-diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index 5bca972cc2..2ca285679c 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -492,6 +492,7 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+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;
@@ -25,7 +25,7 @@ index 5bca972cc2..2ca285679c 100644
switch (Arch) {
case llvm::Triple::arm:
-@@ -504,6 +505,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+@@ -531,6 +532,13 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
ArchName = "armeb";
IsArm = true;
break;
@@ -39,6 +39,3 @@ index 5bca972cc2..2ca285679c 100644
default:
ArchName = Triple.getArchName().str();
}
---
-2.18.0
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch b/external/meta-clang/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch
new file mode 100644
index 00000000..7b762f17
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0015-clang-scan-view-needs-python-2.x.patch
@@ -0,0 +1,24 @@
+From 0f969665b80310b90bcb304b2e60c4493687c5a6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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/external/meta-clang/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch b/external/meta-clang/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
new file mode 100644
index 00000000..b77f4335
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0016-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch
@@ -0,0 +1,40 @@
+From a1fa38408f7524c8452709574b3d83b72ebcfa38 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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/external/meta-clang/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch b/external/meta-clang/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch
new file mode 100644
index 00000000..f5bc7730
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0017-libclang-Use-CMAKE_DL_LIBS-for-deducing-libdl.patch
@@ -0,0 +1,33 @@
+From cfe4473e8447cd2c73a2f42c9c235ce1dfd08bec Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+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 <raj.khem@gmail.com>
+---
+ 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/external/meta-clang/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch b/external/meta-clang/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
new file mode 100644
index 00000000..de92b2fd
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0018-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch
@@ -0,0 +1,23 @@
+From a415287545ffe17f7dbc743a033877fd239856b5 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+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 <anuj.mittal@intel.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch b/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch
new file mode 100644
index 00000000..08856482
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0019-Check-for-atomic-double-intrinsics.patch
@@ -0,0 +1,32 @@
+From dd6a749dee10f537fc7cb558ace319041a63e5f3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 18 Nov 2019 17:00:29 -0800
+Subject: [PATCH] Check for atomic<double> 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<double> if not
+then link libatomic, this helps building clangd for x86 on linux systems
+with gcc runtime
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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 <atomic>
+ #include <cstdint>
+ std::atomic<uint64_t> x (0);
++std::atomic<double> 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/external/meta-clang/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch b/external/meta-clang/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch
index d7b61bb1..39d500cf 100644
--- a/external/meta-clang/recipes-devtools/clang/clang/0009-clang-Enable-SSP-and-PIE-by-default.patch
+++ b/external/meta-clang/recipes-devtools/clang/clang/0020-clang-Enable-SSP-and-PIE-by-default.patch
@@ -1,7 +1,7 @@
-From 594abc54ce652e0490860c96038513cfb576bb92 Mon Sep 17 00:00:00 2001
+From b826518219333760c4632062dc586bbe17a055e6 Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
-Date: Thu, 20 Sep 2018 06:20:28 +0300
-Subject: [PATCH 9/9] clang: Enable SSP and PIE by default
+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
@@ -16,26 +16,31 @@ 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 <raj.khem@gmail.com>
---
- lib/Driver/ToolChains/Linux.cpp | 14 ++++++++++++--
- lib/Driver/ToolChains/Linux.h | 1 +
- test/Driver/clang-offload-bundler.c | 2 +-
- test/Driver/cross-linux.c | 16 ++++++++--------
- test/Driver/env.c | 2 +-
- test/Driver/fsanitize.c | 14 +++++++-------
- test/Driver/gcc-toolchain.cpp | 2 +-
- test/Driver/hexagon-toolchain-elf.c | 2 +-
- test/Driver/linux-as.c | 4 ++--
- test/Driver/linux-ld.c | 2 ++
- test/Driver/riscv32-toolchain.c | 4 ++--
- test/Driver/stack-protector.c | 4 ++--
- 12 files changed, 40 insertions(+), 27 deletions(-)
+ 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/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
-index 2ca285679c..22f1a1da6d 100644
---- a/lib/Driver/ToolChains/Linux.cpp
-+++ b/lib/Driver/ToolChains/Linux.cpp
-@@ -911,8 +911,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
+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 {
@@ -55,36 +60,23 @@ index 2ca285679c..22f1a1da6d 100644
+ return 2;
}
- SanitizerMask Linux::getSupportedSanitizers() const {
-diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h
-index 22dbbecf6b..ba0d5587e0 100644
---- a/lib/Driver/ToolChains/Linux.h
-+++ b/lib/Driver/ToolChains/Linux.h
-@@ -38,6 +38,7 @@ public:
- void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
- llvm::opt::ArgStringList &CC1Args) const override;
+ 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/test/Driver/clang-offload-bundler.c b/test/Driver/clang-offload-bundler.c
-index adf13f59d4..fd2f6e5d8c 100644
---- a/test/Driver/clang-offload-bundler.c
-+++ b/test/Driver/clang-offload-bundler.c
-@@ -115,7 +115,7 @@
- // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLE____END__ openmp-x86_64-pc-linux-gnu
-
- // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____START__ host-powerpc64le-ibm-linux-gnu
--// CK-TEXTLL: @A = global i32 0
-+// CK-TEXTLL: @A = {{(dso_local )?}}global i32 0
- // CK-TEXTLL: define {{.*}}@test_func()
- // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____END__ host-powerpc64le-ibm-linux-gnu
- // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____START__ openmp-powerpc64le-ibm-linux-gnu
-diff --git a/test/Driver/cross-linux.c b/test/Driver/cross-linux.c
-index a5ea832e77..1949c05a60 100644
---- a/test/Driver/cross-linux.c
-+++ b/test/Driver/cross-linux.c
+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]]"
@@ -96,7 +88,7 @@ index a5ea832e77..1949c05a60 100644
// 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"
-@@ -59,8 +59,8 @@
+@@ -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"
@@ -107,7 +99,7 @@ index a5ea832e77..1949c05a60 100644
// 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"
-@@ -77,8 +77,8 @@
+@@ -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"
@@ -118,7 +110,7 @@ index a5ea832e77..1949c05a60 100644
// 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"
-@@ -95,8 +95,8 @@
+@@ -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"
@@ -129,10 +121,10 @@ index a5ea832e77..1949c05a60 100644
// 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/test/Driver/env.c b/test/Driver/env.c
-index 0371bc91c4..ea89f52512 100644
---- a/test/Driver/env.c
-+++ b/test/Driver/env.c
+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:
@@ -142,11 +134,11 @@ index 0371bc91c4..ea89f52512 100644
// 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/test/Driver/fsanitize.c b/test/Driver/fsanitize.c
-index 304e759302..c157f9fc48 100644
---- a/test/Driver/fsanitize.c
-+++ b/test/Driver/fsanitize.c
-@@ -238,15 +238,15 @@
+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
@@ -166,7 +158,7 @@ index 304e759302..c157f9fc48 100644
// CHECK-NO-PIE-NOT: "-pie"
// CHECK-NO-PIE: "-mrelocation-model" "static"
-@@ -585,12 +585,12 @@
+@@ -661,12 +661,12 @@
// RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP
// NOSP-NOT: "-fsanitize=safe-stack"
@@ -182,11 +174,11 @@ index 304e759302..c157f9fc48 100644
// 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/test/Driver/gcc-toolchain.cpp b/test/Driver/gcc-toolchain.cpp
-index ca96757a2b..ae1c25e989 100644
---- a/test/Driver/gcc-toolchain.cpp
-+++ b/test/Driver/gcc-toolchain.cpp
-@@ -24,6 +24,6 @@
+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)?}}"
@@ -194,11 +186,11 @@ index ca96757a2b..ae1c25e989 100644
+// 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/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c
-index 8f4c320ce4..a4d9ae502b 100644
---- a/test/Driver/hexagon-toolchain-elf.c
-+++ b/test/Driver/hexagon-toolchain-elf.c
-@@ -457,7 +457,7 @@
+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"
@@ -207,11 +199,11 @@ index 8f4c320ce4..a4d9ae502b 100644
// CHECK042: "-mllvm" "-hexagon-small-data-threshold=8"
// CHECK042-NEXT: llvm-mc
// CHECK042: "-gpsize=8"
-diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c
-index 68cf403d97..92b556db73 100644
---- a/test/Driver/linux-as.c
-+++ b/test/Driver/linux-as.c
-@@ -133,7 +133,7 @@
+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 -### \
@@ -220,7 +212,7 @@ index 68cf403d97..92b556db73 100644
// RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s
// CHECK-SPARCV9: as
// CHECK-SPARCV9: -64
-@@ -142,7 +142,7 @@
+@@ -173,7 +173,7 @@
// CHECK-SPARCV9: -o
//
// RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
@@ -229,21 +221,39 @@ index 68cf403d97..92b556db73 100644
// RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s
// CHECK-SPARCV9PIC: as
// CHECK-SPARCV9PIC: -64
-diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
-index 787013931a..cba173b354 100644
---- a/test/Driver/linux-ld.c
-+++ b/test/Driver/linux-ld.c
+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/test/Driver/riscv32-toolchain.c b/test/Driver/riscv32-toolchain.c
-index 1e0c750a3f..563493a33b 100644
---- a/test/Driver/riscv32-toolchain.c
-+++ b/test/Driver/riscv32-toolchain.c
-@@ -44,7 +44,7 @@
+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"
@@ -252,7 +262,7 @@ index 1e0c750a3f..563493a33b 100644
// 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"
-@@ -59,7 +59,7 @@
+@@ -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"
@@ -261,10 +271,32 @@ index 1e0c750a3f..563493a33b 100644
// 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/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
-index a3e40b50ee..dfffe0d6cf 100644
---- a/test/Driver/stack-protector.c
-+++ b/test/Driver/stack-protector.c
+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"
@@ -279,6 +311,3 @@ index a3e40b50ee..dfffe0d6cf 100644
// SSP-BUF: "-stack-protector-buffer-size" "16"
// RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD
---
-2.19.2
-
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0020-clang-link-libgcc_eh-when-using-compiler-rt.patch b/external/meta-clang/recipes-devtools/clang/clang/0020-clang-link-libgcc_eh-when-using-compiler-rt.patch
deleted file mode 100644
index d9eac9a6..00000000
--- a/external/meta-clang/recipes-devtools/clang/clang/0020-clang-link-libgcc_eh-when-using-compiler-rt.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-From 98e1067695596c4c4a91f4c58e2a6f6aaeb56a0c Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Sat, 21 Sep 2019 08:57:36 -0700
-Subject: [PATCH] clang: link libgcc_eh when using compiler-rt
-
-we still need libgcc unwinder
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- clang/lib/Driver/ToolChains/CommonArgs.cpp | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
-index 1e093b25b90..4b81ae2b50a 100644
---- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
-+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
-@@ -1162,6 +1162,7 @@ void tools::AddRunTimeLibs(const ToolChain &TC, const Driver &D,
- switch (RLT) {
- case ToolChain::RLT_CompilerRT:
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, "builtins"));
-+ CmdArgs.push_back("-lgcc_eh");
- break;
- case ToolChain::RLT_Libgcc:
- // Make sure libgcc is not used under MSVC environment by default
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch b/external/meta-clang/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
new file mode 100644
index 00000000..ab406d08
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch
@@ -0,0 +1,37 @@
+From 6330360e13936fca5625e39ceed7441b45c3efd3 Mon Sep 17 00:00:00 2001
+From: Jeremy Puhlman <jpuhlman@mvista.com>
+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 <jpuhlman@mvista.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ 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/external/meta-clang/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch b/external/meta-clang/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
new file mode 100644
index 00000000..5413693a
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
@@ -0,0 +1,140 @@
+From 9f5949b795a92f85c98277fd8d72954fb52df164 Mon Sep 17 00:00:00 2001
+From: Ovidiu Panait <ovidiu.panait@windriver.com>
+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 <ovidiu.panait@windriver.com>
+---
+ 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 fd69786544a..70580ccb129 100644
+--- a/llvm/cmake/modules/AddLLVM.cmake
++++ b/llvm/cmake/modules/AddLLVM.cmake
+@@ -1045,15 +1045,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})
+
+@@ -1064,9 +1057,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)
+
+@@ -1104,15 +1094,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})
+
+@@ -1121,7 +1104,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/external/meta-clang/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch b/external/meta-clang/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch
new file mode 100644
index 00000000..decab684
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch
@@ -0,0 +1,41 @@
+From ed3b5d8bb197f01556b42dfc2281693475fd830e Mon Sep 17 00:00:00 2001
+From: Jim Broadus <jbroadus@xevo.com>
+Date: Thu, 26 Mar 2020 16:05:53 -0700
+Subject: [PATCH] clang: Fix resource dir location for cross toolchains
+
+When clang looks for the resources directory, it does so based on the binary
+location and assumes that the containing directory is a sibling to lib. The
+Yocto cross.bbclass defines the default bindir as
+${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}. ex: /usr/bin/aarch64-poky-linux/.
+This causes clang to form a path that looks like /usr/bin/lib/clang/...
+
+As a fix for this, check the parent directory name. If that is "bin", then
+use that directory's parent.
+
+Signed-off-by: Jim Broadus <jbroadus@xevo.com>
+---
+ clang/lib/Driver/Driver.cpp | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
+index fb8335a3695..819887944b5 100644
+--- a/clang/lib/Driver/Driver.cpp
++++ b/clang/lib/Driver/Driver.cpp
+@@ -110,7 +110,13 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
+ // With a static-library build of libclang, LibClangPath will contain the
+ // path of the embedding binary, which for LLVM binaries will be in bin/.
+ // ../lib gets us to lib/ in both cases.
+- P = llvm::sys::path::parent_path(Dir);
++ Dir = llvm::sys::path::parent_path(Dir);
++
++ // OE cross toolchains are installed, by default, in a subdir of bin.
++ if (llvm::sys::path::filename(Dir) == "bin") {
++ Dir = llvm::sys::path::parent_path(Dir);
++ }
++ P = Dir;
+ llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang",
+ CLANG_VERSION_STRING);
+ }
+--
+2.24.1
+
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch b/external/meta-clang/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch
new file mode 100644
index 00000000..28902289
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0024-fix-path-to-libffi.patch
@@ -0,0 +1,28 @@
+From 52b4e74809eba796663f0f65194ab4f3eafe2cb1 Mon Sep 17 00:00:00 2001
+From: Anuj Mittal <anuj.mittal@intel.com>
+Date: Fri, 3 Apr 2020 15:10:37 +0800
+Subject: [PATCH] fix path to libffi
+
+FFI_LIBRARY_PATH is the full path to libffi so when building something that links to
+libLLVMInterpreter, we were looking for libffi in clang's recipe-sysroot instead of
+the recipe's sysroot.
+
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
+index b8adea5..7d8434c 100644
+--- a/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
++++ b/llvm/lib/ExecutionEngine/Interpreter/CMakeLists.txt
+@@ -16,5 +16,5 @@ add_llvm_component_library(LLVMInterpreter
+ )
+
+ if( LLVM_ENABLE_FFI )
+- target_link_libraries( LLVMInterpreter PRIVATE ${FFI_LIBRARY_PATH} )
++ target_link_libraries( LLVMInterpreter PRIVATE ffi )
+ endif()
+--
+2.7.4
+
diff --git a/external/meta-clang/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch b/external/meta-clang/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
new file mode 100644
index 00000000..43161c73
--- /dev/null
+++ b/external/meta-clang/recipes-devtools/clang/clang/0025-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch
@@ -0,0 +1,69 @@
+From fcafd24f9062eeecc9c87ac2fe9bce9accbe7534 Mon Sep 17 00:00:00 2001
+From: Oleksandr Ocheretnyi <oocheret@cisco.com>
+Date: Wed, 15 Apr 2020 00:08:39 +0300
+Subject: [PATCH] clang: driver: Add dyld-prefix when checking sysroot for ldso
+ path
+
+ * the dyld-prefix shall be taken into account when the default
+ path for the dynamic linker has to be checked.
+
+ * this patch shall be used as annex to the next patch:
+ 'clang: driver: Check sysroot for ldso path' which includes
+ the usrmerge scenario.
+
+Signed-off-by: Oleksandr Ocheretnyi <oocheret@cisco.com>
+---
+ clang/lib/Driver/ToolChains/Linux.cpp | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index fb579e7ad60..4ed5938cc59 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -604,8 +604,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ LibDir = "lib64";
+ Loader =
+ (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
+- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
+- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
+ LibDir = "lib";
+ }
+ break;
+@@ -613,8 +613,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ LibDir = "lib64";
+ Loader =
+ (tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
+- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
+- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
+ LibDir = "lib";
+ }
+ break;
+@@ -638,8 +638,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+ case llvm::Triple::sparcv9:
+ LibDir = "lib64";
+ Loader = "ld-linux.so.2";
+- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
+- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
+ LibDir = "lib";
+ }
+ break;
+@@ -656,8 +656,8 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
+
+ LibDir = X32 ? "libx32" : "lib64";
+ Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2";
+- if (!getVFS().exists(getDriver().SysRoot + "/" + LibDir + "/" + Loader) &&
+- getVFS().exists(getDriver().SysRoot + "/lib/" + Loader)) {
++ if (!getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/" + LibDir + "/" + Loader) &&
++ getVFS().exists(getDriver().SysRoot + getDriver().DyldPrefix + "/lib/" + Loader)) {
+ LibDir = "lib";
+ }
+ break;
+--
+2.17.1
+