From 085ba75b10376fa55bb94cb6fa6c54526957732f Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Thu, 13 Sep 2018 11:42:28 -0500
Subject: [PATCH] =?UTF-8?q?Add=20support=20for=20Ad=C3=A9lie=20Linux?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 include/clang/Driver/Distro.h   | 5 +++++
 lib/Driver/Distro.cpp           | 3 +++
 lib/Driver/ToolChains/Linux.cpp | 6 ++++--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/clang/Driver/Distro.h b/include/clang/Driver/Distro.h
index 7b34a09256..7a3774a4f1 100644
--- a/include/clang/Driver/Distro.h
+++ b/include/clang/Driver/Distro.h
@@ -26,6 +26,7 @@ public:
     // NB: Releases of a particular Linux distro should be kept together
     // in this enum, because some tests are done by integer comparison against
     // the first and last known member in the family, e.g. IsRedHat().
+    AdelieLinux,
     AlpineLinux,
     ArchLinux,
     DebianLenny,
@@ -118,6 +119,10 @@ public:
     return DistroVal >= UbuntuHardy && DistroVal <= UbuntuCosmic;
   }
 
+  bool IsAdelieLinux() const {
+    return DistroVal == AdelieLinux;
+  }
+
   bool IsAlpineLinux() const {
     return DistroVal == AlpineLinux;
   }
diff --git a/lib/Driver/Distro.cpp b/lib/Driver/Distro.cpp
index 2c4d44faf8..7ef35ab379 100644
--- a/lib/Driver/Distro.cpp
+++ b/lib/Driver/Distro.cpp
@@ -130,6 +130,9 @@ static Distro::DistroType DetectDistro(vfs::FileSystem &VFS) {
   if (VFS.exists("/etc/exherbo-release"))
     return Distro::Exherbo;
 
+  if (VFS.exists("/etc/adelie-release"))
+    return Distro::AdelieLinux;
+
   if (VFS.exists("/etc/alpine-release"))
     return Distro::AlpineLinux;
 
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 2a87cb077c..85bcd8ed47 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -234,7 +234,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
     ExtraOpts.push_back("now");
   }
 
-  if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
+  if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux() ||
+      Distro.IsAdelieLinux()) {
     ExtraOpts.push_back("-z");
     ExtraOpts.push_back("relro");
   }
@@ -268,7 +269,8 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
   // Hexagon linker/loader does not support .gnu.hash
   if (!IsMips && !IsAndroid && !IsHexagon) {
     if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
-        (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
+        Distro.IsAdelieLinux() ||
+	(Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
       ExtraOpts.push_back("--hash-style=gnu");
 
     if (Distro.IsDebian() || Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||
-- 
2.18.0