summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0028-Correct-library-search-path-for-OpenEmbedded-Host.patch
blob: fc450540b29d9d1dace45affe653b939141b7d9c (plain)
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 18cf3957bb9a0021059c64dc8e640028be821bc3 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 1aaf93ddb7c4..31f03e327b78 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,
@@ -135,6 +136,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 87a0c5a58511..b607a3f18d1e 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 20c7c7a745be..f5d9b3187cf5 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -78,6 +78,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)