Driver: Fix fallback to gcc to -c instead of -S if trying to generate an LLVM bc

file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94463 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2010-01-25 22:35:08 +00:00
Родитель a297de20bd
Коммит 82b51cce8c
2 изменённых файлов: 28 добавлений и 13 удалений

Просмотреть файл

@ -1213,7 +1213,7 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
}
}
RenderExtraToolArgs(CmdArgs);
RenderExtraToolArgs(JA, CmdArgs);
// If using a driver driver, force the arch.
const std::string &Arch = getToolChain().getArchName();
@ -1291,23 +1291,32 @@ void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
void gcc::Preprocess::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
void gcc::Preprocess::RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const {
CmdArgs.push_back("-E");
}
void gcc::Precompile::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
void gcc::Precompile::RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const {
// The type is good enough.
}
void gcc::Compile::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
CmdArgs.push_back("-S");
void gcc::Compile::RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const {
// If -flto, etc. are present then make sure not to force assembly output.
if (JA.getType() == types::TY_LLVMBC)
CmdArgs.push_back("-c");
else
CmdArgs.push_back("-S");
}
void gcc::Assemble::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
void gcc::Assemble::RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const {
CmdArgs.push_back("-c");
}
void gcc::Link::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
void gcc::Link::RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const {
// The types are (hopefully) good enough.
}

Просмотреть файл

@ -66,7 +66,8 @@ namespace gcc {
/// RenderExtraToolArgs - Render any arguments necessary to force
/// the particular tool mode.
virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const = 0;
virtual void RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const = 0;
};
@ -78,7 +79,8 @@ namespace gcc {
virtual bool canPipeOutput() const { return true; }
virtual bool hasIntegratedCPP() const { return false; }
virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
virtual void RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const;
};
class VISIBILITY_HIDDEN Precompile : public Common {
@ -89,7 +91,8 @@ namespace gcc {
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return true; }
virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
virtual void RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const;
};
class VISIBILITY_HIDDEN Compile : public Common {
@ -100,7 +103,8 @@ namespace gcc {
virtual bool canPipeOutput() const { return true; }
virtual bool hasIntegratedCPP() const { return true; }
virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
virtual void RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const;
};
class VISIBILITY_HIDDEN Assemble : public Common {
@ -111,7 +115,8 @@ namespace gcc {
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return false; }
virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
virtual void RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const;
};
class VISIBILITY_HIDDEN Link : public Common {
@ -122,7 +127,8 @@ namespace gcc {
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return false; }
virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
virtual void RenderExtraToolArgs(const JobAction &JA,
ArgStringList &CmdArgs) const;
};
} // end namespace gcc