See attached, thanks!
~Will
From 13bc7bb6b76cd884469004f864e5f53803554350 Mon Sep 17 00:00:00 2001
From: Will Dietz <[email protected]>
Date: Mon, 28 Oct 2013 16:49:43 -0500
Subject: [PATCH] Fix toolchain detection on SL6.
* Add SL6 Distro type, detect from /etc/redhat-release
* Ignore /etc/lsb-release if does not contain DISTRIB_CODENAME
Fixes clang misdetecting library locations on 64bit.
---
lib/Driver/ToolChains.cpp | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index e99c1f0..1182a89 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -2096,6 +2096,7 @@ enum Distro {
RHEL6,
Fedora,
OpenSUSE,
+ ScientificLinux6,
UbuntuHardy,
UbuntuIntrepid,
UbuntuJaunty,
@@ -2112,7 +2113,8 @@ enum Distro {
};
static bool IsRedhat(enum Distro Distro) {
- return Distro == Fedora || (Distro >= RHEL4 && Distro <= RHEL6);
+ return Distro == Fedora || (Distro >= RHEL4 && Distro <= RHEL6) ||
+ Distro == ScientificLinux6;
}
static bool IsOpenSUSE(enum Distro Distro) {
@@ -2133,10 +2135,9 @@ static Distro DetectDistro(StringRef Prefix, llvm::Triple::ArchType Arch) {
StringRef Data = File.get()->getBuffer();
SmallVector<StringRef, 8> Lines;
Data.split(Lines, "\n");
- Distro Version = UnknownDistro;
for (unsigned i = 0, s = Lines.size(); i != s; ++i)
- if (Version == UnknownDistro && Lines[i].startswith("DISTRIB_CODENAME="))
- Version = llvm::StringSwitch<Distro>(Lines[i].substr(17))
+ if (Lines[i].startswith("DISTRIB_CODENAME="))
+ return llvm::StringSwitch<Distro>(Lines[i].substr(17))
.Case("hardy", UbuntuHardy)
.Case("intrepid", UbuntuIntrepid)
.Case("jaunty", UbuntuJaunty)
@@ -2150,7 +2151,6 @@ static Distro DetectDistro(StringRef Prefix, llvm::Triple::ArchType Arch) {
.Case("raring", UbuntuRaring)
.Case("saucy", UbuntuSaucy)
.Default(UnknownDistro);
- return Version;
}
if (!llvm::MemoryBuffer::getFile(Prefix + "/etc/redhat-release", File)) {
@@ -2168,6 +2168,9 @@ static Distro DetectDistro(StringRef Prefix, llvm::Triple::ArchType Arch) {
Data.startswith("CentOS")) &&
Data.find("release 4") != StringRef::npos)
return RHEL4;
+ else if (Data.startswith("Scientific Linux") &&
+ Data.find("release 6") != StringRef::npos)
+ return ScientificLinux6;
return UnknownDistro;
}
--
1.8.4.1
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits