[PATCH] D24954: [ToolChains] Do not assume OpenSUSE for other SUSE variants

Michał Górny via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 27 00:36:29 PDT 2016


mgorny created this revision.
mgorny added reviewers: rafael, theraven, ismail.
mgorny added a subscriber: cfe-commits.

Assume OpenSUSE distribution only when /etc/SuSE-release indicates OpenSUSE, rather than for any SUSE distribution. This reverts the behavior change from rL185537 which -- along with removing the version check -- also implicitly removed the check for OpenSUSE string. This fixes passing unsupported linker flags for old binutils on SLES10.


https://reviews.llvm.org/D24954

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -3912,8 +3912,11 @@
     return UnknownDistro;
   }
 
-  if (D.getVFS().exists("/etc/SuSE-release"))
-    return OpenSUSE;
+  File = llvm::MemoryBuffer::getFile("/etc/SuSE-release");
+  if (File)
+    return llvm::StringSwitch<Distro>(File.get()->getBuffer())
+      .StartsWith("openSUSE", OpenSUSE)
+      .Default(UnknownDistro);
 
   if (D.getVFS().exists("/etc/exherbo-release"))
     return Exherbo;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24954.72607.patch
Type: text/x-patch
Size: 570 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160927/a5a3e187/attachment.bin>


More information about the cfe-commits mailing list