diff options
-rw-r--r-- | recipes-devtools/clang/clang/0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch | 41 | ||||
-rw-r--r-- | recipes-devtools/clang/common.inc | 1 |
2 files changed, 42 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 @@ | |||
1 | From ed3b5d8bb197f01556b42dfc2281693475fd830e Mon Sep 17 00:00:00 2001 | ||
2 | From: Jim Broadus <jbroadus@xevo.com> | ||
3 | Date: Thu, 26 Mar 2020 16:05:53 -0700 | ||
4 | Subject: [PATCH] clang: Fix resource dir location for cross toolchains | ||
5 | |||
6 | When clang looks for the resources directory, it does so based on the binary | ||
7 | location and assumes that the containing directory is a sibling to lib. The | ||
8 | Yocto cross.bbclass defines the default bindir as | ||
9 | ${exec_prefix}/bin/${CROSS_TARGET_SYS_DIR}. ex: /usr/bin/aarch64-poky-linux/. | ||
10 | This causes clang to form a path that looks like /usr/bin/lib/clang/... | ||
11 | |||
12 | As a fix for this, check the parent directory name. If that is "bin", then | ||
13 | use that directory's parent. | ||
14 | |||
15 | Signed-off-by: Jim Broadus <jbroadus@xevo.com> | ||
16 | --- | ||
17 | clang/lib/Driver/Driver.cpp | 8 +++++++- | ||
18 | 1 file changed, 7 insertions(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp | ||
21 | index 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 | -- | ||
40 | 2.24.1 | ||
41 | |||
diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index 89696c2..c45e24c 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc | |||
@@ -30,6 +30,7 @@ SRC_URI = "\ | |||
30 | file://0020-clang-Enable-SSP-and-PIE-by-default.patch \ | 30 | file://0020-clang-Enable-SSP-and-PIE-by-default.patch \ |
31 | file://0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \ | 31 | file://0021-libcxx-Add-compiler-runtime-library-to-link-step-for.patch \ |
32 | file://0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \ | 32 | file://0022-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch \ |
33 | file://0023-clang-Fix-resource-dir-location-for-cross-toolchains.patch \ | ||
33 | " | 34 | " |
34 | 35 | ||
35 | # Fallback to no-PIE if not set | 36 | # Fallback to no-PIE if not set |