summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0025-Fix-lib-paths-for-OpenEmbedded-Host.patch
diff options
context:
space:
mode:
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.patch79
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 @@
1From 9fb0dd90e8b840117f7639ba1f0d5e0d99c12c89 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Tue, 7 Dec 2021 04:08:22 +0000
4Subject: [PATCH] Fix lib paths for OpenEmbedded Host
5
6Under OpenEmbedded Host, while building with clang-native, it cannot find
7the GCCInstallPath, which causing following error:
8[snip]
9compiler-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`
14hosttools/ld: cannot find crtbeginS.o: No such file or directory
15[snip]
16
17Before this patch:
18compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang
19clang version 13.0.1 (https://github.com/llvm/llvm-project 08e3a5ccd952edee36b3c002e3a29c6b1b5153de)
20Target: x86_64-unknown-linux-gnu
21Thread model: posix
22InstalledDir: /build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
23Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.2.0
24
25After this patch:
26compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang
27clang version 13.0.1 (https://github.com/llvm/llvm-project 08e3a5ccd952edee36b3c002e3a29c6b1b5153de)
28Thread model: posix
29InstalledDir: /build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
30Found candidate GCC installation: /usr/lib/gcc/x86_64-wrs-linux/10.2.0
31Found candidate GCC installation: /usr/lib/x86_64-wrs-linux/10.2.0
32Selected GCC installation: /usr/lib/x86_64-wrs-linux/10.2.0
33Candidate multilib: .;@m64
34Selected multilib: .;@m64
35
36Summary:
37For OpenEmbedded Host, sysroots are of the form<sysroot>/usr/lib/<triple>/x.y.z.
38Take x86-64 as example, the default triple is x86_64-unknown-linux-gnu.
39For clang-native, the target vendor is '-unknown', need to test current distro
40to follow above form.
41
42Upstream-Status: Inappropriate [oe specific]
43
44Signed-off-by: Changqing Li <changqing.li@windriver.com>
45Signed-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
50diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
51index 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},