Skip to content

Commit 91cc4a6

Browse files
committed
[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
1 parent d59f7f9 commit 91cc4a6

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

clang/lib/Driver/ToolChains.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,8 +3968,25 @@ static Distro DetectDistro(vfs::FileSystem &VFS) {
39683968
.Default(UnknownDistro);
39693969
}
39703970

3971-
if (VFS.exists("/etc/SuSE-release"))
3972-
return OpenSUSE;
3971+
File = VFS.getBufferForFile("/etc/SuSE-release");
3972+
if (File) {
3973+
StringRef Data = File.get()->getBuffer();
3974+
SmallVector<StringRef, 8> Lines;
3975+
Data.split(Lines, "\n");
3976+
for (const StringRef& Line : Lines) {
3977+
if (!Line.trim().startswith("VERSION"))
3978+
continue;
3979+
std::pair<StringRef, StringRef> SplitLine = Line.split('=');
3980+
int Version;
3981+
// OpenSUSE/SLES 10 and older are not supported and not compatible
3982+
// with our rules, so just treat them as UnknownDistro.
3983+
if (!SplitLine.second.trim().getAsInteger(10, Version) &&
3984+
Version > 10)
3985+
return OpenSUSE;
3986+
return UnknownDistro;
3987+
}
3988+
return UnknownDistro;
3989+
}
39733990

39743991
if (VFS.exists("/etc/exherbo-release"))
39753992
return Exherbo;

0 commit comments

Comments
 (0)