Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 351544 Details for
Bug 474042
sys-devel/llvm-3.3-r1: please add support to detect gcc's libstdc++ and c++ headers on Gentoo/FreeBSD
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
files/clang-3.3-gentoo-freebsd-fix-cxx-paths.patch
clang-3.3-gentoo-freebsd-fix-cxx-paths.patch (text/plain), 5.33 KB, created by
Yuta SATOH
on 2013-06-21 12:24:05 UTC
(
hide
)
Description:
files/clang-3.3-gentoo-freebsd-fix-cxx-paths.patch
Filename:
MIME Type:
Creator:
Yuta SATOH
Created:
2013-06-21 12:24:05 UTC
Size:
5.33 KB
patch
obsolete
>diff --git a/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.cpp >index 7c9e9c0..4226188 100644 >--- a/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.cpp >+++ b/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.cpp >@@ -1870,6 +1870,87 @@ bool FreeBSD::UseSjLjExceptions() const { > } > } > >+/// \brief Helper to add the three variant paths for a libstdc++ installation. >+/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, >+ const ArgList &DriverArgs, >+ ArgStringList &CC1Args) { >+ if (!llvm::sys::fs::exists(Base)) >+ return false; >+ addSystemInclude(DriverArgs, CC1Args, Base); >+ addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir); >+ addSystemInclude(DriverArgs, CC1Args, Base + "/backward"); >+ return true; >+} >+ >+/// \brief Helper to add an extra variant path for an (Ubuntu) multilib >+/// libstdc++ installation. >+/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine Suffix, >+ Twine TargetArchDir, >+ Twine MultiLibSuffix, >+ const ArgList &DriverArgs, >+ ArgStringList &CC1Args) { >+ if (!addLibStdCXXIncludePaths(Base+Suffix, TargetArchDir + MultiLibSuffix, >+ DriverArgs, CC1Args)) >+ return false; >+ >+ addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir + Suffix >+ + MultiLibSuffix); >+ return true; >+} >+ >+void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, >+ ArgStringList &CC1Args) const { >+ if (DriverArgs.hasArg(options::OPT_nostdlibinc) || >+ DriverArgs.hasArg(options::OPT_nostdincxx)) >+ return; >+ >+ // Check if libc++ has been enabled and provide its include paths if so. >+ if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) { >+ // libc++ is always installed at a fixed path on Linux currently. >+ addSystemInclude(DriverArgs, CC1Args, >+ getDriver().SysRoot + "/usr/include/c++/v1"); >+ return; >+ } >+ >+ // We need a detected GCC installation on Linux to provide libstdc++'s >+ // headers. We handled the libc++ case above. >+ if (!GCCInstallation.isValid()) >+ return; >+ >+ // By default, look for the C++ headers in an include directory adjacent to >+ // the lib directory of the GCC installation. Note that this is expect to be >+ // equivalent to '/usr/include/c++/X.Y' in almost all cases. >+ StringRef LibDir = GCCInstallation.getParentLibPath(); >+ StringRef InstallDir = GCCInstallation.getInstallPath(); >+ StringRef Version = GCCInstallation.getVersion().Text; >+ StringRef TripleStr = GCCInstallation.getTriple().str(); >+ >+ if (addLibStdCXXIncludePaths(LibDir.str() + "/../include", >+ "/c++/" + Version.str(), >+ TripleStr, >+ GCCInstallation.getMultiarchSuffix(), >+ DriverArgs, CC1Args)) >+ return; >+ >+ const std::string IncludePathCandidates[] = { >+ // Gentoo is weird and places its headers inside the GCC install, so if the >+ // first attempt to find the headers fails, try this pattern. >+ InstallDir.str() + "/include/g++-v4", >+ // Android standalone toolchain has C++ headers in yet another place. >+ LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.str(), >+ // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++, >+ // without a subdirectory corresponding to the gcc version. >+ LibDir.str() + "/../include/c++", >+ }; >+ >+ for (unsigned i = 0; i < llvm::array_lengthof(IncludePathCandidates); ++i) { >+ if (addLibStdCXXIncludePaths(IncludePathCandidates[i], (TripleStr + >+ GCCInstallation.getMultiarchSuffix()), >+ DriverArgs, CC1Args)) >+ break; >+ } >+} >+ > /// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly. > > NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) >diff --git a/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.h b/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.h >index 3afd8dd..f7f87a2 100644 >--- a/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.h >+++ b/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.h >@@ -462,9 +462,22 @@ public: > virtual bool IsObjCNonFragileABIDefault() const { return true; } > > virtual bool UseSjLjExceptions() const; >+ >+ virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, >+ ArgStringList &CC1Args) const; > protected: > virtual Tool *buildAssembler() const; > virtual Tool *buildLinker() const; >+private: >+ static bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix, >+ Twine TargetArchDir, >+ Twine MultiLibSuffix, >+ const ArgList &DriverArgs, >+ ArgStringList &CC1Args); >+ static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir, >+ const ArgList &DriverArgs, >+ ArgStringList &CC1Args); >+ > }; > > class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 474042
: 351544 |
351550
|
351552
|
351646
|
351650
|
351738