diff options
Diffstat (limited to 'recipes-devtools/clang/clang/0025-Fix-lib-paths-for-OpenEmbedded-Host.patch')
-rw-r--r-- | recipes-devtools/clang/clang/0025-Fix-lib-paths-for-OpenEmbedded-Host.patch | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/recipes-devtools/clang/clang/0025-Fix-lib-paths-for-OpenEmbedded-Host.patch b/recipes-devtools/clang/clang/0025-Fix-lib-paths-for-OpenEmbedded-Host.patch new file mode 100644 index 0000000..4b2f0ce --- /dev/null +++ b/recipes-devtools/clang/clang/0025-Fix-lib-paths-for-OpenEmbedded-Host.patch | |||
@@ -0,0 +1,79 @@ | |||
1 | From 9fb0dd90e8b840117f7639ba1f0d5e0d99c12c89 Mon Sep 17 00:00:00 2001 | ||
2 | From: Changqing Li <changqing.li@windriver.com> | ||
3 | Date: Tue, 7 Dec 2021 04:08:22 +0000 | ||
4 | Subject: [PATCH] Fix lib paths for OpenEmbedded Host | ||
5 | |||
6 | Under OpenEmbedded Host, while building with clang-native, it cannot find | ||
7 | the GCCInstallPath, which causing following error: | ||
8 | [snip] | ||
9 | compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang | ||
10 | -target x86_64-linux | ||
11 | -isystem/path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/include | ||
12 | -O2 -pipe | ||
13 | /path/to/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/share/cmake-3.21/Modules/CMakeCCompilerABI.c` | ||
14 | hosttools/ld: cannot find crtbeginS.o: No such file or directory | ||
15 | [snip] | ||
16 | |||
17 | Before this patch: | ||
18 | compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang | ||
19 | clang version 13.0.1 (https://github.com/llvm/llvm-project 08e3a5ccd952edee36b3c002e3a29c6b1b5153de) | ||
20 | Target: x86_64-unknown-linux-gnu | ||
21 | Thread model: posix | ||
22 | InstalledDir: /build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin | ||
23 | Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.2.0 | ||
24 | |||
25 | After this patch: | ||
26 | compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang | ||
27 | clang version 13.0.1 (https://github.com/llvm/llvm-project 08e3a5ccd952edee36b3c002e3a29c6b1b5153de) | ||
28 | Thread model: posix | ||
29 | InstalledDir: /build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin | ||
30 | Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.2.0 | ||
31 | Found candidate GCC installation: /usr/lib/x86_64-wrs-linux/10.2.0 | ||
32 | Selected GCC installation: /usr/lib/x86_64-wrs-linux/10.2.0 | ||
33 | Candidate multilib: .;@m64 | ||
34 | Selected multilib: .;@m64 | ||
35 | |||
36 | Summary: | ||
37 | For OpenEmbedded Host, sysroots are of the form<sysroot>/usr/lib/<triple>/x.y.z. | ||
38 | Take x86-64 as example, the default triple is x86_64-unknown-linux-gnu. | ||
39 | For clang-native, the target vendor is '-unknown', need to test current distro | ||
40 | to follow above form. | ||
41 | |||
42 | Upstream-Status: Inappropriate [oe specific] | ||
43 | |||
44 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
45 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
46 | --- | ||
47 | clang/lib/Driver/ToolChains/Gnu.cpp | 5 ++++- | ||
48 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
49 | |||
50 | diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp | ||
51 | index 822a550de2a5..f081a778cfe9 100644 | ||
52 | --- a/clang/lib/Driver/ToolChains/Gnu.cpp | ||
53 | +++ b/clang/lib/Driver/ToolChains/Gnu.cpp | ||
54 | @@ -19,6 +19,7 @@ | ||
55 | #include "Linux.h" | ||
56 | #include "clang/Config/config.h" // for GCC_INSTALL_PREFIX | ||
57 | #include "clang/Driver/Compilation.h" | ||
58 | +#include "clang/Driver/Distro.h" | ||
59 | #include "clang/Driver/Driver.h" | ||
60 | #include "clang/Driver/DriverDiagnostic.h" | ||
61 | #include "clang/Driver/MultilibBuilder.h" | ||
62 | @@ -2906,6 +2907,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( | ||
63 | const llvm::Triple &TargetTriple, const ArgList &Args, | ||
64 | const std::string &LibDir, StringRef CandidateTriple, | ||
65 | bool NeedsBiarchSuffix, bool GCCDirExists, bool GCCCrossDirExists) { | ||
66 | + Distro Distro(D.getVFS(), TargetTriple); | ||
67 | // Locations relative to the system lib directory where GCC's triple-specific | ||
68 | // directories might reside. | ||
69 | struct GCCLibSuffix { | ||
70 | @@ -2923,7 +2925,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( | ||
71 | // files in that location, not just GCC installation data. | ||
72 | {CandidateTriple.str(), "..", | ||
73 | TargetTriple.getVendor() == llvm::Triple::Freescale || | ||
74 | - TargetTriple.getVendor() == llvm::Triple::OpenEmbedded}, | ||
75 | + TargetTriple.getVendor() == llvm::Triple::OpenEmbedded || | ||
76 | + Distro.IsOpenEmbedded()}, | ||
77 | |||
78 | // This is the normal place. | ||
79 | {"gcc/" + CandidateTriple.str(), "../..", GCCDirExists}, | ||