Adding CLANG_DTS_LIST for turning on devtoolset use at runtime

This commit is contained in:
Dave Johansen 2015-01-02 11:05:07 -07:00
parent 18bd3a3f63
commit 964b2a20df
2 changed files with 19 additions and 14 deletions

View File

@ -1,17 +1,19 @@
--- a/tools/clang/lib/Driver/ToolChains.cpp 2014-08-27 22:07:31.000000000 +0200
+++ b/tools/clang/lib/Driver/ToolChains.cpp 2014-09-08 02:51:38.197987523 +0200
@@ -1249,8 +1249,13 @@
Prefixes.push_back(D.InstalledDir + "/..");
--- a/tools/clang/lib/Driver/ToolChains.cpp
+++ b/tools/clang/lib/Driver/ToolChains.cpp
@@ -1223,6 +1223,18 @@
// And finally in /usr.
- if (D.SysRoot.empty())
+ if (D.SysRoot.empty()) {
+ Prefixes.push_back("/opt/rh/devtoolset-3/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-2/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-1.1/root/usr");
+ Prefixes.push_back("/opt/rh/devtoolset-1.0/root/usr");
if (D.SysRoot.empty())
Prefixes.push_back("/usr");
+
+ // RedHat Developer Toolset support
+ if (const char *software_collections = getenv("CLANG_DTS_LIST")) {
+ SmallVector<StringRef, 4> Scls;
+ StringRef(software_collections).split(Scls, StringRef(" "), -1, false);
+ for (const auto &Scl : Scls) {
+ if (!Scl.startswith(StringRef("devtoolset-")))
+ continue;
+ const std::string SclPath = std::string("/opt/rh/") + Scl.str() + std::string("/root/usr");
+ Prefixes.push_back(SclPath);
+ }
+ }
}
// Loop over the various components which exist and select the best GCC

View File

@ -49,7 +49,7 @@ Obsoletes: pure <= 0.55
Name: llvm
Version: %{version_base}.2
Release: 3%{?dist}
Release: 4%{?dist}
Summary: The Low Level Virtual Machine
Group: Development/Languages
@ -671,6 +671,9 @@ exit 0
%endif
%changelog
* Fri Jan 02 2015 Dave Johansen <davejohansen@gmail.com> 3.4.2-4
- Adding CLANG_DTS_LIST for turning on devtoolset use at runtime
* Thu Nov 20 2014 Dave Johansen <davejohansen@gmail.com> 3.4.2-3
- Fix for CVE-2014-2893