summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-05-09 13:13:50 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-05-09 13:13:50 +0000
commit52fe8966b5d28c9c066b01d4fc967023ec142777 (patch)
treeabb80fc1321bb66d905f9e2df3ac7ff7ad35df25 /clang/lib/Driver
parentd044e49b375cadf4dc66b14393138a49d59f30e1 (diff)
downloadbcm5719-llvm-52fe8966b5d28c9c066b01d4fc967023ec142777.tar.gz
bcm5719-llvm-52fe8966b5d28c9c066b01d4fc967023ec142777.zip
Proper detection and handling of RHEL and variants.
- 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). - removed RHEL4 which is now four years past EOL and certainly incapable of building or running any recent version of llvm/clang. llvm-svn: 268914
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/ToolChains.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 613ddb80f7e..14b5381f08e 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -3421,7 +3421,6 @@ enum Distro {
DebianJessie,
DebianStretch,
Exherbo,
- RHEL4,
RHEL5,
RHEL6,
RHEL7,
@@ -3448,7 +3447,7 @@ enum Distro {
};
static bool IsRedhat(enum Distro Distro) {
- return Distro == Fedora || (Distro >= RHEL4 && Distro <= RHEL7);
+ return Distro == Fedora || (Distro >= RHEL5 && Distro <= RHEL7);
}
static bool IsOpenSUSE(enum Distro Distro) { return Distro == OpenSUSE; }
@@ -3490,7 +3489,8 @@ static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) {
.Case("wily", UbuntuWily)
.Case("xenial", UbuntuXenial)
.Default(UnknownDistro);
- return Version;
+ if (Version != UnknownDistro)
+ return Version;
}
File = llvm::MemoryBuffer::getFile("/etc/redhat-release");
@@ -3499,15 +3499,14 @@ static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) {
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)
return RHEL6;
else if (Data.find("release 5") != StringRef::npos)
return RHEL5;
- else if (Data.find("release 4") != StringRef::npos)
- return RHEL4;
}
return UnknownDistro;
}
@@ -3732,11 +3731,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
ExtraOpts.push_back("--hash-style=both");
}
- if (IsRedhat(Distro))
+ if (IsRedhat(Distro) && Distro != RHEL5 && Distro != RHEL6)
ExtraOpts.push_back("--no-add-needed");
if ((IsDebian(Distro) && Distro >= DebianSqueeze) || IsOpenSUSE(Distro) ||
- (IsRedhat(Distro) && Distro != RHEL4 && Distro != RHEL5) ||
+ (IsRedhat(Distro) && Distro != RHEL5) ||
(IsUbuntu(Distro) && Distro >= UbuntuKarmic))
ExtraOpts.push_back("--build-id");
OpenPOWER on IntegriCloud