[PATCH] D39588: Distro: initial support for alpine

Martell Malone via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 2 21:30:54 PDT 2017


martell created this revision.

Add alpine linux as a distro.
We support building for musl since https://reviews.llvm.org/rL292848.
Let's add this important docker / kubernetes empowering distro.

Some bits are still missing but this is a good base.


Repository:
  rL LLVM

https://reviews.llvm.org/D39588

Files:
  include/clang/Driver/Distro.h
  lib/Driver/Distro.cpp
  lib/Driver/ToolChains/Linux.cpp


Index: lib/Driver/ToolChains/Linux.cpp
===================================================================
--- lib/Driver/ToolChains/Linux.cpp
+++ lib/Driver/ToolChains/Linux.cpp
@@ -210,7 +210,12 @@
 
   Distro Distro(D.getVFS());
 
-  if (Distro.IsOpenSUSE() || Distro.IsUbuntu()) {
+  if (Distro.IsAlpineLinux()) {
+    ExtraOpts.push_back("-z");
+    ExtraOpts.push_back("now");
+  }
+
+  if (Distro.IsOpenSUSE() || Distro.IsUbuntu() || Distro.IsAlpineLinux()) {
     ExtraOpts.push_back("-z");
     ExtraOpts.push_back("relro");
   }
@@ -232,7 +237,7 @@
   // Android loader does not support .gnu.hash.
   // Hexagon linker/loader does not support .gnu.hash
   if (!IsMips && !IsAndroid && !IsHexagon) {
-    if (Distro.IsRedhat() || Distro.IsOpenSUSE() ||
+    if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
         (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))
       ExtraOpts.push_back("--hash-style=gnu");
 
Index: lib/Driver/Distro.cpp
===================================================================
--- lib/Driver/Distro.cpp
+++ lib/Driver/Distro.cpp
@@ -129,6 +129,9 @@
   if (VFS.exists("/etc/exherbo-release"))
     return Distro::Exherbo;
 
+  if (VFS.exists("/etc/alpine-release"))
+    return Distro::AlpineLinux;
+
   if (VFS.exists("/etc/arch-release"))
     return Distro::ArchLinux;
 
Index: include/clang/Driver/Distro.h
===================================================================
--- include/clang/Driver/Distro.h
+++ include/clang/Driver/Distro.h
@@ -26,6 +26,7 @@
     // 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().
+    AlpineLinux,
     ArchLinux,
     DebianLenny,
     DebianSqueeze,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39588.121433.patch
Type: text/x-patch
Size: 1839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171103/d16711f8/attachment.bin>


More information about the cfe-commits mailing list