svn commit: r199767 - in projects/clangbsd/contrib/llvm/tools/clang:
include/clang/Driver lib/Driver
Roman Divacky
rdivacky at FreeBSD.org
Tue Nov 24 21:06:42 UTC 2009
Author: rdivacky
Date: Tue Nov 24 21:06:41 2009
New Revision: 199767
URL: http://svn.freebsd.org/changeset/base/199767
Log:
Always link crt* stuff from /usr/lib/ or /usr/lib32
depending on wheteher we are cross compiling or not.
This reveales a problem wth lib32 build that I am going to fix.
Modified:
projects/clangbsd/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h
projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/HostInfo.cpp
projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
Modified: projects/clangbsd/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h
==============================================================================
--- projects/clangbsd/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h Tue Nov 24 21:04:23 2009 (r199766)
+++ projects/clangbsd/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h Tue Nov 24 21:06:41 2009 (r199767)
@@ -27,6 +27,7 @@ namespace driver {
/// ToolChain - Access to tools for a single platform.
class ToolChain {
public:
+ bool Lib32;
typedef llvm::SmallVector<std::string, 4> path_list;
private:
Modified: projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/HostInfo.cpp
==============================================================================
--- projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/HostInfo.cpp Tue Nov 24 21:04:23 2009 (r199766)
+++ projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/HostInfo.cpp Tue Nov 24 21:06:41 2009 (r199767)
@@ -379,6 +379,7 @@ ToolChain *FreeBSDHostInfo::CreateToolCh
TCTriple.setArchName(ArchName);
TC = new toolchains::FreeBSD(*this, TCTriple, Lib32);
+ TC->Lib32 = Lib32;
}
return TC;
Modified: projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp
==============================================================================
--- projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp Tue Nov 24 21:04:23 2009 (r199766)
+++ projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp Tue Nov 24 21:06:41 2009 (r199767)
@@ -651,10 +651,8 @@ Tool &OpenBSD::SelectTool(const Compilat
FreeBSD::FreeBSD(const HostInfo &Host, const llvm::Triple& Triple, bool Lib32)
: Generic_GCC(Host, Triple) {
if (Lib32) {
- getFilePaths().push_back(getHost().getDriver().Dir + "/../lib32");
getFilePaths().push_back("/usr/lib32");
} else {
- getFilePaths().push_back(getHost().getDriver().Dir + "/../lib");
getFilePaths().push_back("/usr/lib");
}
}
Modified: projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==============================================================================
--- projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Tue Nov 24 21:04:23 2009 (r199766)
+++ projects/clangbsd/contrib/llvm/tools/clang/lib/Driver/Tools.cpp Tue Nov 24 21:06:41 2009 (r199767)
@@ -2543,6 +2543,7 @@ void freebsd::Link::ConstructJob(Compila
const char *LinkingOutput) const {
const Driver &D = getToolChain().getHost().getDriver();
ArgStringList CmdArgs;
+ std::string LibPrefix("/usr/lib/");
if (Args.hasArg(options::OPT_static)) {
CmdArgs.push_back("-Bstatic");
@@ -2561,6 +2562,8 @@ void freebsd::Link::ConstructJob(Compila
if (getToolChain().getArchName() == "i386") {
CmdArgs.push_back("-m");
CmdArgs.push_back("elf_i386_fbsd");
+ if (getToolChain().Lib32)
+ LibPrefix = "/usr/lib32/";
}
if (Output.isPipe()) {
@@ -2576,12 +2579,12 @@ void freebsd::Link::ConstructJob(Compila
if (!Args.hasArg(options::OPT_nostdlib) &&
!Args.hasArg(options::OPT_nostartfiles)) {
if (!Args.hasArg(options::OPT_shared)) {
- CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crt1.o")));
- CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crti.o")));
- CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtbegin.o")));
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, (LibPrefix + "crt1.o").c_str())));
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, (LibPrefix + "crti.o").c_str())));
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, (LibPrefix + "crtbegin.o").c_str())));
} else {
- CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crti.o")));
- CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtbeginS.o")));
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, (LibPrefix + "crti.o").c_str())));
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, (LibPrefix + "crtbeginS.o").c_str())));
}
}
@@ -2642,10 +2645,10 @@ void freebsd::Link::ConstructJob(Compila
if (!Args.hasArg(options::OPT_nostdlib) &&
!Args.hasArg(options::OPT_nostartfiles)) {
if (!Args.hasArg(options::OPT_shared))
- CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtend.o")));
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, (LibPrefix + "crtend.o").c_str())));
else
- CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtendS.o")));
- CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtn.o")));
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, (LibPrefix + "crtendS.o").c_str())));
+ CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, (LibPrefix + "crtn.o").c_str())));
}
const char *Exec =
More information about the svn-src-projects
mailing list