summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-01-31 02:21:20 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-01-31 02:21:20 +0000
commitd7fa2e04f6a8aef24d99522ed492145c5ff40687 (patch)
tree1fc5314990adb30b1df1bd360a0546c64b9f4a58 /clang/lib/Driver/ToolChains.cpp
parent0dc0c5411fdf2fd002d070a5b4361ebf9205cb15 (diff)
downloadbcm5719-llvm-d7fa2e04f6a8aef24d99522ed492145c5ff40687.tar.gz
bcm5719-llvm-d7fa2e04f6a8aef24d99522ed492145c5ff40687.zip
Revert r149083 which is not the direction we're going in the Clang
driver based on discussions with Doug Gregor. There are several issues: 1) The patch was not reviewed prior to commit and there were review comments. 2) The design of the functionality (triple-prefixed tool invocation) isn't the design we want for Clang going forward: it focuses on the "user triple" rather than on the "toolchain triple", and forces that bit of state into the API of every single toolchain instead of handling it automatically in the common base classes. 3) The tests provided are not stable. They fail on a few Linux variants (Gentoo among them) and on mingw32 and some other environments. I *am* interested in the Clang driver being able to invoke triple-prefixed tools, but we need to design that feature the right way. This patch just extends the previous hack without fixing the underlying problems with it. I'm working on a new design for this that I will mail for review by tomorrow. I am aware that this removes functionality that NetBSD relies on, but this is ToT, not a release. This functionality hasn't been properly designed, implemented, and tested yet. We can't "regress" until we get something that really works, both with the immediate use cases and with long term maintenance of the Clang driver. For reference, the original commit log: Keep track of the original target the user specified before normalization. This used to be captured in DefaultTargetTriple and is used for the (optional) $triple-$tool lookup for cross-compilation. Do this properly by making it an attribute of the toolchain and use it in combination with the computed triple as index for the toolchain lookup. llvm-svn: 149337
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r--clang/lib/Driver/ToolChains.cpp60
1 files changed, 24 insertions, 36 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 5737e17db14..b4273f8c2e4 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -45,9 +45,8 @@ using namespace clang;
/// Darwin - Darwin tool chain for i386 and x86_64.
-Darwin::Darwin(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : ToolChain(D, Triple, UserTriple), TargetInitialized(false),
+Darwin::Darwin(const Driver &D, const llvm::Triple& Triple)
+ : ToolChain(D, Triple), TargetInitialized(false),
ARCRuntimeForSimulator(ARCSimulator_None),
LibCXXForSimulator(LibCXXSimulator_None)
{
@@ -251,9 +250,8 @@ Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA,
}
-DarwinClang::DarwinClang(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : Darwin(D, Triple, UserTriple)
+DarwinClang::DarwinClang(const Driver &D, const llvm::Triple& Triple)
+ : Darwin(D, Triple)
{
getProgramPaths().push_back(getDriver().getInstalledDir());
if (getDriver().getInstalledDir() != getDriver().Dir)
@@ -1389,9 +1387,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
}
}
-Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : ToolChain(D, Triple, UserTriple), GCCInstallation(getDriver(), Triple) {
+Generic_GCC::Generic_GCC(const Driver &D, const llvm::Triple& Triple)
+ : ToolChain(D, Triple), GCCInstallation(getDriver(), Triple) {
getProgramPaths().push_back(getDriver().getInstalledDir());
if (getDriver().getInstalledDir() != getDriver().Dir)
getProgramPaths().push_back(getDriver().Dir);
@@ -1461,9 +1458,8 @@ const char *Generic_GCC::GetForcedPicModel() const {
}
/// Hexagon Toolchain
-Hexagon_TC::Hexagon_TC(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : ToolChain(D, Triple, UserTriple) {
+Hexagon_TC::Hexagon_TC(const Driver &D, const llvm::Triple& Triple)
+ : ToolChain(D, Triple) {
getProgramPaths().push_back(getDriver().getInstalledDir());
if (getDriver().getInstalledDir() != getDriver().Dir.c_str())
getProgramPaths().push_back(getDriver().Dir);
@@ -1532,9 +1528,8 @@ const char *Hexagon_TC::GetForcedPicModel() const {
/// all subcommands. See http://tce.cs.tut.fi for our peculiar target.
/// Currently does not support anything else but compilation.
-TCEToolChain::TCEToolChain(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : ToolChain(D, Triple, UserTriple) {
+TCEToolChain::TCEToolChain(const Driver &D, const llvm::Triple& Triple)
+ : ToolChain(D, Triple) {
// Path mangling to find libexec
std::string Path(getDriver().Dir);
@@ -1586,9 +1581,8 @@ Tool &TCEToolChain::SelectTool(const Compilation &C,
/// OpenBSD - OpenBSD tool chain which can call as(1) and ld(1) directly.
-OpenBSD::OpenBSD(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : Generic_ELF(D, Triple, UserTriple) {
+OpenBSD::OpenBSD(const Driver &D, const llvm::Triple& Triple)
+ : Generic_ELF(D, Triple) {
getFilePaths().push_back(getDriver().Dir + "/../lib");
getFilePaths().push_back("/usr/lib");
}
@@ -1627,9 +1621,8 @@ Tool &OpenBSD::SelectTool(const Compilation &C, const JobAction &JA,
/// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
-FreeBSD::FreeBSD(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : Generic_ELF(D, Triple, UserTriple) {
+FreeBSD::FreeBSD(const Driver &D, const llvm::Triple& Triple)
+ : Generic_ELF(D, Triple) {
// When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall
// back to '/usr/lib' if it doesn't exist.
@@ -1674,9 +1667,8 @@ Tool &FreeBSD::SelectTool(const Compilation &C, const JobAction &JA,
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
-NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : Generic_ELF(D, Triple, UserTriple) {
+NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple)
+ : Generic_ELF(D, Triple) {
if (getDriver().UseStdLib) {
// When targeting a 32-bit platform, try the special directory used on
@@ -1725,9 +1717,8 @@ Tool &NetBSD::SelectTool(const Compilation &C, const JobAction &JA,
/// Minix - Minix tool chain which can call as(1) and ld(1) directly.
-Minix::Minix(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : Generic_ELF(D, Triple, UserTriple) {
+Minix::Minix(const Driver &D, const llvm::Triple& Triple)
+ : Generic_ELF(D, Triple) {
getFilePaths().push_back(getDriver().Dir + "/../lib");
getFilePaths().push_back("/usr/lib");
}
@@ -1757,9 +1748,8 @@ Tool &Minix::SelectTool(const Compilation &C, const JobAction &JA,
/// AuroraUX - AuroraUX tool chain which can call as(1) and ld(1) directly.
-AuroraUX::AuroraUX(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : Generic_GCC(D, Triple, UserTriple) {
+AuroraUX::AuroraUX(const Driver &D, const llvm::Triple& Triple)
+ : Generic_GCC(D, Triple) {
getProgramPaths().push_back(getDriver().getInstalledDir());
if (getDriver().getInstalledDir() != getDriver().Dir)
@@ -1974,9 +1964,8 @@ static void addPathIfExists(Twine Path, ToolChain::path_list &Paths) {
if (llvm::sys::fs::exists(Path)) Paths.push_back(Path.str());
}
-Linux::Linux(const Driver &D, const llvm::Triple &Triple,
- const std::string &UserTriple)
- : Generic_ELF(D, Triple, UserTriple) {
+Linux::Linux(const Driver &D, const llvm::Triple &Triple)
+ : Generic_ELF(D, Triple) {
llvm::Triple::ArchType Arch = Triple.getArch();
const std::string &SysRoot = getDriver().SysRoot;
@@ -2284,9 +2273,8 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
/// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
-DragonFly::DragonFly(const Driver &D, const llvm::Triple& Triple,
- const std::string &UserTriple)
- : Generic_ELF(D, Triple, UserTriple) {
+DragonFly::DragonFly(const Driver &D, const llvm::Triple& Triple)
+ : Generic_ELF(D, Triple) {
// Path mangling to find libexec
getProgramPaths().push_back(getDriver().getInstalledDir());
OpenPOWER on IntegriCloud