summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2016-10-25 15:33:32 +0000
committerMichal Gorny <mgorny@gentoo.org>2016-10-25 15:33:32 +0000
commit91cc4a6503fee173c303e510ebc2183b4e7bc29b (patch)
treec91cb45670c5dc4ed4a2e0631dcc82ff490b0036 /clang/lib/Driver/ToolChains.cpp
parentd59f7f9047fd7996ba6043004d4c190dae6d4611 (diff)
downloadbcm5719-llvm-91cc4a6503fee173c303e510ebc2183b4e7bc29b.tar.gz
bcm5719-llvm-91cc4a6503fee173c303e510ebc2183b4e7bc29b.zip
[Driver] Disable OpenSUSE rules for OpenSUSE/SLES 10 and older
Disable the OpenSUSE rules for OpenSUSE versions older than 11 as they are incompatible with the old binutils on that distribution. Differential Revision: https://reviews.llvm.org/D24954 llvm-svn: 285076
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r--clang/lib/Driver/ToolChains.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index f04c443a886..509f6d9535a 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -3968,8 +3968,25 @@ static Distro DetectDistro(vfs::FileSystem &VFS) {
.Default(UnknownDistro);
}
- if (VFS.exists("/etc/SuSE-release"))
- return OpenSUSE;
+ File = VFS.getBufferForFile("/etc/SuSE-release");
+ if (File) {
+ StringRef Data = File.get()->getBuffer();
+ SmallVector<StringRef, 8> Lines;
+ Data.split(Lines, "\n");
+ for (const StringRef& Line : Lines) {
+ if (!Line.trim().startswith("VERSION"))
+ continue;
+ std::pair<StringRef, StringRef> SplitLine = Line.split('=');
+ int Version;
+ // OpenSUSE/SLES 10 and older are not supported and not compatible
+ // with our rules, so just treat them as UnknownDistro.
+ if (!SplitLine.second.trim().getAsInteger(10, Version) &&
+ Version > 10)
+ return OpenSUSE;
+ return UnknownDistro;
+ }
+ return UnknownDistro;
+ }
if (VFS.exists("/etc/exherbo-release"))
return Exherbo;
OpenPOWER on IntegriCloud