diff options
author | Michał Górny <mgorny@gentoo.org> | 2016-09-26 10:19:04 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2016-09-26 10:27:06 +0200 |
commit | 2b1e59aeb9e8d2fae5e602b67a8aba95536a006e (patch) | |
tree | 18aab30e13d4252a4c30445218c01ac8437446b0 /sys-devel | |
parent | dev-libs/jsoncpp: Bump to 1.7.6 (minor bugfix) (diff) | |
download | gentoo-2b1e59aeb9e8d2fae5e602b67a8aba95536a006e.tar.gz gentoo-2b1e59aeb9e8d2fae5e602b67a8aba95536a006e.tar.bz2 gentoo-2b1e59aeb9e8d2fae5e602b67a8aba95536a006e.zip |
sys-devel/clang: Fix the gcc-config patch not to break --gcc-toolchain
Diffstat (limited to 'sys-devel')
-rw-r--r-- | sys-devel/clang/files/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/sys-devel/clang/files/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch b/sys-devel/clang/files/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch index 6128cb938ab0..00bf28016eba 100644 --- a/sys-devel/clang/files/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch +++ b/sys-devel/clang/files/9999/0002-driver-Support-obtaining-active-toolchain-from-gcc-c.patch @@ -1,39 +1,45 @@ -From 67025453e6c2373c8d761f6435e7fa4ddaacd8fa Mon Sep 17 00:00:00 2001 +From 0384060d2de35ee56aa252cc18eccf773d674d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> Date: Fri, 5 Sep 2014 16:49:35 +0200 -Subject: [PATCH 2/7] driver: Support obtaining active toolchain from - gcc-config on Gentoo +Subject: [PATCH] driver: Support obtaining active toolchain from gcc-config on + Gentoo Author: Richard Yao <ryao@gentoo.org> Bug: https://bugs.gentoo.org/406163 Bug: https://bugs.gentoo.org/417913 --- - lib/Driver/ToolChains.cpp | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) + lib/Driver/ToolChains.cpp | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 68d5214..7689f86 100644 +index 67f165c..0f0d786 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp -@@ -1418,6 +1418,25 @@ void Generic_GCC::GCCInstallationDetector::init( +@@ -1430,6 +1430,31 @@ void Generic_GCC::GCCInstallationDetector::init( } } -+ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { -+ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File = -+ llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str()); -+ if (File) -+ { -+ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); -+ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText; -+ if (llvm::sys::fs::exists(GentooPath + "/crtbegin.o")) ++ // Try to respect gcc-config on Gentoo. However, do that only ++ // if --gcc-toolchain is not provided or equal to the Gentoo default. ++ // This avoids accidentally enforcing system GCC version when using ++ // a custom toolchain. ++ if (GCCToolchainDir == "" || GCCToolchainDir == D.SysRoot + "/usr") { ++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { ++ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File = ++ llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str()); ++ if (File) + { -+ Version = GCCVersion::Parse(VersionText); -+ GCCInstallPath = GentooPath; -+ GCCParentLibPath = GCCInstallPath + "/../../.."; -+ GCCTriple.setTriple(CandidateTripleAliases[k]); -+ IsValid = true; -+ return; ++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); ++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText; ++ if (llvm::sys::fs::exists(GentooPath + "/crtbegin.o")) ++ { ++ Version = GCCVersion::Parse(VersionText); ++ GCCInstallPath = GentooPath; ++ GCCParentLibPath = GCCInstallPath + "/../../.."; ++ GCCTriple.setTriple(CandidateTripleAliases[k]); ++ IsValid = true; ++ return; ++ } + } + } + } @@ -42,5 +48,5 @@ index 68d5214..7689f86 100644 // installation available. GCC installs are ranked by version number. Version = GCCVersion::Parse("0.0.0"); -- -2.9.3 +2.10.0 |