diff options
author | theraven <theraven@FreeBSD.org> | 2013-09-06 20:08:03 +0000 |
---|---|---|
committer | theraven <theraven@FreeBSD.org> | 2013-09-06 20:08:03 +0000 |
commit | 1df952388b48e11694d9be00cbdb7fed2ca1c0f3 (patch) | |
tree | 323fdbecd93a672260c605a70c974da7b41353c6 /contrib/llvm | |
parent | 6965cdad6639b93d4b619f8e095c037377cd0d66 (diff) | |
download | FreeBSD-src-1df952388b48e11694d9be00cbdb7fed2ca1c0f3.zip FreeBSD-src-1df952388b48e11694d9be00cbdb7fed2ca1c0f3.tar.gz |
On platforms where clang is the default compiler, don't build gcc or libstdc++.
To enable them, set WITH_GCC and WITH_GNUCXX in src.conf.
Make clang default to using libc++ on FreeBSD 10.
Bumped __FreeBSD_version for the change.
GCC is still enabled on PC98, because the PC98 bootloader requires GCC to build
(or, at least, hard-codes the use of gcc into its build).
Thanks to everyone who helped make the ports tree ready for this (and bapt
for coordinating them all). Also to imp for reviewing this and working on the
forward-porting of the changes in our gcc so that we're getting to a much
better place with regard to external toolchains.
Sorry to all of the people who helped who I forgot to mention by name.
Reviewed by: bapt, imp, dim, ...
Diffstat (limited to 'contrib/llvm')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp | 32 | ||||
-rw-r--r-- | contrib/llvm/tools/clang/lib/Driver/ToolChains.h | 5 |
2 files changed, 37 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp index fffba0e..d8d580b 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp @@ -1851,6 +1851,38 @@ bool FreeBSD::UseSjLjExceptions() const { } } +ToolChain::CXXStdlibType +FreeBSD::GetCXXStdlibType(const ArgList &Args) const { + if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) { + StringRef Value = A->getValue(); + if (Value == "libc++") + return ToolChain::CST_Libcxx; + if (Value == "libstdc++") + return ToolChain::CST_Libstdcxx; + getDriver().Diag(diag::err_drv_invalid_stdlib_name) + << A->getAsString(Args); + } + + return getTriple().getOSMajorVersion() >= 10 ? ToolChain::CST_Libcxx : + ToolChain::CST_Libstdcxx; +} + +void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + ArgStringList &CC1Args) const { + if (DriverArgs.hasArg(options::OPT_nostdlibinc) || + DriverArgs.hasArg(options::OPT_nostdincxx)) + return; + + if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) + addSystemInclude(DriverArgs, CC1Args, + getDriver().SysRoot + "/usr/include/c++/v1"); + else + addSystemInclude(DriverArgs, CC1Args, + getDriver().SysRoot + "/usr/include/c++/4.2"); + return; + +} + /// 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/contrib/llvm/tools/clang/lib/Driver/ToolChains.h b/contrib/llvm/tools/clang/lib/Driver/ToolChains.h index 3afd8dd..2b140c1 100644 --- a/contrib/llvm/tools/clang/lib/Driver/ToolChains.h +++ b/contrib/llvm/tools/clang/lib/Driver/ToolChains.h @@ -458,9 +458,14 @@ class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF { public: FreeBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args); + virtual CXXStdlibType GetCXXStdlibType(const ArgList &Args) const; + virtual bool IsMathErrnoDefault() const { return false; } virtual bool IsObjCNonFragileABIDefault() const { return true; } + virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + ArgStringList &CC1Args) const; + virtual bool UseSjLjExceptions() const; protected: virtual Tool *buildAssembler() const; |