3
3
Date: Sun, 26 Jun 2022 10:57:51 +0200
4
4
Subject: [PATCH] Clang: SailfishOS toolchain
5
5
6
+ Co-authored-by: Matti Viljanen <
[email protected] >
6
7
Signed-off-by: Ruben De Smet <
[email protected] >
7
8
---
8
9
clang/include/clang/Driver/Distro.h | 5 +++++
9
10
clang/lib/Driver/Distro.cpp | 3 +++
10
11
clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
11
- clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++-- --
12
- 4 files changed, 15 insertions(+), 5 deletions(-)
12
+ clang/lib/Driver/ToolChains/Linux.cpp | 7 +++++ --
13
+ 4 files changed, 16 insertions(+), 3 deletions(-)
13
14
14
15
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
15
- index 2723f75e8945..58616ad541e1 100644
16
+ index 1aaf93ddb7c43ba8202e53288a934f9c76a13e2b..581a1712d9975dfdbd23792da3174644fdbc2d42 100644
16
17
--- a/clang/include/clang/Driver/Distro.h
17
18
+++ b/clang/include/clang/Driver/Distro.h
18
- @@ -45 ,6 +45 ,7 @@ public:
19
+ @@ -46 ,6 +46 ,7 @@ public:
19
20
Fedora,
20
21
Gentoo,
21
22
OpenSUSE,
22
23
+ Sailfish,
23
24
UbuntuHardy,
24
25
UbuntuIntrepid,
25
26
UbuntuJaunty,
26
- @@ -124 ,6 +125 ,10 @@ public:
27
- return DistroVal >= DebianLenny && DistroVal <= DebianBookworm ;
27
+ @@ -127 ,6 +128 ,10 @@ public:
28
+ return DistroVal >= DebianLenny && DistroVal <= DebianTrixie ;
28
29
}
29
30
30
31
+ bool IsSailfish() const {
31
32
+ return DistroVal == Sailfish;
32
33
+ }
33
34
+
34
35
bool IsUbuntu() const {
35
- return DistroVal >= UbuntuHardy && DistroVal <= UbuntuJammy ;
36
+ return DistroVal >= UbuntuHardy && DistroVal <= UbuntuLunar ;
36
37
}
37
38
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
38
- index 5ac38c34d112..cccb2026e527 100644
39
+ index 87a0c5a58511561a4eac9e651e313542e638d2ca..de6457bd3dfb8cceeee89fea7cee41308ace337c 100644
39
40
--- a/clang/lib/Driver/Distro.cpp
40
41
+++ b/clang/lib/Driver/Distro.cpp
41
- @@ -197 ,6 +197 ,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
42
+ @@ -201 ,6 +201 ,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
42
43
if (VFS.exists("/etc/gentoo-release"))
43
44
return Distro::Gentoo;
44
45
@@ -49,10 +50,10 @@ index 5ac38c34d112..cccb2026e527 100644
49
50
}
50
51
51
52
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
52
- index 7a9570a686f4..e7f57c824961 100644
53
+ index 4f2340316654301ddcc70e293a9bf0da327a6de3..814f3482a1b598b24e4b3f63d811666791a6e260 100644
53
54
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
54
55
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
55
- @@ -2073 ,7 +2073 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
56
+ @@ -2218 ,7 +2218 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
56
57
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
57
58
static const char *const AArch64Triples[] = {
58
59
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
@@ -61,27 +62,27 @@ index 7a9570a686f4..e7f57c824961 100644
61
62
static const char *const AArch64beLibDirs[] = {"/lib"};
62
63
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
63
64
"aarch64_be-linux-gnu"};
64
- @@ -2082 ,6 +2082 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
65
+ @@ -2227 ,6 +2227 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
65
66
static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
66
67
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
67
68
"armv7hl-redhat-linux-gnueabi",
68
69
+ "armv7hl-meego-linux-gnueabi",
69
70
"armv6hl-suse-linux-gnueabi",
70
71
"armv7hl-suse-linux-gnueabi"};
71
72
static const char *const ARMebLibDirs[] = {"/lib"};
72
- @@ -2108 ,6 +2109 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
73
+ @@ -2257 ,6 +2258 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
73
74
"i586-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu",
74
75
"i386-redhat-linux6E", "i686-redhat-linux", "i386-redhat-linux",
75
76
"i586-suse-linux", "i686-montavista-linux", "i686-gnu",
76
77
+ "i486-meego-linux"
77
78
};
78
79
79
- static const char *const M68kLibDirs [] = {"/lib"};
80
+ static const char *const LoongArch64LibDirs [] = {"/lib64", "/lib"};
80
81
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
81
- index 83cb41159de7..e7c2dcaef02a 100644
82
+ index c6fb290ffdb4dc6a779737a4e838befbc7aba16e..72ef4fff4400f08cf429c1072f7edb69d8e440f5 100644
82
83
--- a/clang/lib/Driver/ToolChains/Linux.cpp
83
84
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
84
- @@ -194 ,7 +194 ,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
85
+ @@ -197 ,7 +197 ,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
85
86
}
86
87
87
88
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
@@ -90,28 +91,20 @@ index 83cb41159de7..e7c2dcaef02a 100644
90
91
ExtraOpts.push_back("-z");
91
92
ExtraOpts.push_back("relro");
92
93
}
93
- @@ -233,13 +233,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
94
- // Hexagon linker/loader does not support .gnu.hash
94
+ @@ -241,12 +241,15 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
95
95
if (!IsMips && !IsHexagon) {
96
- if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
97
- - (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
98
- + (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) || Distro.IsSailfish() ||
99
- (IsAndroid && !Triple.isAndroidVersionLT(23)))
100
- ExtraOpts.push_back("--hash-style=gnu");
101
-
102
- if (Distro.IsDebian() || Distro.IsOpenSUSE() ||
103
- Distro == Distro::UbuntuLucid || Distro == Distro::UbuntuJaunty ||
104
- - Distro == Distro::UbuntuKarmic ||
105
- + Distro == Distro::UbuntuKarmic || Distro.IsSailfish() ||
106
- (IsAndroid && Triple.isAndroidVersionLT(23)))
96
+ if (Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
97
+ Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic ||
98
+ - (IsAndroid && Triple.isAndroidVersionLT(23)))
99
+ + Distro.IsSailfish() || (IsAndroid && Triple.isAndroidVersionLT(23)))
107
100
ExtraOpts.push_back("--hash-style=both");
101
+ else
102
+ ExtraOpts.push_back("--hash-style=gnu");
108
103
}
109
- @@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
104
+
105
+ + if (Distro.IsSailfish())
106
+ + ExtraOpts.push_back("--enable-new-dtags");
107
+ +
108
+ #ifdef ENABLE_LINKER_BUILD_ID
110
109
ExtraOpts.push_back("--build-id");
111
110
#endif
112
-
113
- - if (IsAndroid || Distro.IsOpenSUSE())
114
- + if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsSailfish())
115
- ExtraOpts.push_back("--enable-new-dtags");
116
-
117
- // The selection of paths to try here is designed to match the patterns which
0 commit comments