[cfe-commits] r82209 - in /cfe/trunk/lib/Driver: ToolChains.cpp ToolChains.h Tools.cpp
Daniel Dunbar
daniel at zuster.org
Fri Sep 18 01:14:36 PDT 2009
Author: ddunbar
Date: Fri Sep 18 03:14:36 2009
New Revision: 82209
URL: http://llvm.org/viewvc/llvm-project?rev=82209&view=rev
Log:
Lift AddLinkerSearchPaths() into Darwin tool chain.
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=82209&r1=82208&r2=82209&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Sep 18 03:14:36 2009
@@ -60,32 +60,32 @@
if (getArchName() == "x86_64") {
Path = getHost().getDriver().Dir;
Path += "/../lib/gcc/";
- Path += getToolChainDir();
+ Path += ToolChainDir;
Path += "/x86_64";
getFilePaths().push_back(Path);
Path = "/usr/lib/gcc/";
- Path += getToolChainDir();
+ Path += ToolChainDir;
Path += "/x86_64";
getFilePaths().push_back(Path);
}
Path = getHost().getDriver().Dir;
Path += "/../lib/gcc/";
- Path += getToolChainDir();
+ Path += ToolChainDir;
getFilePaths().push_back(Path);
Path = "/usr/lib/gcc/";
- Path += getToolChainDir();
+ Path += ToolChainDir;
getFilePaths().push_back(Path);
Path = getHost().getDriver().Dir;
Path += "/../libexec/gcc/";
- Path += getToolChainDir();
+ Path += ToolChainDir;
getProgramPaths().push_back(Path);
Path = "/usr/libexec/gcc/";
- Path += getToolChainDir();
+ Path += ToolChainDir;
getProgramPaths().push_back(Path);
Path = getHost().getDriver().Dir;
@@ -134,6 +134,26 @@
return *T;
}
+void Darwin::AddLinkSearchPathArgs(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
+ // 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));
+ 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));
+ CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
+ "/../../../" + ToolChainDir));
+ CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + ToolChainDir +
+ "/../../.."));
+}
+
DerivedArgList *Darwin::TranslateArgs(InputArgList &Args,
const char *BoundArch) const {
DerivedArgList *DAL = new DerivedArgList(Args, false);
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=82209&r1=82208&r2=82209&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Fri Sep 18 03:14:36 2009
@@ -76,6 +76,9 @@
bool IsIPhone);
~Darwin();
+ /// @name Darwin Specific Toolchain API
+ /// {
+
void getDarwinVersion(unsigned (&Res)[3]) const {
Res[0] = DarwinVersion[0];
Res[1] = DarwinVersion[1];
@@ -96,12 +99,19 @@
return IPhoneOSVersionMin.c_str();
}
- const std::string &getToolChainDir() const {
- return ToolChainDir;
- }
+ /// AddLinkSearchPathArgs - Add the linker search paths to \arg CmdArgs.
+ ///
+ /// \param Args - The input argument list.
+ /// \param CmdArgs [out] - The command argument list to append the paths
+ /// (prefixed by -L) to.
+ void AddLinkSearchPathArgs(const ArgList &Args, ArgStringList &CmdArgs) const;
bool isIPhone() const { return IsIPhone; }
+ /// }
+ /// @name ToolChain Implementation
+ /// {
+
virtual DerivedArgList *TranslateArgs(InputArgList &Args,
const char *BoundArch) const;
@@ -111,6 +121,8 @@
virtual bool IsUnwindTablesDefault() const;
virtual const char *GetDefaultRelocationModel() const;
virtual const char *GetForcedPicModel() const;
+
+ /// }
};
/// Darwin_GCC - Generic Darwin tool chain using gcc.
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=82209&r1=82208&r2=82209&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Sep 18 03:14:36 2009
@@ -2008,23 +2008,7 @@
// This is more complicated in gcc...
CmdArgs.push_back("-lgomp");
- // FIXME: Derive these correctly.
- llvm::StringRef TCDir = getDarwinToolChain().getToolChainDir();
- if (getToolChain().getArchName() == "x86_64") {
- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + TCDir +
- "/x86_64"));
- // Intentionally duplicated for (temporary) gcc bug compatibility.
- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + TCDir +
- "/x86_64"));
- }
- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/" + TCDir));
- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + TCDir));
- // Intentionally duplicated for (temporary) gcc bug compatibility.
- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + TCDir));
- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + TCDir +
- "/../../../" + TCDir));
- CmdArgs.push_back(Args.MakeArgString("-L/usr/lib/gcc/" + TCDir +
- "/../../.."));
+ getDarwinToolChain().AddLinkSearchPathArgs(Args, CmdArgs);
for (InputInfoList::const_iterator
it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) {
More information about the cfe-commits
mailing list