[PATCH] Proper detection and handling of RHEL and variants

Michael Lampe via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 19:07:31 PDT 2016


- Don't consider "/etc/lsb-release" to be Ubuntu only.
- Detect SL, too.
- Only add "--no-add-needed" for RHEL7 (or Fedora), not for RHEL6 
(that's what the compilers shipped with RHEL do).

-------------- next part --------------
--- a/tools/clang/lib/Driver/ToolChains.cpp	2015-09-02 04:26:13.266233474 +0200
+++ b/tools/clang/lib/Driver/ToolChains.cpp	2015-09-02 04:35:04.475976086 +0200
@@ -2934,7 +2934,8 @@
                       .Case("vivid", UbuntuVivid)
                       .Case("wily", UbuntuWily)
                       .Default(UnknownDistro);
-    return Version;
+    if (Version != UnknownDistro)
+      return Version;
   }
 
   File = llvm::MemoryBuffer::getFile("/etc/redhat-release");
@@ -2943,7 +2944,8 @@
     if (Data.startswith("Fedora release"))
       return Fedora;
     if (Data.startswith("Red Hat Enterprise Linux") ||
-        Data.startswith("CentOS")) {
+        Data.startswith("CentOS") ||
+        Data.startswith("Scientific Linux")) {
       if (Data.find("release 7") != StringRef::npos)
         return RHEL7;
       else if (Data.find("release 6") != StringRef::npos)
@@ -3176,7 +3178,7 @@
       ExtraOpts.push_back("--hash-style=both");
   }
 
-  if (IsRedhat(Distro))
+  if (Distro == Fedora || Distro == RHEL7)
     ExtraOpts.push_back("--no-add-needed");
 
   if ((IsDebian(Distro) && Distro >= DebianSqueeze) || IsOpenSUSE(Distro) ||


More information about the cfe-commits mailing list