summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch')
-rw-r--r--recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch b/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch
new file mode 100644
index 0000000..decab68
--- /dev/null
+++ b/recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch
@@ -0,0 +1,41 @@
1From ed3b5d8bb197f01556b42dfc2281693475fd830e Mon Sep 17 00:00:00 2001
2From: Jim Broadus <jbroadus@xevo.com>
3Date: Thu, 26 Mar 2020 16:05:53 -0700
4Subject: [PATCH] clang: Fix resource dir location for cross toolchains
5
6When clang looks for the resources directory, it does so based on the binary
7location and assumes that the containing directory is a sibling to lib. The
8Yocto cross.bbclass defines the default bindir as
9${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}. ex: /usr/bin/aarch64-poky-linux/.
10This causes clang to form a path that looks like /usr/bin/lib/clang/...
11
12As a fix for this, check the parent directory name. If that is "bin", then
13use that directory's parent.
14
15Signed-off-by: Jim Broadus <jbroadus@xevo.com>
16---
17 clang/lib/Driver/Driver.cpp | 8 +++++++-
18 1 file changed, 7 insertions(+), 1 deletion(-)
19
20diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
21index fb8335a3695..819887944b5 100644
22--- a/clang/lib/Driver/Driver.cpp
23+++ b/clang/lib/Driver/Driver.cpp
24@@ -110,7 +110,13 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath,
25 // With a static-library build of libclang, LibClangPath will contain the
26 // path of the embedding binary, which for LLVM binaries will be in bin/.
27 // ../lib gets us to lib/ in both cases.
28- P = llvm::sys::path::parent_path(Dir);
29+ Dir = llvm::sys::path::parent_path(Dir);
30+
31+ // OE cross toolchains are installed, by default, in a subdir of bin.
32+ if (llvm::sys::path::filename(Dir) == "bin") {
33+ Dir = llvm::sys::path::parent_path(Dir);
34+ }
35+ P = Dir;
36 llvm::sys::path::append(P, Twine("lib") + CLANG_LIBDIR_SUFFIX, "clang",
37 CLANG_VERSION_STRING);
38 }
39--
402.24.1
41