// The types are (hopefully) good enough.
}
+void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
+ Job &Dest, const InputInfo &Output,
+ const InputInfoList &Inputs,
+ const ArgList &Args,
+ const char *LinkingOutput) const {
+ ArgStringList CmdArgs;
+
+ assert(Inputs.size() == 1 && "Unexpected number of inputs.");
+ const InputInfo &Input = Inputs[0];
+
+ // Bit of a hack, this is only used for original inputs.
+ if (Input.isFilename() &&
+ strcmp(Input.getFilename(), Input.getBaseInput()) == 0 &&
+ Args.hasArg(options::OPT_g_Group))
+ CmdArgs.push_back("--gstabs");
+
+ // Derived from asm spec.
+ CmdArgs.push_back("-arch");
+ CmdArgs.push_back(getToolChain().getArchName().c_str());
+
+ CmdArgs.push_back("-force_cpusubtype_ALL");
+ if ((Args.hasArg(options::OPT_mkernel) ||
+ Args.hasArg(options::OPT_static) ||
+ Args.hasArg(options::OPT_fapple_kext)) &&
+ !Args.hasArg(options::OPT_dynamic))
+ CmdArgs.push_back("-static");
+
+ Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
+ options::OPT_Xassembler);
+
+ assert(Output.isFilename() && "Unexpected lipo output.");
+ CmdArgs.push_back("-o");
+ CmdArgs.push_back(Output.getFilename());
+
+ if (Input.isPipe()) {
+ CmdArgs.push_back("-");
+ } else {
+ assert(Input.isFilename() && "Invalid input.");
+ CmdArgs.push_back(Input.getFilename());
+ }
+
+ // asm_final spec is empty.
+
+ const char *Exec =
+ Args.MakeArgString(getToolChain().GetProgramPath(C, "as").c_str());
+ Dest.addCommand(new Command(Exec, CmdArgs));
+}
void darwin::Lipo::ConstructJob(Compilation &C, const JobAction &JA,
- Job &Dest,
- const InputInfo &Output,
+ Job &Dest, const InputInfo &Output,
const InputInfoList &Inputs,
const ArgList &Args,
const char *LinkingOutput) const {
} // end namespace gcc
namespace darwin {
+ class VISIBILITY_HIDDEN Assemble : public Tool {
+ public:
+ Assemble(const ToolChain &TC) : Tool("darwin::Assemble", TC) {}
+
+ virtual bool acceptsPipedInput() const { return true; }
+ virtual bool canPipeOutput() const { return false; }
+ 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;
+ };
+
class VISIBILITY_HIDDEN Lipo : public Tool {
public:
- Lipo(const ToolChain &TC) : Tool("gcc::Link", TC) {}
+ Lipo(const ToolChain &TC) : Tool("darwin::Lipo", TC) {}
virtual bool acceptsPipedInput() const { return false; }
virtual bool canPipeOutput() const { return false; }
// Basic binding.
-// RUN: clang-driver -ccc-print-bindings %s &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-print-bindings %s &> %t &&
// RUN: grep 'bind - "clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t &&
// RUN: grep 'bind - "gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t &&
// RUN: grep 'bind - "gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t &&
-// RUN: clang-driver -ccc-print-bindings -ccc-no-clang %s &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang %s &> %t &&
// RUN: grep 'bind - "gcc::Compile", inputs: \[".*bindings.c"\], output: ".*\.s"' %t &&
// RUN: grep 'bind - "gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t &&
// RUN: grep 'bind - "gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t &&
-// RUN: clang-driver -ccc-print-bindings -ccc-no-clang -no-integrated-cpp %s &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -no-integrated-cpp %s &> %t &&
// RUN: grep 'bind - "gcc::Preprocess", inputs: \[".*bindings.c"\], output: ".*\.i"' %t &&
// RUN: grep 'bind - "gcc::Compile", inputs: \[".*\.i"\], output: ".*\.s"' %t &&
// RUN: grep 'bind - "gcc::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t &&
// RUN: grep 'bind - "gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t &&
-// RUN: clang-driver -ccc-print-bindings -ccc-no-clang -no-integrated-cpp -pipe %s &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -no-integrated-cpp -pipe %s &> %t &&
// RUN: grep 'bind - "gcc::Preprocess", inputs: \[".*bindings.c"\], output: (pipe)' %t &&
// RUN: grep 'bind - "gcc::Compile", inputs: \[(pipe)\], output: (pipe)' %t &&
// RUN: grep 'bind - "gcc::Assemble", inputs: \[(pipe)\], output: ".*\.o"' %t &&
// RUN: grep 'bind - "gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t &&
-// RUN: clang-driver -ccc-print-bindings -ccc-no-clang -x c-header %s &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -x c-header %s &> %t &&
// RUN: grep 'bind - "gcc::Precompile", inputs: \[".*bindings.c"\], output: ".*bindings.c.gch' %t &&
// Clang control options
-// RUN: clang-driver -ccc-print-bindings -fsyntax-only %s &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -fsyntax-only %s &> %t &&
// RUN: grep 'bind - "clang", inputs: \[".*bindings.c"\], output: (nothing)' %t &&
-// RUN: clang-driver -ccc-print-bindings -ccc-no-clang -fsyntax-only %s &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang -fsyntax-only %s &> %t &&
// RUN: grep 'bind - "gcc::Compile", inputs: \[".*bindings.c"\], output: (nothing)' %t &&
-// RUN: clang-driver -ccc-print-bindings -ccc-no-clang-cxx -fsyntax-only -x c++ %s &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-print-bindings -ccc-no-clang-cxx -fsyntax-only -x c++ %s &> %t &&
// RUN: grep 'bind - "gcc::Compile", inputs: \[".*bindings.c"\], output: (nothing)' %t &&
// RUN: clang-driver -ccc-print-bindings -ccc-no-clang-cpp -fsyntax-only -no-integrated-cpp -x c++ %s &> %t &&
// RUN: grep 'bind - "gcc::Preprocess", inputs: \[".*bindings.c"\], output: ".*\.ii"' %t &&
// RUN: grep 'bind - "clang", inputs: \[".*\.ii"\], output: (nothing)' %t &&
-// RUN: clang-driver -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs i386 %s -S -arch ppc &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs i386 %s -S -arch ppc &> %t &&
// RUN: grep 'bind - "gcc::Compile", inputs: \[".*bindings.c"\], output: "bindings.s"' %t &&
-// RUN: clang-driver -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs ppc %s -S -arch ppc &> %t &&
+// RUN: clang-driver -ccc-host-triple i386-unknown-unknown -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings -ccc-clang-archs ppc %s -S -arch ppc &> %t &&
// RUN: grep 'bind - "clang", inputs: \[".*bindings.c"\], output: "bindings.s"' %t &&
+// Darwin bindings
+// RUN: clang-driver -ccc-host-triple i386-apple-darwin9 -ccc-print-bindings %s &> %t &&
+// RUN: grep 'bind - "clang", inputs: \[".*bindings.c"\], output: ".*\.s"' %t &&
+// RUN: grep 'bind - "darwin::Assemble", inputs: \[".*\.s"\], output: ".*\.o"' %t &&
+// RUN: grep 'bind - "gcc::Link", inputs: \[".*\.o"\], output: "a.out"' %t &&
+
// RUN: true