|
| 1 | +diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h |
| 2 | +index 67dc764fb7d..2ae6c555515 100644 |
| 3 | +--- a/clang/include/clang/Driver/Distro.h |
| 4 | ++++ b/clang/include/clang/Driver/Distro.h |
| 5 | +@@ -41,6 +41,7 @@ public: |
| 6 | + Fedora, |
| 7 | + Gentoo, |
| 8 | + OpenSUSE, |
| 9 | ++ Sailfish, |
| 10 | + UbuntuHardy, |
| 11 | + UbuntuIntrepid, |
| 12 | + UbuntuJaunty, |
| 13 | +@@ -117,6 +118,10 @@ public: |
| 14 | + return DistroVal >= DebianLenny && DistroVal <= DebianBullseye; |
| 15 | + } |
| 16 | + |
| 17 | ++ bool IsSailfish() const { |
| 18 | ++ return DistroVal == Sailfish; |
| 19 | ++ } |
| 20 | ++ |
| 21 | + bool IsUbuntu() const { |
| 22 | + return DistroVal >= UbuntuHardy && DistroVal <= UbuntuEoan; |
| 23 | + } |
| 24 | +diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp |
| 25 | +index f2a3074d1e7..b9971b63a81 100644 |
| 26 | +--- a/clang/lib/Driver/Distro.cpp |
| 27 | ++++ b/clang/lib/Driver/Distro.cpp |
| 28 | +@@ -145,6 +145,9 @@ static Distro::DistroType DetectDistro(llvm::vfs::FileSystem &VFS) { |
| 29 | + if (VFS.exists("/etc/gentoo-release")) |
| 30 | + return Distro::Gentoo; |
| 31 | + |
| 32 | ++ if (VFS.exists("/etc/sailfish-release")) |
| 33 | ++ return Distro::Sailfish; |
| 34 | ++ |
| 35 | + return Distro::UnknownDistro; |
| 36 | + } |
| 37 | + |
| 38 | +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp |
| 39 | +index 33cdd3585c2..e1890849100 100644 |
| 40 | +--- a/clang/lib/Driver/ToolChains/Gnu.cpp |
| 41 | ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp |
| 42 | +@@ -1927,7 +1927,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( |
| 43 | + static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; |
| 44 | + static const char *const AArch64Triples[] = { |
| 45 | + "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"}; |
| 48 | + static const char *const AArch64beLibDirs[] = {"/lib"}; |
| 49 | + static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu", |
| 50 | + "aarch64_be-linux-gnu"}; |
| 51 | +@@ -1937,6 +1937,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( |
| 52 | + "arm-linux-androideabi"}; |
| 53 | + static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf", |
| 54 | + "armv7hl-redhat-linux-gnueabi", |
| 55 | ++ "armv7hl-meego-linux-gnueabi", |
| 56 | + "armv6hl-suse-linux-gnueabi", |
| 57 | + "armv7hl-suse-linux-gnueabi"}; |
| 58 | + static const char *const ARMebLibDirs[] = {"/lib"}; |
| 59 | +@@ -1964,7 +1965,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"}; |
| 65 | + |
| 66 | + static const char *const MIPSLibDirs[] = {"/lib"}; |
| 67 | + static const char *const MIPSTriples[] = { |
| 68 | +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp |
| 69 | +index 7f59bc77f52..9cf648e2c08 100644 |
| 70 | +--- a/clang/lib/Driver/ToolChains/Linux.cpp |
| 71 | ++++ b/clang/lib/Driver/ToolChains/Linux.cpp |
| 72 | +@@ -248,7 +248,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) |
| 73 | + } |
| 74 | + |
| 75 | + if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() || |
| 76 | +- Triple.isAndroid()) { |
| 77 | ++ Triple.isAndroid() || Distro.IsSailfish()) { |
| 78 | + ExtraOpts.push_back("-z"); |
| 79 | + ExtraOpts.push_back("relro"); |
| 80 | + } |
| 81 | +@@ -289,13 +289,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) |
| 82 | + // Hexagon linker/loader does not support .gnu.hash |
| 83 | + if (!IsMips && !IsHexagon) { |
| 84 | + if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() || |
| 85 | +- (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) || |
| 86 | ++ (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) || Distro.IsSailfish() || |
| 87 | + (IsAndroid && !Triple.isAndroidVersionLT(23))) |
| 88 | + ExtraOpts.push_back("--hash-style=gnu"); |
| 89 | + |
| 90 | + if (Distro.IsDebian() || Distro.IsOpenSUSE() || |
| 91 | + Distro == Distro::UbuntuLucid || Distro == Distro::UbuntuJaunty || |
| 92 | +- Distro == Distro::UbuntuKarmic || |
| 93 | ++ Distro == Distro::UbuntuKarmic || Distro.IsSailfish() || |
| 94 | + (IsAndroid && Triple.isAndroidVersionLT(23))) |
| 95 | + ExtraOpts.push_back("--hash-style=both"); |
| 96 | + } |
| 97 | +@@ -304,7 +304,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) |
| 98 | + ExtraOpts.push_back("--build-id"); |
| 99 | + #endif |
| 100 | + |
| 101 | +- if (IsAndroid || Distro.IsOpenSUSE()) |
| 102 | ++ if (IsAndroid || Distro.IsOpenSUSE() || Distro.IsSailfish()) |
| 103 | + ExtraOpts.push_back("--enable-new-dtags"); |
| 104 | + |
| 105 | + // The selection of paths to try here is designed to match the patterns which |
0 commit comments