[cfe-commits] r68121 - in /cfe/trunk/lib/Driver: ToolChains.cpp Tools.cpp Tools.h
Daniel Dunbar
daniel at zuster.org
Tue Mar 31 10:45:15 PDT 2009
Author: ddunbar
Date: Tue Mar 31 12:45:15 2009
New Revision: 68121
URL: http://llvm.org/viewvc/llvm-project?rev=68121&view=rev
Log:
Driver: Call 'as' directly on FreeBSD.
- Patch by Ed Schouten!
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=68121&r1=68120&r2=68121&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Mar 31 12:45:15 2009
@@ -389,6 +389,8 @@
Tool *&T = Tools[Key];
if (!T) {
switch (Key) {
+ case Action::AssembleJobClass:
+ T = new tools::freebsd::Assemble(*this); break;
default:
T = &Generic_GCC::SelectTool(C, JA);
}
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=68121&r1=68120&r2=68121&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 31 12:45:15 2009
@@ -1451,3 +1451,39 @@
Args.MakeArgString(getToolChain().GetProgramPath(C, "lipo").c_str());
Dest.addCommand(new Command(Exec, CmdArgs));
}
+
+void freebsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
+ Job &Dest, const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const
+{
+ ArgStringList CmdArgs;
+
+ // Conceptually, i386 on x86_64 is a separate tool chain, but for
+ // now we just detect this situation by looking for -m32.
+ if (Args.hasArg(options::OPT_m32))
+ CmdArgs.push_back("--32");
+
+ Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
+ options::OPT_Xassembler);
+
+ CmdArgs.push_back("-o");
+ if (Output.isPipe())
+ CmdArgs.push_back("-");
+ else
+ CmdArgs.push_back(Output.getFilename());
+
+ for (InputInfoList::const_iterator
+ it = Inputs.begin(), ie = Inputs.end(); it != ie; ++it) {
+ const InputInfo &II = *it;
+ if (II.isPipe())
+ CmdArgs.push_back("-");
+ else
+ CmdArgs.push_back(II.getFilename());
+ }
+
+ const char *Exec =
+ Args.MakeArgString(getToolChain().GetProgramPath(C, "as").c_str());
+ Dest.addCommand(new Command(Exec, CmdArgs));
+}
Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=68121&r1=68120&r2=68121&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Tue Mar 31 12:45:15 2009
@@ -233,6 +233,25 @@
};
}
+ /// freebsd -- Directly call GNU Binutils assembler and linker
+namespace freebsd {
+ class VISIBILITY_HIDDEN Assemble : public Tool {
+ public:
+ Assemble(const ToolChain &TC) : Tool("freebsd::Assemble", TC) {}
+
+ virtual bool acceptsPipedInput() const { return true; }
+ virtual bool canPipeOutput() const { return true; }
+ virtual bool hasIntegratedCPP() const { return false; }
+
+ virtual void ConstructJob(Compilation &C, const JobAction &JA,
+ Job &Dest,
+ const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &TCArgs,
+ const char *LinkingOutput) const;
+ };
+}
+
} // end namespace toolchains
} // end namespace driver
} // end namespace clang
More information about the cfe-commits
mailing list