[PATCH] Proper detection and handling of RHEL and variants
Michael Lampe via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 26 17:35:56 PDT 2016
New patch attached. I've also removed RHEL4 which is now four years past
EOL and certainly incapable of building or running any recent version of
llvm/clang.
-Michael
Rafael EspĂndola wrote:
> - if (IsRedhat(Distro))
> + if (Distro == Fedora || Distro == RHEL7)
>
> RHEL8 will probably use --no-add-needed.
>
> Can you change this to "if (IsRedhat(Distro) && !old_rhel_distro) "?
>
> Cheers,
> Rafael
>
>
> On 22 March 2016 at 22:07, Michael Lampe via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
>> - 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).
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
-------------- next part --------------
--- a/clang/lib/Driver/ToolChains.cpp 2016-03-27 01:02:56.161462540 +0100
+++ b/clang/lib/Driver/ToolChains.cpp 2016-03-27 01:04:56.299721653 +0100
@@ -3369,7 +3369,6 @@
DebianJessie,
DebianStretch,
Exherbo,
- RHEL4,
RHEL5,
RHEL6,
RHEL7,
@@ -3396,7 +3395,7 @@
};
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; }
@@ -3438,7 +3437,8 @@
.Case("wily", UbuntuWily)
.Case("xenial", UbuntuXenial)
.Default(UnknownDistro);
- return Version;
+ if (Version != UnknownDistro)
+ return Version;
}
File = llvm::MemoryBuffer::getFile("/etc/redhat-release");
@@ -3447,15 +3447,14 @@
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;
}
@@ -3680,11 +3679,11 @@
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");
More information about the cfe-commits
mailing list