forked from OSchip/llvm-project
Driver/Darwin: Kill the DarwinGCC toolchain.
llvm-svn: 127896
This commit is contained in:
parent
0984dcc077
commit
50fab351d7
|
@ -113,14 +113,9 @@ ToolChain *DarwinHostInfo::CreateToolChain(const ArgList &Args,
|
|||
TCTriple.setArch(Arch);
|
||||
|
||||
// If we recognized the arch, match it to the toolchains we support.
|
||||
const char *UseNewToolChain = ::getenv("CCC_ENABLE_NEW_DARWIN_TOOLCHAIN");
|
||||
if (UseNewToolChain ||
|
||||
Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64 ||
|
||||
if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64 ||
|
||||
Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) {
|
||||
TC = new toolchains::DarwinClang(*this, TCTriple);
|
||||
} else if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64) {
|
||||
// We still use the legacy DarwinGCC toolchain on X86.
|
||||
TC = new toolchains::DarwinGCC(*this, TCTriple);
|
||||
} else
|
||||
TC = new toolchains::Darwin_Generic_GCC(*this, TCTriple);
|
||||
}
|
||||
|
|
|
@ -130,82 +130,6 @@ llvm::StringRef Darwin::getDarwinArchName(const ArgList &Args) const {
|
|||
}
|
||||
}
|
||||
|
||||
DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple)
|
||||
: Darwin(Host, Triple)
|
||||
{
|
||||
// We can only work with 4.2.1 currently.
|
||||
GCCVersion[0] = 4;
|
||||
GCCVersion[1] = 2;
|
||||
GCCVersion[2] = 1;
|
||||
|
||||
// Set up the tool chain paths to match gcc.
|
||||
ToolChainDir = "i686-apple-darwin";
|
||||
ToolChainDir += llvm::utostr(DarwinVersion[0]);
|
||||
ToolChainDir += "/";
|
||||
ToolChainDir += llvm::utostr(GCCVersion[0]);
|
||||
ToolChainDir += '.';
|
||||
ToolChainDir += llvm::utostr(GCCVersion[1]);
|
||||
ToolChainDir += '.';
|
||||
ToolChainDir += llvm::utostr(GCCVersion[2]);
|
||||
|
||||
// Try the next major version if that tool chain dir is invalid.
|
||||
std::string Tmp = "/usr/lib/gcc/" + ToolChainDir;
|
||||
bool Exists;
|
||||
if (llvm::sys::fs::exists(Tmp, Exists) || Exists) {
|
||||
std::string Next = "i686-apple-darwin";
|
||||
Next += llvm::utostr(DarwinVersion[0] + 1);
|
||||
Next += "/";
|
||||
Next += llvm::utostr(GCCVersion[0]);
|
||||
Next += '.';
|
||||
Next += llvm::utostr(GCCVersion[1]);
|
||||
Next += '.';
|
||||
Next += llvm::utostr(GCCVersion[2]);
|
||||
|
||||
// Use that if it exists, otherwise hope the user isn't linking.
|
||||
//
|
||||
// FIXME: Drop dependency on gcc's tool chain.
|
||||
Tmp = "/usr/lib/gcc/" + Next;
|
||||
if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
|
||||
ToolChainDir = Next;
|
||||
}
|
||||
|
||||
std::string Path;
|
||||
if (getArchName() == "x86_64") {
|
||||
Path = getDriver().Dir;
|
||||
Path += "/../lib/gcc/";
|
||||
Path += ToolChainDir;
|
||||
Path += "/x86_64";
|
||||
getFilePaths().push_back(Path);
|
||||
|
||||
Path = "/usr/lib/gcc/";
|
||||
Path += ToolChainDir;
|
||||
Path += "/x86_64";
|
||||
getFilePaths().push_back(Path);
|
||||
}
|
||||
|
||||
Path = getDriver().Dir;
|
||||
Path += "/../lib/gcc/";
|
||||
Path += ToolChainDir;
|
||||
getFilePaths().push_back(Path);
|
||||
|
||||
Path = "/usr/lib/gcc/";
|
||||
Path += ToolChainDir;
|
||||
getFilePaths().push_back(Path);
|
||||
|
||||
Path = getDriver().Dir;
|
||||
Path += "/../libexec/gcc/";
|
||||
Path += ToolChainDir;
|
||||
getProgramPaths().push_back(Path);
|
||||
|
||||
Path = "/usr/libexec/gcc/";
|
||||
Path += ToolChainDir;
|
||||
getProgramPaths().push_back(Path);
|
||||
|
||||
getProgramPaths().push_back(getDriver().getInstalledDir());
|
||||
if (getDriver().getInstalledDir() != getDriver().Dir)
|
||||
getProgramPaths().push_back(getDriver().Dir);
|
||||
}
|
||||
|
||||
Darwin::~Darwin() {
|
||||
// Free tool implementations.
|
||||
for (llvm::DenseMap<unsigned, Tool*>::iterator
|
||||
|
@ -294,87 +218,6 @@ Tool &Darwin::SelectTool(const Compilation &C, const JobAction &JA) const {
|
|||
return *T;
|
||||
}
|
||||
|
||||
void DarwinGCC::AddLinkSearchPathArgs(const ArgList &Args,
|
||||
ArgStringList &CmdArgs) const {
|
||||
std::string Tmp;
|
||||
|
||||
// FIXME: Derive these correctly.
|
||||
if (getArchName() == "x86_64") {
|
||||
CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
|
||||
"/x86_64"));
|
||||
// Intentionally duplicated for (temporary) gcc bug compatibility.
|
||||
CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
|
||||
"/x86_64"));
|
||||
}
|
||||
|
||||
CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/" + ToolChainDir));
|
||||
|
||||
Tmp = getDriver().Dir + "/../lib/gcc/" + ToolChainDir;
|
||||
bool Exists;
|
||||
if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
|
||||
CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
|
||||
Tmp = getDriver().Dir + "/../lib/gcc";
|
||||
if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
|
||||
CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
|
||||
CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir));
|
||||
// Intentionally duplicated for (temporary) gcc bug compatibility.
|
||||
CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir));
|
||||
Tmp = getDriver().Dir + "/../lib/" + ToolChainDir;
|
||||
if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
|
||||
CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
|
||||
Tmp = getDriver().Dir + "/../lib";
|
||||
if (!llvm::sys::fs::exists(Tmp, Exists) && Exists)
|
||||
CmdArgs.push_back(Args.MakeArgString("-L" + Tmp));
|
||||
CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
|
||||
"/../../../" + ToolChainDir));
|
||||
CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
|
||||
"/../../.."));
|
||||
}
|
||||
|
||||
void DarwinGCC::AddLinkRuntimeLibArgs(const ArgList &Args,
|
||||
ArgStringList &CmdArgs) const {
|
||||
// Note that this routine is only used for targetting OS X.
|
||||
|
||||
// Derived from libgcc and lib specs but refactored.
|
||||
if (Args.hasArg(options::OPT_static)) {
|
||||
CmdArgs.push_back("-lgcc_static");
|
||||
} else {
|
||||
if (Args.hasArg(options::OPT_static_libgcc)) {
|
||||
CmdArgs.push_back("-lgcc_eh");
|
||||
} else if (Args.hasArg(options::OPT_miphoneos_version_min_EQ)) {
|
||||
// Derived from darwin_iphoneos_libgcc spec.
|
||||
if (isTargetIPhoneOS()) {
|
||||
CmdArgs.push_back("-lgcc_s.1");
|
||||
} else {
|
||||
CmdArgs.push_back("-lgcc_s.10.5");
|
||||
}
|
||||
} else if (Args.hasArg(options::OPT_shared_libgcc) ||
|
||||
Args.hasFlag(options::OPT_fexceptions,
|
||||
options::OPT_fno_exceptions) ||
|
||||
Args.hasArg(options::OPT_fgnu_runtime)) {
|
||||
// FIXME: This is probably broken on 10.3?
|
||||
if (isMacosxVersionLT(10, 5))
|
||||
CmdArgs.push_back("-lgcc_s.10.4");
|
||||
else if (isMacosxVersionLT(10, 6))
|
||||
CmdArgs.push_back("-lgcc_s.10.5");
|
||||
} else {
|
||||
if (isMacosxVersionLT(10, 3, 9))
|
||||
; // Do nothing.
|
||||
else if (isMacosxVersionLT(10, 5))
|
||||
CmdArgs.push_back("-lgcc_s.10.4");
|
||||
else if (isMacosxVersionLT(10, 6))
|
||||
CmdArgs.push_back("-lgcc_s.10.5");
|
||||
}
|
||||
|
||||
if (isTargetIPhoneOS() || isMacosxVersionLT(10, 6)) {
|
||||
CmdArgs.push_back("-lgcc");
|
||||
CmdArgs.push_back("-lSystem");
|
||||
} else {
|
||||
CmdArgs.push_back("-lSystem");
|
||||
CmdArgs.push_back("-lgcc");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DarwinClang::DarwinClang(const HostInfo &Host, const llvm::Triple& Triple)
|
||||
: Darwin(Host, Triple)
|
||||
|
|
|
@ -246,29 +246,6 @@ public:
|
|||
/// }
|
||||
};
|
||||
|
||||
/// DarwinGCC - The Darwin toolchain used by GCC.
|
||||
class LLVM_LIBRARY_VISIBILITY DarwinGCC : public Darwin {
|
||||
/// GCC version to use.
|
||||
unsigned GCCVersion[3];
|
||||
|
||||
/// The directory suffix for this tool chain.
|
||||
std::string ToolChainDir;
|
||||
|
||||
public:
|
||||
DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple);
|
||||
|
||||
/// @name Darwin ToolChain Implementation
|
||||
/// {
|
||||
|
||||
virtual void AddLinkSearchPathArgs(const ArgList &Args,
|
||||
ArgStringList &CmdArgs) const;
|
||||
|
||||
virtual void AddLinkRuntimeLibArgs(const ArgList &Args,
|
||||
ArgStringList &CmdArgs) const;
|
||||
|
||||
/// }
|
||||
};
|
||||
|
||||
/// Darwin_Generic_GCC - Generic Darwin tool chain using gcc.
|
||||
class LLVM_LIBRARY_VISIBILITY Darwin_Generic_GCC : public Generic_GCC {
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue