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+
114diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h
2- index d382cf77a8b..8c06919f1d3 100644
15+ index 2723f75e8945..58616ad541e1 100644
316--- a/clang/include/clang/Driver/Distro.h
417+++ b/clang/include/clang/Driver/Distro.h
5- @@ -42 ,6 +42 ,7 @@ public:
18+ @@ -45 ,6 +45 ,7 @@ public:
619 Fedora,
720 Gentoo,
821 OpenSUSE,
922+ Sailfish,
1023 UbuntuHardy,
1124 UbuntuIntrepid,
1225 UbuntuJaunty,
13- @@ -119 ,6 +120 ,10 @@ public:
14- return DistroVal >= DebianLenny && DistroVal <= DebianBullseye ;
26+ @@ -124 ,6 +125 ,10 @@ public:
27+ return DistroVal >= DebianLenny && DistroVal <= DebianBookworm ;
1528 }
1629
1730+ bool IsSailfish() const {
1831+ return DistroVal == Sailfish;
1932+ }
2033+
2134 bool IsUbuntu() const {
22- return DistroVal >= UbuntuHardy && DistroVal <= UbuntuFocal ;
35+ return DistroVal >= UbuntuHardy && DistroVal <= UbuntuJammy ;
2336 }
2437diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp
25- index 06707fefc9d..cf14a4073fd 100644
38+ index 5ac38c34d112..cccb2026e527 100644
2639--- a/clang/lib/Driver/Distro.cpp
2740+++ b/clang/lib/Driver/Distro.cpp
28- @@ -163 ,6 +163 ,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS,
41+ @@ -197 ,6 +197 ,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) {
2942 if (VFS.exists("/etc/gentoo-release"))
3043 return Distro::Gentoo;
3144
@@ -36,40 +49,39 @@ index 06707fefc9d..cf14a4073fd 100644
3649 }
3750
3851diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
39- index e8ef881e89a..1bad4f13226 100644
52+ index 7a9570a686f4..e7f57c824961 100644
4053--- a/clang/lib/Driver/ToolChains/Gnu.cpp
4154+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
42- @@ -1999 ,7 +1999 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
55+ @@ -2073 ,7 +2073 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
4356 static const char *const AArch64LibDirs[] = {"/lib64", "/lib"};
4457 static const char *const AArch64Triples[] = {
4558 "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux",
46- - "aarch64-suse-linux", "aarch64-linux-android" };
47- + "aarch64-suse-linux", "aarch64-linux-android", "aarch64- meego-linux-gnu"};
59+ - "aarch64-suse-linux"};
60+ + "aarch64-suse-linux", "aarch64-meego-linux-gnu"};
4861 static const char *const AArch64beLibDirs[] = {"/lib"};
4962 static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu",
5063 "aarch64_be-linux-gnu"};
51- @@ -2009 ,6 +2009 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
52- "arm-linux-androideabi "};
64+ @@ -2082 ,6 +2082 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
65+ static const char *const ARMTriples[] = { "arm-linux-gnueabi "};
5366 static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf",
5467 "armv7hl-redhat-linux-gnueabi",
5568+ "armv7hl-meego-linux-gnueabi",
5669 "armv6hl-suse-linux-gnueabi",
5770 "armv7hl-suse-linux-gnueabi"};
5871 static const char *const ARMebLibDirs[] = {"/lib"};
59- @@ -2036,7 +2037 ,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
60- "i586-redhat- linux", "i386-redhat- linux", "i586-suse -linux",
61- "i486-slackware-linux ", "i686-montavista -linux", "i586-linux-gnu ",
62- "i686-linux-android ", "i386-gnu ", "i486 -gnu",
63- - "i586-gnu", "i686-gnu"};
64- + "i586-gnu", "i686-gnu", "i486-meego-linux" };
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+ };
6578
66- static const char *const MIPSLibDirs[] = {"/lib"};
67- static const char *const MIPSTriples[] = {
79+ static const char *const M68kLibDirs[] = {"/lib"};
6880diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
69- index 6532c899492..3fa0bea23bd 100644
81+ index 83cb41159de7..e7c2dcaef02a 100644
7082--- a/clang/lib/Driver/ToolChains/Linux.cpp
7183+++ b/clang/lib/Driver/ToolChains/Linux.cpp
72- @@ -248 ,7 +248 ,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
84+ @@ -194 ,7 +194 ,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
7385 }
7486
7587 if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
@@ -78,7 +90,7 @@ index 6532c899492..3fa0bea23bd 100644
7890 ExtraOpts.push_back("-z");
7991 ExtraOpts.push_back("relro");
8092 }
81- @@ -289 ,13 +289 ,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
93+ @@ -233 ,13 +233 ,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
8294 // Hexagon linker/loader does not support .gnu.hash
8395 if (!IsMips && !IsHexagon) {
8496 if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
@@ -94,7 +106,7 @@ index 6532c899492..3fa0bea23bd 100644
94106 (IsAndroid && Triple.isAndroidVersionLT(23)))
95107 ExtraOpts.push_back("--hash-style=both");
96108 }
97- @@ -304 ,7 +304 ,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
109+ @@ -248 ,7 +248 ,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
98110 ExtraOpts.push_back("--build-id");
99111 #endif
100112
0 commit comments