1
- From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2
- From: Ruben De Smet <ruben.de.smet@rubdos.be>
3
- Date: Sun, 26 Jun 2022 10:57:51 +0200
4
- Subject: [PATCH] Clang: SailfishOS toolchain
5
-
6
- Signed-off-by: Ruben De Smet <ruben.de.smet@rubdos.be>
7
- ---
8
- clang/include/clang/Driver/Distro.h | 5 +++++
9
- clang/lib/Driver/Distro.cpp | 3 +++
10
- clang/lib/Driver/ToolChains/Gnu.cpp | 4 +++-
11
- clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++----
12
- 4 files changed, 15 insertions(+), 5 deletions(-)
13
-
14
1
diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
15
- index 2723f75e8945..58616ad541e1 100644
2
+ index a8de94163e8b..240587994938 100644
16
3
--- a/clang/include/clang/Driver/Distro.h
17
4
+++ b/clang/include/clang/Driver/Distro.h
18
- @@ -45 ,6 +45 ,7 @@ public:
5
+ @@ -46 ,6 +46 ,7 @@ public:
19
6
Fedora,
20
7
Gentoo,
21
8
OpenSUSE,
22
9
+ Sailfish,
23
10
UbuntuHardy,
24
11
UbuntuIntrepid,
25
12
UbuntuJaunty,
26
- @@ -124 ,6 +125 ,10 @@ public:
27
- return DistroVal >= DebianLenny && DistroVal <= DebianBookworm ;
13
+ @@ -129 ,6 +130 ,10 @@ public:
14
+ return DistroVal >= DebianLenny && DistroVal <= DebianTrixie ;
28
15
}
29
16
30
17
+ bool IsSailfish() const {
31
18
+ return DistroVal == Sailfish;
32
19
+ }
33
20
+
34
21
bool IsUbuntu() const {
35
- return DistroVal >= UbuntuHardy && DistroVal <= UbuntuJammy ;
22
+ return DistroVal >= UbuntuHardy && DistroVal <= UbuntuNoble ;
36
23
}
37
24
diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
38
- index 5ac38c34d112..cccb2026e527 100644
25
+ index a7e7f169dc14..cd8684020dfe 100644
39
26
--- a/clang/lib/Driver/Distro.cpp
40
27
+++ b/clang/lib/Driver/Distro.cpp
41
- @@ -197 ,6 +197 ,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
28
+ @@ -204 ,6 +204 ,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
42
29
if (VFS.exists("/etc/gentoo-release"))
43
30
return Distro::Gentoo;
44
31
@@ -49,10 +36,10 @@ index 5ac38c34d112..cccb2026e527 100644
49
36
}
50
37
51
38
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
52
- index 7a9570a686f4..e7f57c824961 100644
39
+ index e5e1b1d77269..3d0d38972977 100644
53
40
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
54
41
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
55
- @@ -2073 ,7 +2073 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
42
+ @@ -2452 ,7 +2452 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
56
43
static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
57
44
static const char *const AArch64Triples[] = {
58
45
"aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
@@ -61,27 +48,19 @@ index 7a9570a686f4..e7f57c824961 100644
61
48
static const char *const AArch64beLibDirs[] = {"/lib"};
62
49
static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
63
50
"aarch64_be-linux-gnu"};
64
- @@ -2082 ,6 +2082 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
51
+ @@ -2461 ,6 +2461 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
65
52
static const char *const ARMTriples[] = {"arm-linux-gnueabi"};
66
53
static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
67
54
"armv7hl-redhat-linux-gnueabi",
68
55
+ "armv7hl-meego-linux-gnueabi",
69
56
"armv6hl-suse-linux-gnueabi",
70
57
"armv7hl-suse-linux-gnueabi"};
71
58
static const char *const ARMebLibDirs[] = {"/lib"};
72
- @@ -2108,6 +2109,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
73
- "i586-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu",
74
- "i386-redhat-linux6E", "i686-redhat-linux", "i386-redhat-linux",
75
- "i586-suse-linux", "i686-montavista-linux", "i686-gnu",
76
- + "i486-meego-linux"
77
- };
78
-
79
- static const char *const M68kLibDirs[] = {"/lib"};
80
59
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
81
- index 83cb41159de7..e7c2dcaef02a 100644
60
+ index 4300a2bdff17..8ac052972ebb 100644
82
61
--- a/clang/lib/Driver/ToolChains/Linux.cpp
83
62
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
84
- @@ -194 ,7 +194 ,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
63
+ @@ -232 ,7 +232 ,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
85
64
}
86
65
87
66
if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
@@ -90,28 +69,22 @@ index 83cb41159de7..e7c2dcaef02a 100644
90
69
ExtraOpts.push_back("-z");
91
70
ExtraOpts.push_back("relro");
92
71
}
93
- @@ -233,13 +233,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
72
+ @@ -275,7 +275,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
94
73
// Hexagon linker/loader does not support .gnu.hash
95
74
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() ||
75
+ if (Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
76
+ - Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic ||
77
+ + Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic || Distro.IsSailfish() ||
106
78
(IsAndroid && Triple.isAndroidVersionLT(23)))
107
79
ExtraOpts.push_back("--hash-style=both");
108
- }
109
- @@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
80
+ else
81
+ @@ -286,6 +286,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
110
82
ExtraOpts.push_back("--build-id");
111
83
#endif
112
84
113
- - if (IsAndroid || Distro.IsOpenSUSE())
114
- + if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsSailfish())
115
- ExtraOpts.push_back("--enable-new-dtags");
116
-
85
+ + if (Distro.IsSailfish())
86
+ + ExtraOpts.push_back("--enable-new-dtags");
87
+ +
117
88
// The selection of paths to try here is designed to match the patterns which
89
+ // the GCC driver itself uses, as this is part of the GCC-compatible driver.
90
+ // This was determined by running GCC in a fake filesystem, creating all
0 commit comments