1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
From f336b9d079e5576ce6d98bb1650002eb107b824a Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Tue, 7 Dec 2021 04:55:48 +0000
Subject: [PATCH] Correct library search path for OpenEmbedded Host
For OpenEmbedded Host, the gcc install path is
/usr/lib/x86_64-[distroname]-linux/[gcc-version].
So the library search path is not found with default triple
'x86_64-linux-gnu' for x86_64. Causing following error:
[snip]
compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang
-target x86_64-linux
-isystem/path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/include
-O2 -pipe
/path/to/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/share/cmake-3.21/Modules/CMakeCCompilerABI.c`
| /build/tmp-glibc/hosttools/ld: cannot find -lgcc
| /build/tmp-glibc/hosttools/ld: cannot find -lgcc
| clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
[snip]
before this patch:
b59da142f2b0:$ /path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang --print-search-dirs
programs: =/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
libraries: =/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/lib/clang/13.0.1:/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/../lib://lib://usr/lib
after this patch:
b59da142f2b0:$ /path/to/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/clang --print-search-dirs
programs: =/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin
libraries: =/build/tmp-glibc/work/x84_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/lib/clang/13.0.1:/usr/lib/x86_64-wrs-linux/10.2.0://lib/x86_64-wrs-linux://usr/lib/x86_64-wrs-linux:/build/tmp-glibc/work/x86_64-linux/compiler-rt-native/13.0.1-r0/recipe-sysroot-native/usr/bin/../lib://lib://usr/lib
Upstream-Status: Inappropriate [oe specific]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
clang/include/clang/Driver/Distro.h | 2 ++
clang/lib/Driver/Distro.cpp | 1 +
clang/lib/Driver/ToolChains/Linux.cpp | 1 +
3 files changed, 4 insertions(+)
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
index 01d66b30b038..4d5aa366a005 100644
--- a/clang/include/clang/Driver/Distro.h
+++ b/clang/include/clang/Driver/Distro.h
@@ -45,6 +45,7 @@ public:
RHEL7,
Fedora,
Gentoo,
+ //CLANG_EXTRA_OE_DISTRO_NAME
OpenSUSE,
UbuntuHardy,
UbuntuIntrepid,
@@ -134,6 +135,7 @@ public:
bool IsGentoo() const { return DistroVal == Gentoo; }
+ //CLANG_EXTRA_OE_DISTRO_CHECK
/// @}
};
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
index 1898667279cc..ab7bc8d45ac1 100644
--- a/clang/lib/Driver/Distro.cpp
+++ b/clang/lib/Driver/Distro.cpp
@@ -44,6 +44,7 @@ static Distro::DistroType DetectOsRelease(llvm::vfs::FileSystem &VFS) {
.Case("sles", Distro::OpenSUSE)
.Case("opensuse", Distro::OpenSUSE)
.Case("exherbo", Distro::Exherbo)
+ //CLANG_EXTRA_OE_DISTRO_CASE
.Default(Distro::UnknownDistro);
return Version;
}
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index aac45650f97b..3c4034ea4921 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -77,6 +77,7 @@ std::string Linux::getMultiarchTriple(const Driver &D,
return "x86_64-linux-android";
if (TargetEnvironment == llvm::Triple::GNUX32)
return "x86_64-linux-gnux32";
+ //CLANG_EXTRA_OE_DISTRO_TRIPLE
return "x86_64-linux-gnu";
case llvm::Triple::aarch64:
if (IsAndroid)
|