r275895 - [Driver] Compute effective target triples once per job (NFCI)
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 18 12:56:39 PDT 2016
Author: vedantk
Date: Mon Jul 18 14:56:38 2016
New Revision: 275895
URL: http://llvm.org/viewvc/llvm-project?rev=275895&view=rev
Log:
[Driver] Compute effective target triples once per job (NFCI)
Compute an effective target triple exactly once in ConstructJob(), and
then simply pass around references to it. This eliminates wasteful
re-computation of effective triples (e.g in getARMFloatABI()).
Differential Revision: https://reviews.llvm.org/D22290
Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/include/clang/Driver/SanitizerArgs.h
cfe/trunk/include/clang/Driver/Tool.h
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Mon Jul 18 14:56:38 2016
@@ -121,7 +121,8 @@ These are major API changes that have ha
Clang. If upgrading an external codebase that uses Clang as a library,
this section should help get you past the largest hurdles of upgrading.
-- ...
+- Classes which inherit from ``driver::Tool`` must be updated to use effective
+ target triples when constructing jobs.
AST Matchers
------------
Modified: cfe/trunk/include/clang/Driver/SanitizerArgs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/SanitizerArgs.h?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/SanitizerArgs.h (original)
+++ cfe/trunk/include/clang/Driver/SanitizerArgs.h Mon Jul 18 14:56:38 2016
@@ -16,6 +16,10 @@
#include <string>
#include <vector>
+namespace llvm {
+class Triple;
+}
+
namespace clang {
namespace driver {
@@ -66,7 +70,8 @@ class SanitizerArgs {
bool requiresPIE() const;
bool needsUnwindTables() const;
bool linkCXXRuntimes() const { return LinkCXXRuntimes; }
- void addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
+ void addArgs(const ToolChain &TC, const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const;
};
Modified: cfe/trunk/include/clang/Driver/Tool.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Tool.h?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Tool.h (original)
+++ cfe/trunk/include/clang/Driver/Tool.h Mon Jul 18 14:56:38 2016
@@ -14,6 +14,7 @@
#include "llvm/Support/Program.h"
namespace llvm {
+class Triple;
namespace opt {
class ArgList;
}
@@ -127,6 +128,7 @@ public:
virtual void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const = 0;
};
Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Mon Jul 18 14:56:38 2016
@@ -260,11 +260,13 @@ public:
return ToolChain::CST_Libstdcxx;
}
- virtual std::string getCompilerRT(const llvm::opt::ArgList &Args,
+ virtual std::string getCompilerRT(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
StringRef Component,
bool Shared = false) const;
- const char *getCompilerRTArgString(const llvm::opt::ArgList &Args,
+ const char *getCompilerRTArgString(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
StringRef Component,
bool Shared = false) const;
/// needsProfileRT - returns true if instrumentation profile is on.
@@ -410,7 +412,8 @@ public:
const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const;
/// addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass
/// a suitable profile runtime library to the linker.
- virtual void addProfileRTLibs(const llvm::opt::ArgList &Args,
+ virtual void addProfileRTLibs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
/// \brief Add arguments to use system-specific CUDA includes.
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Jul 18 14:56:38 2016
@@ -2256,7 +2256,21 @@ InputInfo Driver::BuildJobsForActionNoCa
TC->getTriple().normalize()),
BaseInput);
+ llvm::Triple EffectiveTriple;
+ const ArgList &Args = C.getArgsForToolChain(TC, BoundArch);
+ if (InputInfos.size() != 1) {
+ EffectiveTriple = llvm::Triple(
+ T->getToolChain().ComputeEffectiveClangTriple(Args));
+ } else {
+ // Pass along the input type if it can be unambiguously determined.
+ EffectiveTriple =
+ llvm::Triple(T->getToolChain().ComputeEffectiveClangTriple(
+ Args, InputInfos[0].getType()));
+ }
+
if (CCCPrintBindings && !CCGenDiagnostics) {
+ // FIXME: We should be able to use the effective triple here, but doing so
+ // breaks some multi-arch tests.
llvm::errs() << "# \"" << T->getToolChain().getTripleString() << '"'
<< " - \"" << T->getName() << "\", inputs: [";
for (unsigned i = 0, e = InputInfos.size(); i != e; ++i) {
@@ -2266,7 +2280,7 @@ InputInfo Driver::BuildJobsForActionNoCa
}
llvm::errs() << "], output: " << Result.getAsString() << "\n";
} else {
- T->ConstructJob(C, *JA, Result, InputInfos,
+ T->ConstructJob(C, *JA, Result, InputInfos, EffectiveTriple,
C.getArgsForToolChain(TC, BoundArch), LinkingOutput);
}
return Result;
Modified: cfe/trunk/lib/Driver/SanitizerArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.cpp?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/SanitizerArgs.cpp (original)
+++ cfe/trunk/lib/Driver/SanitizerArgs.cpp Mon Jul 18 14:56:38 2016
@@ -602,7 +602,9 @@ static void addIncludeLinkerOption(const
CmdArgs.push_back(Args.MakeArgString(LinkerOptionFlag));
}
-void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
+void SanitizerArgs::addArgs(const ToolChain &TC,
+ const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs,
types::ID InputType) const {
// Translate available CoverageFeatures to corresponding clang-cc1 flags.
@@ -626,21 +628,24 @@ void SanitizerArgs::addArgs(const ToolCh
// Instruct the code generator to embed linker directives in the object file
// that cause the required runtime libraries to be linked.
CmdArgs.push_back(Args.MakeArgString(
- "--dependent-lib=" + TC.getCompilerRT(Args, "ubsan_standalone")));
+ "--dependent-lib=" +
+ TC.getCompilerRT(EffectiveTriple, Args, "ubsan_standalone")));
if (types::isCXX(InputType))
CmdArgs.push_back(Args.MakeArgString(
- "--dependent-lib=" + TC.getCompilerRT(Args, "ubsan_standalone_cxx")));
+ "--dependent-lib=" +
+ TC.getCompilerRT(EffectiveTriple, Args, "ubsan_standalone_cxx")));
}
if (TC.getTriple().isOSWindows() && needsStatsRt()) {
- CmdArgs.push_back(Args.MakeArgString("--dependent-lib=" +
- TC.getCompilerRT(Args, "stats_client")));
+ CmdArgs.push_back(Args.MakeArgString(
+ "--dependent-lib=" +
+ TC.getCompilerRT(EffectiveTriple, Args, "stats_client")));
// The main executable must export the stats runtime.
// FIXME: Only exporting from the main executable (e.g. based on whether the
// translation unit defines main()) would save a little space, but having
// multiple copies of the runtime shouldn't hurt.
- CmdArgs.push_back(Args.MakeArgString("--dependent-lib=" +
- TC.getCompilerRT(Args, "stats")));
+ CmdArgs.push_back(Args.MakeArgString(
+ "--dependent-lib=" + TC.getCompilerRT(EffectiveTriple, Args, "stats")));
addIncludeLinkerOption(TC, Args, CmdArgs, "__sanitizer_stats_register");
}
Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Jul 18 14:56:38 2016
@@ -267,46 +267,52 @@ Tool *ToolChain::getTool(Action::ActionC
llvm_unreachable("Invalid tool kind.");
}
-static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
- const ArgList &Args) {
- const llvm::Triple &Triple = TC.getTriple();
- bool IsWindows = Triple.isOSWindows();
+static StringRef
+getArchNameForCompilerRTLib(const ToolChain &TC,
+ const llvm::Triple &EffectiveTriple,
+ const ArgList &Args) {
+ bool IsWindows = EffectiveTriple.isOSWindows();
- if (Triple.isWindowsMSVCEnvironment() && TC.getArch() == llvm::Triple::x86)
+ if (EffectiveTriple.isWindowsMSVCEnvironment() &&
+ TC.getArch() == llvm::Triple::x86)
return "i386";
if (TC.getArch() == llvm::Triple::arm || TC.getArch() == llvm::Triple::armeb)
- return (arm::getARMFloatABI(TC, Args) == arm::FloatABI::Hard && !IsWindows)
+ return (arm::getARMFloatABI(TC, EffectiveTriple, Args) ==
+ arm::FloatABI::Hard &&
+ !IsWindows)
? "armhf"
: "arm";
return TC.getArchName();
}
-std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
+std::string ToolChain::getCompilerRT(const llvm::Triple &EffectiveTriple,
+ const ArgList &Args, StringRef Component,
bool Shared) const {
- const llvm::Triple &TT = getTriple();
- const char *Env = TT.isAndroid() ? "-android" : "";
- bool IsITANMSVCWindows =
- TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
+ const char *Env = EffectiveTriple.isAndroid() ? "-android" : "";
+ bool IsITANMSVCWindows = EffectiveTriple.isWindowsMSVCEnvironment() ||
+ EffectiveTriple.isWindowsItaniumEnvironment();
- StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
+ StringRef Arch = getArchNameForCompilerRTLib(*this, EffectiveTriple, Args);
const char *Prefix = IsITANMSVCWindows ? "" : "lib";
- const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
+ const char *Suffix = Shared ? (EffectiveTriple.isOSWindows() ? ".dll" : ".so")
: (IsITANMSVCWindows ? ".lib" : ".a");
SmallString<128> Path(getDriver().ResourceDir);
- StringRef OSLibName = Triple.isOSFreeBSD() ? "freebsd" : getOS();
+ StringRef OSLibName = EffectiveTriple.isOSFreeBSD() ? "freebsd" : getOS();
llvm::sys::path::append(Path, "lib", OSLibName);
llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
Arch + Env + Suffix);
return Path.str();
}
-const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args,
- StringRef Component,
- bool Shared) const {
- return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
+const char *
+ToolChain::getCompilerRTArgString(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
+ StringRef Component, bool Shared) const {
+ return Args.MakeArgString(
+ getCompilerRT(EffectiveTriple, Args, Component, Shared));
}
bool ToolChain::needsProfileRT(const ArgList &Args) {
@@ -517,11 +523,13 @@ void ToolChain::addClangTargetOptions(co
void ToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {}
-void ToolChain::addProfileRTLibs(const llvm::opt::ArgList &Args,
+void ToolChain::addProfileRTLibs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const {
- if (!needsProfileRT(Args)) return;
+ if (!needsProfileRT(Args))
+ return;
- CmdArgs.push_back(getCompilerRTArgString(Args, "profile"));
+ CmdArgs.push_back(getCompilerRTArgString(EffectiveTriple, Args, "profile"));
}
ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Jul 18 14:56:38 2016
@@ -380,13 +380,16 @@ StringRef Darwin::getOSLibraryNameSuffix
llvm_unreachable("Unsupported platform");
}
-void Darwin::addProfileRTLibs(const ArgList &Args,
+void Darwin::addProfileRTLibs(const llvm::Triple &EffectiveTriple,
+ const ArgList &Args,
ArgStringList &CmdArgs) const {
- if (!needsProfileRT(Args)) return;
+ if (!needsProfileRT(Args))
+ return;
- AddLinkRuntimeLib(Args, CmdArgs, (Twine("libclang_rt.profile_") +
- getOSLibraryNameSuffix() + ".a").str(),
- /*AlwaysLink*/ true);
+ AddLinkRuntimeLib(
+ Args, CmdArgs,
+ (Twine("libclang_rt.profile_") + getOSLibraryNameSuffix() + ".a").str(),
+ /*AlwaysLink*/ true);
}
void DarwinClang::AddLinkSanitizerLibArgs(const ArgList &Args,
@@ -400,7 +403,8 @@ void DarwinClang::AddLinkSanitizerLibArg
/*AddRPath*/ true);
}
-void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
+void DarwinClang::AddLinkRuntimeLibArgs(const llvm::Triple &EffectiveTriple,
+ const ArgList &Args,
ArgStringList &CmdArgs) const {
// Darwin only supports the compiler-rt based runtime libraries.
switch (GetRuntimeLibType(Args)) {
@@ -1012,16 +1016,17 @@ DerivedArgList *MachO::TranslateArgs(con
return DAL;
}
-void MachO::AddLinkRuntimeLibArgs(const ArgList &Args,
+void MachO::AddLinkRuntimeLibArgs(const llvm::Triple &EffectiveTriple,
+ const ArgList &Args,
ArgStringList &CmdArgs) const {
// Embedded targets are simple at the moment, not supporting sanitizers and
// with different libraries for each member of the product { static, PIC } x
// { hard-float, soft-float }
llvm::SmallString<32> CompilerRT = StringRef("libclang_rt.");
- CompilerRT +=
- (tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard)
- ? "hard"
- : "soft";
+ CompilerRT += (tools::arm::getARMFloatABI(*this, EffectiveTriple, Args) ==
+ tools::arm::FloatABI::Hard)
+ ? "hard"
+ : "soft";
CompilerRT += Args.hasArg(options::OPT_fPIC) ? "_pic.a" : "_static.a";
AddLinkRuntimeLib(Args, CmdArgs, CompilerRT, false, true);
@@ -2858,9 +2863,10 @@ void MipsLLVMToolChain::AddCXXStdlibLibA
CmdArgs.push_back("-lunwind");
}
-std::string MipsLLVMToolChain::getCompilerRT(const ArgList &Args,
- StringRef Component,
- bool Shared) const {
+std::string
+MipsLLVMToolChain::getCompilerRT(const llvm::Triple &EffectiveTriple,
+ const ArgList &Args, StringRef Component,
+ bool Shared) const {
SmallString<128> Path(getDriver().ResourceDir);
llvm::sys::path::append(Path, SelectedMultilib.osSuffix(), "lib" + LibSuffix,
getOS());
@@ -4237,9 +4243,9 @@ std::string Linux::getDynamicLinker(cons
case llvm::Triple::thumb:
case llvm::Triple::armeb:
case llvm::Triple::thumbeb: {
- const bool HF =
- Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
- tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard;
+ const bool HF = Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+ tools::arm::getARMFloatABI(*this, Triple, Args) ==
+ tools::arm::FloatABI::Hard;
LibDir = "lib";
Loader = HF ? "ld-linux-armhf.so.3" : "ld-linux.so.3";
@@ -4631,16 +4637,18 @@ SanitizerMask Linux::getSupportedSanitiz
return Res;
}
-void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args,
+void Linux::addProfileRTLibs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const {
- if (!needsProfileRT(Args)) return;
+ if (!needsProfileRT(Args))
+ return;
// Add linker option -u__llvm_runtime_variable to cause runtime
// initialization module to be linked in.
if (!Args.hasArg(options::OPT_coverage))
CmdArgs.push_back(Args.MakeArgString(
Twine("-u", llvm::getInstrProfRuntimeHookVarName())));
- ToolChain::addProfileRTLibs(Args, CmdArgs);
+ ToolChain::addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
}
/// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly.
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Mon Jul 18 14:56:38 2016
@@ -279,7 +279,8 @@ public:
llvm::opt::ArgStringList &CmdArgs) const {}
/// Add the linker arguments to link the compiler runtime library.
- virtual void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
+ virtual void AddLinkRuntimeLibArgs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
virtual void addStartObjectFileArgs(const llvm::opt::ArgList &Args,
@@ -303,7 +304,8 @@ public:
/// Add any profiling runtime libraries that are needed. This is essentially a
/// MachO specific version of addProfileRT in Tools.cpp.
- void addProfileRTLibs(const llvm::opt::ArgList &Args,
+ void addProfileRTLibs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override {
// There aren't any profiling libs for embedded targets currently.
}
@@ -417,7 +419,8 @@ public:
!isTargetWatchOS());
}
- void addProfileRTLibs(const llvm::opt::ArgList &Args,
+ void addProfileRTLibs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
protected:
@@ -572,7 +575,8 @@ public:
/// @name Apple ToolChain Implementation
/// {
- void AddLinkRuntimeLibArgs(const llvm::opt::ArgList &Args,
+ void AddLinkRuntimeLibArgs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
@@ -838,7 +842,8 @@ public:
llvm::opt::ArgStringList &CC1Args) const override;
bool isPIEDefault() const override;
SanitizerMask getSupportedSanitizers() const override;
- void addProfileRTLibs(const llvm::opt::ArgList &Args,
+ void addProfileRTLibs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
virtual std::string computeSysRoot() const;
@@ -902,7 +907,8 @@ public:
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
- std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component,
+ std::string getCompilerRT(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args, StringRef Component,
bool Shared = false) const override;
std::string computeSysRoot() const override;
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jul 18 14:56:38 2016
@@ -771,10 +771,11 @@ static bool useAAPCSForMachO(const llvm:
// Select the float ABI as determined by -msoft-float, -mhard-float, and
// -mfloat-abi=.
-arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
+arm::FloatABI arm::getARMFloatABI(const ToolChain &TC,
+ const llvm::Triple &EffectiveTriple,
+ const ArgList &Args) {
const Driver &D = TC.getDriver();
- const llvm::Triple Triple(TC.ComputeEffectiveClangTriple(Args));
- auto SubArch = getARMSubArchVersionNumber(Triple);
+ auto SubArch = getARMSubArchVersionNumber(EffectiveTriple);
arm::FloatABI ABI = FloatABI::Invalid;
if (Arg *A =
Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float,
@@ -797,23 +798,23 @@ arm::FloatABI arm::getARMFloatABI(const
// It is incorrect to select hard float ABI on MachO platforms if the ABI is
// "apcs-gnu".
- if (Triple.isOSBinFormatMachO() && !useAAPCSForMachO(Triple) &&
- ABI == FloatABI::Hard) {
- D.Diag(diag::err_drv_unsupported_opt_for_target) << A->getAsString(Args)
- << Triple.getArchName();
+ if (EffectiveTriple.isOSBinFormatMachO() &&
+ !useAAPCSForMachO(EffectiveTriple) && ABI == FloatABI::Hard) {
+ D.Diag(diag::err_drv_unsupported_opt_for_target)
+ << A->getAsString(Args) << EffectiveTriple.getArchName();
}
}
// If unspecified, choose the default based on the platform.
if (ABI == FloatABI::Invalid) {
- switch (Triple.getOS()) {
+ switch (EffectiveTriple.getOS()) {
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
case llvm::Triple::TvOS: {
// Darwin defaults to "softfp" for v6 and v7.
ABI = (SubArch == 6 || SubArch == 7) ? FloatABI::SoftFP : FloatABI::Soft;
- ABI = Triple.isWatchABI() ? FloatABI::Hard : ABI;
+ ABI = EffectiveTriple.isWatchABI() ? FloatABI::Hard : ABI;
break;
}
case llvm::Triple::WatchOS:
@@ -826,7 +827,7 @@ arm::FloatABI arm::getARMFloatABI(const
break;
case llvm::Triple::FreeBSD:
- switch (Triple.getEnvironment()) {
+ switch (EffectiveTriple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
ABI = FloatABI::Hard;
break;
@@ -838,7 +839,7 @@ arm::FloatABI arm::getARMFloatABI(const
break;
default:
- switch (Triple.getEnvironment()) {
+ switch (EffectiveTriple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
case llvm::Triple::MuslEABIHF:
case llvm::Triple::EABIHF:
@@ -855,14 +856,14 @@ arm::FloatABI arm::getARMFloatABI(const
break;
default:
// Assume "soft", but warn the user we are guessing.
- if (Triple.isOSBinFormatMachO() &&
- Triple.getSubArch() == llvm::Triple::ARMSubArch_v7em)
+ if (EffectiveTriple.isOSBinFormatMachO() &&
+ EffectiveTriple.getSubArch() == llvm::Triple::ARMSubArch_v7em)
ABI = FloatABI::Hard;
else
ABI = FloatABI::Soft;
- if (Triple.getOS() != llvm::Triple::UnknownOS ||
- !Triple.isOSBinFormatMachO())
+ if (EffectiveTriple.getOS() != llvm::Triple::UnknownOS ||
+ !EffectiveTriple.isOSBinFormatMachO())
D.Diag(diag::warn_drv_assuming_mfloat_abi_is) << "soft";
break;
}
@@ -882,7 +883,7 @@ static void getARMTargetFeatures(const T
bool KernelOrKext =
Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
- arm::FloatABI ABI = arm::getARMFloatABI(TC, Args);
+ arm::FloatABI ABI = arm::getARMFloatABI(TC, Triple, Args);
const Arg *WaCPU = nullptr, *WaFPU = nullptr;
const Arg *WaHDiv = nullptr, *WaArch = nullptr;
@@ -1011,7 +1012,7 @@ static void getARMTargetFeatures(const T
Features.push_back("+long-calls");
} else if (KernelOrKext && (!Triple.isiOS() || Triple.isOSVersionLT(6)) &&
!Triple.isWatchOS()) {
- Features.push_back("+long-calls");
+ Features.push_back("+long-calls");
}
// Kernel code has more strict alignment requirements.
@@ -1025,7 +1026,8 @@ static void getARMTargetFeatures(const T
D.Diag(diag::err_target_unsupported_unaligned) << "v6m";
// v8M Baseline follows on from v6M, so doesn't support unaligned memory
// access either.
- else if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v8m_baseline)
+ else if (Triple.getSubArch() ==
+ llvm::Triple::SubArchType::ARMSubArch_v8m_baseline)
D.Diag(diag::err_target_unsupported_unaligned) << "v8m.base";
} else
Features.push_back("+strict-align");
@@ -1111,7 +1113,7 @@ void Clang::AddARMTargetArgs(const llvm:
CmdArgs.push_back(ABIName);
// Determine floating point ABI from the options & target defaults.
- arm::FloatABI ABI = arm::getARMFloatABI(getToolChain(), Args);
+ arm::FloatABI ABI = arm::getARMFloatABI(getToolChain(), Triple, Args);
if (ABI == arm::FloatABI::Soft) {
// Floating point operations and argument passing are soft.
// FIXME: This changes CPP defines, we need -target-soft-float.
@@ -1172,11 +1174,9 @@ static std::string getAArch64TargetCPU(c
return "generic";
}
-void Clang::AddAArch64TargetArgs(const ArgList &Args,
+void Clang::AddAArch64TargetArgs(const llvm::Triple &EffectiveTriple,
+ const ArgList &Args,
ArgStringList &CmdArgs) const {
- std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
- llvm::Triple Triple(TripleStr);
-
if (!Args.hasFlag(options::OPT_mred_zone, options::OPT_mno_red_zone, true) ||
Args.hasArg(options::OPT_mkernel) ||
Args.hasArg(options::OPT_fapple_kext))
@@ -1189,7 +1189,7 @@ void Clang::AddAArch64TargetArgs(const A
const char *ABIName = nullptr;
if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
ABIName = A->getValue();
- else if (Triple.isOSDarwin())
+ else if (EffectiveTriple.isOSDarwin())
ABIName = "darwinpcs";
else
ABIName = "aapcs";
@@ -1204,7 +1204,7 @@ void Clang::AddAArch64TargetArgs(const A
CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1");
else
CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=0");
- } else if (Triple.isAndroid()) {
+ } else if (EffectiveTriple.isAndroid()) {
// Enabled A53 errata (835769) workaround by default on android
CmdArgs.push_back("-backend-option");
CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1");
@@ -2999,9 +2999,10 @@ static void CollectArgsForIntegratedAsse
// This adds the static libclang_rt.builtins-arch.a directly to the command line
// FIXME: Make sure we can also emit shared objects if they're requested
// and available, check for possible errors, etc.
-static void addClangRT(const ToolChain &TC, const ArgList &Args,
- ArgStringList &CmdArgs) {
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, "builtins"));
+static void addClangRT(const ToolChain &TC, const llvm::Triple &EffectiveTriple,
+ const ArgList &Args, ArgStringList &CmdArgs) {
+ CmdArgs.push_back(
+ TC.getCompilerRTArgString(EffectiveTriple, Args, "builtins"));
}
namespace {
@@ -3075,22 +3076,27 @@ static void addOpenMPRuntime(ArgStringLi
}
}
-static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args,
- ArgStringList &CmdArgs, StringRef Sanitizer,
- bool IsShared, bool IsWhole) {
+static void addSanitizerRuntime(const ToolChain &TC,
+ const llvm::Triple &EffectiveTriple,
+ const ArgList &Args, ArgStringList &CmdArgs,
+ StringRef Sanitizer, bool IsShared,
+ bool IsWhole) {
// Wrap any static runtimes that must be forced into executable in
// whole-archive.
if (IsWhole) CmdArgs.push_back("-whole-archive");
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, Sanitizer, IsShared));
- if (IsWhole) CmdArgs.push_back("-no-whole-archive");
+ CmdArgs.push_back(
+ TC.getCompilerRTArgString(EffectiveTriple, Args, Sanitizer, IsShared));
+ if (IsWhole)
+ CmdArgs.push_back("-no-whole-archive");
}
// Tries to use a file with the list of dynamic symbols that need to be exported
// from the runtime library. Returns true if the file was found.
-static bool addSanitizerDynamicList(const ToolChain &TC, const ArgList &Args,
- ArgStringList &CmdArgs,
+static bool addSanitizerDynamicList(const ToolChain &TC,
+ const llvm::Triple &EffectiveTriple,
+ const ArgList &Args, ArgStringList &CmdArgs,
StringRef Sanitizer) {
- SmallString<128> SanRT(TC.getCompilerRT(Args, Sanitizer));
+ SmallString<128> SanRT(TC.getCompilerRT(EffectiveTriple, Args, Sanitizer));
if (llvm::sys::fs::exists(SanRT + ".syms")) {
CmdArgs.push_back(Args.MakeArgString("--dynamic-list=" + SanRT + ".syms"));
return true;
@@ -3179,25 +3185,28 @@ collectSanitizerRuntimes(const ToolChain
// Should be called before we add system libraries (C++ ABI, libstdc++/libc++,
// C runtime, etc). Returns true if sanitizer system deps need to be linked in.
-static bool addSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
- ArgStringList &CmdArgs) {
+static bool addSanitizerRuntimes(const ToolChain &TC,
+ const llvm::Triple &EffectiveTriple,
+ const ArgList &Args, ArgStringList &CmdArgs) {
SmallVector<StringRef, 4> SharedRuntimes, StaticRuntimes,
NonWholeStaticRuntimes, HelperStaticRuntimes, RequiredSymbols;
collectSanitizerRuntimes(TC, Args, SharedRuntimes, StaticRuntimes,
NonWholeStaticRuntimes, HelperStaticRuntimes,
RequiredSymbols);
for (auto RT : SharedRuntimes)
- addSanitizerRuntime(TC, Args, CmdArgs, RT, true, false);
+ addSanitizerRuntime(TC, EffectiveTriple, Args, CmdArgs, RT, true, false);
for (auto RT : HelperStaticRuntimes)
- addSanitizerRuntime(TC, Args, CmdArgs, RT, false, true);
+ addSanitizerRuntime(TC, EffectiveTriple, Args, CmdArgs, RT, false, true);
bool AddExportDynamic = false;
for (auto RT : StaticRuntimes) {
- addSanitizerRuntime(TC, Args, CmdArgs, RT, false, true);
- AddExportDynamic |= !addSanitizerDynamicList(TC, Args, CmdArgs, RT);
+ addSanitizerRuntime(TC, EffectiveTriple, Args, CmdArgs, RT, false, true);
+ AddExportDynamic |=
+ !addSanitizerDynamicList(TC, EffectiveTriple, Args, CmdArgs, RT);
}
for (auto RT : NonWholeStaticRuntimes) {
- addSanitizerRuntime(TC, Args, CmdArgs, RT, false, false);
- AddExportDynamic |= !addSanitizerDynamicList(TC, Args, CmdArgs, RT);
+ addSanitizerRuntime(TC, EffectiveTriple, Args, CmdArgs, RT, false, false);
+ AddExportDynamic |=
+ !addSanitizerDynamicList(TC, EffectiveTriple, Args, CmdArgs, RT);
}
for (auto S : RequiredSymbols) {
CmdArgs.push_back("-u");
@@ -3210,12 +3219,14 @@ static bool addSanitizerRuntimes(const T
return !StaticRuntimes.empty();
}
-static bool addXRayRuntime(const ToolChain &TC, const ArgList &Args,
- ArgStringList &CmdArgs) {
+static bool addXRayRuntime(const ToolChain &TC,
+ const llvm::Triple &EffectiveTriple,
+ const ArgList &Args, ArgStringList &CmdArgs) {
if (Args.hasFlag(options::OPT_fxray_instrument,
options::OPT_fnoxray_instrument, false)) {
CmdArgs.push_back("-whole-archive");
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, "xray", false));
+ CmdArgs.push_back(
+ TC.getCompilerRTArgString(EffectiveTriple, Args, "xray", false));
CmdArgs.push_back("-no-whole-archive");
return true;
}
@@ -3825,9 +3836,9 @@ static void AddAssemblerKPIC(const ToolC
void Clang::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args, const char *LinkingOutput) const {
- std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
- const llvm::Triple Triple(TripleStr);
+ std::string TripleStr = EffectiveTriple.str();
bool KernelOrKext =
Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
@@ -3880,13 +3891,14 @@ void Clang::ConstructJob(Compilation &C,
CmdArgs.push_back(Args.MakeArgString(NormalizedTriple));
}
- if (Triple.isOSWindows() && (Triple.getArch() == llvm::Triple::arm ||
- Triple.getArch() == llvm::Triple::thumb)) {
- unsigned Offset = Triple.getArch() == llvm::Triple::arm ? 4 : 6;
+ if (EffectiveTriple.isOSWindows() &&
+ (EffectiveTriple.getArch() == llvm::Triple::arm ||
+ EffectiveTriple.getArch() == llvm::Triple::thumb)) {
+ unsigned Offset = EffectiveTriple.getArch() == llvm::Triple::arm ? 4 : 6;
unsigned Version;
- Triple.getArchName().substr(Offset).getAsInteger(10, Version);
+ EffectiveTriple.getArchName().substr(Offset).getAsInteger(10, Version);
if (Version < 7)
- D.Diag(diag::err_target_unsupported_arch) << Triple.getArchName()
+ D.Diag(diag::err_target_unsupported_arch) << EffectiveTriple.getArchName()
<< TripleStr;
}
@@ -4088,7 +4100,7 @@ void Clang::ConstructJob(Compilation &C,
unsigned PICLevel;
bool IsPIE;
std::tie(RelocationModel, PICLevel, IsPIE) =
- ParsePICArgs(getToolChain(), Triple, Args);
+ ParsePICArgs(getToolChain(), EffectiveTriple, Args);
const char *RMName = RelocationModelName(RelocationModel);
if (RMName) {
@@ -4187,8 +4199,7 @@ void Clang::ConstructJob(Compilation &C,
false))
CmdArgs.push_back("-fstrict-enums");
if (Args.hasFlag(options::OPT_fstrict_vtable_pointers,
- options::OPT_fno_strict_vtable_pointers,
- false))
+ options::OPT_fno_strict_vtable_pointers, false))
CmdArgs.push_back("-fstrict-vtable-pointers");
if (!Args.hasFlag(options::OPT_foptimize_sibling_calls,
options::OPT_fno_optimize_sibling_calls))
@@ -4403,7 +4414,7 @@ void Clang::ConstructJob(Compilation &C,
}
// Add the target cpu
- std::string CPU = getCPUName(Args, Triple, /*FromAs*/ false);
+ std::string CPU = getCPUName(Args, EffectiveTriple, /*FromAs*/ false);
if (!CPU.empty()) {
CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(Args.MakeArgString(CPU));
@@ -4415,7 +4426,7 @@ void Clang::ConstructJob(Compilation &C,
}
// Add the target features
- getTargetFeatures(getToolChain(), Triple, Args, CmdArgs, false);
+ getTargetFeatures(getToolChain(), EffectiveTriple, Args, CmdArgs, false);
// Add target specific flags.
switch (getToolChain().getArch()) {
@@ -4427,12 +4438,12 @@ void Clang::ConstructJob(Compilation &C,
case llvm::Triple::thumb:
case llvm::Triple::thumbeb:
// Use the effective triple, which takes into account the deployment target.
- AddARMTargetArgs(Triple, Args, CmdArgs, KernelOrKext);
+ AddARMTargetArgs(EffectiveTriple, Args, CmdArgs, KernelOrKext);
break;
case llvm::Triple::aarch64:
case llvm::Triple::aarch64_be:
- AddAArch64TargetArgs(Args, CmdArgs);
+ AddAArch64TargetArgs(EffectiveTriple, Args, CmdArgs);
break;
case llvm::Triple::mips:
@@ -4553,8 +4564,8 @@ void Clang::ConstructJob(Compilation &C,
}
// If a debugger tuning argument appeared, remember it.
- if (Arg *A = Args.getLastArg(options::OPT_gTune_Group,
- options::OPT_ggdbN_Group)) {
+ if (Arg *A =
+ Args.getLastArg(options::OPT_gTune_Group, options::OPT_ggdbN_Group)) {
if (A->getOption().matches(options::OPT_glldb))
DebuggerTuning = llvm::DebuggerKind::LLDB;
else if (A->getOption().matches(options::OPT_gsce))
@@ -4583,7 +4594,7 @@ void Clang::ConstructJob(Compilation &C,
// PS4 defaults to no column info
if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
- /*Default=*/ !IsPS4CPU))
+ /*Default=*/!IsPS4CPU))
CmdArgs.push_back("-dwarf-column-info");
// FIXME: Move backend command line options to the module.
@@ -4637,9 +4648,10 @@ void Clang::ConstructJob(Compilation &C,
// CloudABI and WebAssembly use -ffunction-sections and -fdata-sections by
// default.
- bool UseSeparateSections = Triple.getOS() == llvm::Triple::CloudABI ||
- Triple.getArch() == llvm::Triple::wasm32 ||
- Triple.getArch() == llvm::Triple::wasm64;
+ bool UseSeparateSections =
+ EffectiveTriple.getOS() == llvm::Triple::CloudABI ||
+ EffectiveTriple.getArch() == llvm::Triple::wasm32 ||
+ EffectiveTriple.getArch() == llvm::Triple::wasm64;
if (Args.hasFlag(options::OPT_ffunction_sections,
options::OPT_fno_function_sections, UseSeparateSections)) {
@@ -5008,7 +5020,8 @@ void Clang::ConstructJob(Compilation &C,
Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
// Emulated TLS is enabled by default on Android, and can be enabled manually
// with -femulated-tls.
- bool EmulatedTLSDefault = Triple.isAndroid() || Triple.isWindowsCygwinEnvironment();
+ bool EmulatedTLSDefault = EffectiveTriple.isAndroid() ||
+ EffectiveTriple.isWindowsCygwinEnvironment();
if (Args.hasFlag(options::OPT_femulated_tls, options::OPT_fno_emulated_tls,
EmulatedTLSDefault))
CmdArgs.push_back("-femulated-tls");
@@ -5049,7 +5062,7 @@ void Clang::ConstructJob(Compilation &C,
}
const SanitizerArgs &Sanitize = getToolChain().getSanitizerArgs();
- Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType);
+ Sanitize.addArgs(getToolChain(), EffectiveTriple, Args, CmdArgs, InputType);
// Report an error for -faltivec on anything other than PowerPC.
if (const Arg *A = Args.getLastArg(options::OPT_faltivec)) {
@@ -5191,9 +5204,9 @@ void Clang::ConstructJob(Compilation &C,
CmdArgs.push_back("-backend-option");
CmdArgs.push_back("-arm-no-restrict-it");
}
- } else if (Triple.isOSWindows() &&
- (Triple.getArch() == llvm::Triple::arm ||
- Triple.getArch() == llvm::Triple::thumb)) {
+ } else if (EffectiveTriple.isOSWindows() &&
+ (EffectiveTriple.getArch() == llvm::Triple::arm ||
+ EffectiveTriple.getArch() == llvm::Triple::thumb)) {
// Windows on ARM expects restricted IT blocks
CmdArgs.push_back("-backend-option");
CmdArgs.push_back("-arm-restrict-it");
@@ -5546,7 +5559,7 @@ void Clang::ConstructJob(Compilation &C,
if (Args.hasArg(options::OPT_fno_inline))
CmdArgs.push_back("-fno-inline");
- if (Arg* InlineArg = Args.getLastArg(options::OPT_finline_functions,
+ if (Arg *InlineArg = Args.getLastArg(options::OPT_finline_functions,
options::OPT_finline_hint_functions,
options::OPT_fno_inline_functions))
InlineArg->render(Args, CmdArgs);
@@ -5608,7 +5621,6 @@ void Clang::ConstructJob(Compilation &C,
options::OPT_fno_objc_arc_exceptions,
/*default*/ types::isCXX(InputType)))
CmdArgs.push_back("-fobjc-arc-exceptions");
-
}
// -fobjc-infer-related-result-type is the default, except in the Objective-C
@@ -5634,8 +5646,8 @@ void Clang::ConstructJob(Compilation &C,
// Pass down -fobjc-weak or -fno-objc-weak if present.
if (types::isObjC(InputType)) {
- auto WeakArg = Args.getLastArg(options::OPT_fobjc_weak,
- options::OPT_fno_objc_weak);
+ auto WeakArg =
+ Args.getLastArg(options::OPT_fobjc_weak, options::OPT_fno_objc_weak);
if (!WeakArg) {
// nothing to do
} else if (GCArg) {
@@ -5805,7 +5817,7 @@ void Clang::ConstructJob(Compilation &C,
StringRef Value(A->getValue());
if (Value != "always" && Value != "never" && Value != "auto")
getToolChain().getDriver().Diag(diag::err_drv_clang_unsupported)
- << ("-fdiagnostics-color=" + Value).str();
+ << ("-fdiagnostics-color=" + Value).str();
}
A->claim();
}
@@ -6476,6 +6488,7 @@ void ClangAs::AddX86TargetArgs(const Arg
void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -6483,9 +6496,7 @@ void ClangAs::ConstructJob(Compilation &
assert(Inputs.size() == 1 && "Unexpected number of inputs.");
const InputInfo &Input = Inputs[0];
- std::string TripleStr =
- getToolChain().ComputeEffectiveClangTriple(Args, Input.getType());
- const llvm::Triple Triple(TripleStr);
+ std::string TripleStr = EffectiveTriple.str();
// Don't warn about "clang -w -c foo.s"
Args.ClaimAllArgs(options::OPT_w);
@@ -6514,14 +6525,14 @@ void ClangAs::ConstructJob(Compilation &
CmdArgs.push_back(Clang::getBaseInputName(Args, Input));
// Add the target cpu
- std::string CPU = getCPUName(Args, Triple, /*FromAs*/ true);
+ std::string CPU = getCPUName(Args, EffectiveTriple, /*FromAs*/ true);
if (!CPU.empty()) {
CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(Args.MakeArgString(CPU));
}
// Add the target features
- getTargetFeatures(getToolChain(), Triple, Args, CmdArgs, true);
+ getTargetFeatures(getToolChain(), EffectiveTriple, Args, CmdArgs, true);
// Ignore explicit -force_cpusubtype_ALL option.
(void)Args.hasArg(options::OPT_force__cpusubtype__ALL);
@@ -6580,7 +6591,7 @@ void ClangAs::ConstructJob(Compilation &
unsigned PICLevel;
bool IsPIE;
std::tie(RelocationModel, PICLevel, IsPIE) =
- ParsePICArgs(getToolChain(), Triple, Args);
+ ParsePICArgs(getToolChain(), EffectiveTriple, Args);
const char *RMName = RelocationModelName(RelocationModel);
if (RMName) {
@@ -6663,7 +6674,9 @@ void GnuTool::anchor() {}
void gcc::Common::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
- const InputInfoList &Inputs, const ArgList &Args,
+ const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
+ const ArgList &Args,
const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
ArgStringList CmdArgs;
@@ -6830,6 +6843,7 @@ void hexagon::Assembler::RenderExtraTool
void hexagon::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -7073,6 +7087,7 @@ constructHexagonLinkArgs(Compilation &C,
void hexagon::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
auto &HTC = static_cast<const toolchains::HexagonToolChain&>(getToolChain());
@@ -7090,6 +7105,7 @@ void hexagon::Linker::ConstructJob(Compi
void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -7118,6 +7134,7 @@ bool wasm::Linker::hasIntegratedCPP() co
void wasm::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -7193,7 +7210,8 @@ const std::string arm::getARMArch(String
std::string CPU = llvm::sys::getHostCPUName();
if (CPU != "generic") {
// Translate the native cpu into the architecture suffix for that CPU.
- StringRef Suffix = arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
+ StringRef Suffix =
+ arm::getLLVMArchSuffixForARM(CPU, MArch, Triple);
// If there is no valid architecture suffix for this CPU we don't know how
// to handle it, so return no architecture.
if (Suffix.empty())
@@ -7453,6 +7471,7 @@ const char *Clang::getDependencyFileName
void cloudabi::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const ToolChain &ToolChain = getToolChain();
@@ -7521,6 +7540,7 @@ void cloudabi::Linker::ConstructJob(Comp
void darwin::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -7818,6 +7838,7 @@ void darwin::Linker::AddLinkArgs(Compila
void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
assert(Output.getType() == types::TY_Image && "Invalid linker output type.");
@@ -7919,7 +7940,7 @@ void darwin::Linker::ConstructJob(Compil
if (Args.hasArg(options::OPT_fnested_functions))
CmdArgs.push_back("-allow_stack_execute");
- getMachOToolChain().addProfileRTLibs(Args, CmdArgs);
+ getMachOToolChain().addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
if (getToolChain().getDriver().CCCIsCXX())
@@ -7928,7 +7949,7 @@ void darwin::Linker::ConstructJob(Compil
// link_ssp spec is empty.
// Let the tool chain choose which runtime library to link.
- getMachOToolChain().AddLinkRuntimeLibArgs(Args, CmdArgs);
+ getMachOToolChain().AddLinkRuntimeLibArgs(EffectiveTriple, Args, CmdArgs);
}
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
@@ -7961,6 +7982,7 @@ void darwin::Linker::ConstructJob(Compil
void darwin::Lipo::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -7983,6 +8005,7 @@ void darwin::Lipo::ConstructJob(Compilat
void darwin::Dsymutil::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -8003,6 +8026,7 @@ void darwin::Dsymutil::ConstructJob(Comp
void darwin::VerifyDebug::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -8026,6 +8050,7 @@ void darwin::VerifyDebug::ConstructJob(C
void solaris::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -8046,6 +8071,7 @@ void solaris::Assembler::ConstructJob(Co
void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -8115,7 +8141,7 @@ void solaris::Linker::ConstructJob(Compi
}
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
- getToolChain().addProfileRTLibs(Args, CmdArgs);
+ getToolChain().addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
@@ -8124,6 +8150,7 @@ void solaris::Linker::ConstructJob(Compi
void openbsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -8195,6 +8222,7 @@ void openbsd::Assembler::ConstructJob(Co
void openbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
@@ -8317,6 +8345,7 @@ void openbsd::Linker::ConstructJob(Compi
void bitrig::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -8337,6 +8366,7 @@ void bitrig::Assembler::ConstructJob(Com
void bitrig::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
@@ -8446,6 +8476,7 @@ void bitrig::Linker::ConstructJob(Compil
void freebsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -8495,7 +8526,8 @@ void freebsd::Assembler::ConstructJob(Co
case llvm::Triple::armeb:
case llvm::Triple::thumb:
case llvm::Triple::thumbeb: {
- arm::FloatABI ABI = arm::getARMFloatABI(getToolChain(), Args);
+ arm::FloatABI ABI =
+ arm::getARMFloatABI(getToolChain(), EffectiveTriple, Args);
if (ABI == arm::FloatABI::Hard)
CmdArgs.push_back("-mfpu=vfp");
@@ -8539,6 +8571,7 @@ void freebsd::Assembler::ConstructJob(Co
void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const toolchains::FreeBSD &ToolChain =
@@ -8653,7 +8686,8 @@ void freebsd::Linker::ConstructJob(Compi
if (D.isUsingLTO())
AddGoldPlugin(ToolChain, Args, CmdArgs, D.getLTOMode() == LTOK_Thin);
- bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
+ bool NeedsSanitizerDeps =
+ addSanitizerRuntimes(ToolChain, EffectiveTriple, Args, CmdArgs);
AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
@@ -8720,7 +8754,7 @@ void freebsd::Linker::ConstructJob(Compi
CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
}
- ToolChain.addProfileRTLibs(Args, CmdArgs);
+ ToolChain.addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
@@ -8729,6 +8763,7 @@ void freebsd::Linker::ConstructJob(Compi
void netbsd::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -8812,6 +8847,7 @@ void netbsd::Assembler::ConstructJob(Com
void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
@@ -8861,9 +8897,7 @@ void netbsd::Linker::ConstructJob(Compil
break;
case llvm::Triple::armeb:
case llvm::Triple::thumbeb:
- arm::appendEBLinkFlags(
- Args, CmdArgs,
- llvm::Triple(getToolChain().ComputeEffectiveClangTriple(Args)));
+ arm::appendEBLinkFlags(Args, CmdArgs, EffectiveTriple);
CmdArgs.push_back("-m");
switch (getToolChain().getTriple().getEnvironment()) {
case llvm::Triple::EABI:
@@ -9014,7 +9048,7 @@ void netbsd::Linker::ConstructJob(Compil
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
}
- getToolChain().addProfileRTLibs(Args, CmdArgs);
+ getToolChain().addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
@@ -9023,20 +9057,18 @@ void netbsd::Linker::ConstructJob(Compil
void gnutools::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
- std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
- llvm::Triple Triple = llvm::Triple(TripleStr);
-
ArgStringList CmdArgs;
llvm::Reloc::Model RelocationModel;
unsigned PICLevel;
bool IsPIE;
std::tie(RelocationModel, PICLevel, IsPIE) =
- ParsePICArgs(getToolChain(), Triple, Args);
+ ParsePICArgs(getToolChain(), EffectiveTriple, Args);
switch (getToolChain().getArch()) {
default:
@@ -9099,7 +9131,7 @@ void gnutools::Assembler::ConstructJob(C
break;
}
- switch (arm::getARMFloatABI(getToolChain(), Args)) {
+ switch (arm::getARMFloatABI(getToolChain(), EffectiveTriple, Args)) {
case arm::FloatABI::Invalid: llvm_unreachable("must have an ABI!");
case arm::FloatABI::Soft:
CmdArgs.push_back(Args.MakeArgString("-mfloat-abi=soft"));
@@ -9274,6 +9306,7 @@ static void AddLibgcc(const llvm::Triple
}
static void AddRunTimeLibs(const ToolChain &TC, const Driver &D,
+ const llvm::Triple &EffectiveTriple,
ArgStringList &CmdArgs, const ArgList &Args) {
// Make use of compiler-rt if --rtlib option is used
ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(Args);
@@ -9285,7 +9318,7 @@ static void AddRunTimeLibs(const ToolCha
llvm_unreachable("unsupported OS");
case llvm::Triple::Win32:
case llvm::Triple::Linux:
- addClangRT(TC, Args, CmdArgs);
+ addClangRT(TC, EffectiveTriple, Args, CmdArgs);
break;
}
break;
@@ -9357,15 +9390,13 @@ static const char *getLDMOption(const ll
void gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const toolchains::Linux &ToolChain =
static_cast<const toolchains::Linux &>(getToolChain());
const Driver &D = ToolChain.getDriver();
- std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
- llvm::Triple Triple = llvm::Triple(TripleStr);
-
const llvm::Triple::ArchType Arch = ToolChain.getArch();
const bool isAndroid = ToolChain.getTriple().isAndroid();
const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
@@ -9407,7 +9438,7 @@ void gnutools::Linker::ConstructJob(Comp
CmdArgs.push_back("-s");
if (Arch == llvm::Triple::armeb || Arch == llvm::Triple::thumbeb)
- arm::appendEBLinkFlags(Args, CmdArgs, Triple);
+ arm::appendEBLinkFlags(Args, CmdArgs, EffectiveTriple);
for (const auto &Opt : ToolChain.ExtraOpts)
CmdArgs.push_back(Opt.c_str());
@@ -9493,11 +9524,13 @@ void gnutools::Linker::ConstructJob(Comp
if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
CmdArgs.push_back("--no-demangle");
- bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
- bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
+ bool NeedsSanitizerDeps =
+ addSanitizerRuntimes(ToolChain, EffectiveTriple, Args, CmdArgs);
+ bool NeedsXRayDeps =
+ addXRayRuntime(ToolChain, EffectiveTriple, Args, CmdArgs);
AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
// The profile runtime also needs access to system libraries.
- getToolChain().addProfileRTLibs(Args, CmdArgs);
+ getToolChain().addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
if (D.CCCIsCXX() &&
!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
@@ -9554,7 +9587,7 @@ void gnutools::Linker::ConstructJob(Comp
}
}
- AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
+ AddRunTimeLibs(ToolChain, D, EffectiveTriple, CmdArgs, Args);
if (WantPthread && !isAndroid)
CmdArgs.push_back("-lpthread");
@@ -9571,7 +9604,7 @@ void gnutools::Linker::ConstructJob(Comp
if (Args.hasArg(options::OPT_static))
CmdArgs.push_back("--end-group");
else
- AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
+ AddRunTimeLibs(ToolChain, D, EffectiveTriple, CmdArgs, Args);
// Add IAMCU specific libs (outside the group), if needed.
if (IsIAMCU) {
@@ -9607,6 +9640,7 @@ void gnutools::Linker::ConstructJob(Comp
void nacltools::AssemblerARM::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const toolchains::NaClToolChain &ToolChain =
@@ -9616,8 +9650,8 @@ void nacltools::AssemblerARM::ConstructJ
InputInfoList NewInputs;
NewInputs.push_back(NaClMacros);
NewInputs.append(Inputs.begin(), Inputs.end());
- gnutools::Assembler::ConstructJob(C, JA, Output, NewInputs, Args,
- LinkingOutput);
+ gnutools::Assembler::ConstructJob(C, JA, Output, NewInputs, EffectiveTriple,
+ Args, LinkingOutput);
}
// This is quite similar to gnutools::Linker::ConstructJob with changes that
@@ -9627,6 +9661,7 @@ void nacltools::AssemblerARM::ConstructJ
void nacltools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
@@ -9775,6 +9810,7 @@ void nacltools::Linker::ConstructJob(Com
void minix::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -9795,6 +9831,7 @@ void minix::Assembler::ConstructJob(Comp
void minix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
@@ -9820,7 +9857,7 @@ void minix::Linker::ConstructJob(Compila
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
- getToolChain().addProfileRTLibs(Args, CmdArgs);
+ getToolChain().addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
if (D.CCCIsCXX()) {
@@ -9850,6 +9887,7 @@ void minix::Linker::ConstructJob(Compila
void dragonfly::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -9875,6 +9913,7 @@ void dragonfly::Assembler::ConstructJob(
void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const Driver &D = getToolChain().getDriver();
@@ -9989,7 +10028,7 @@ void dragonfly::Linker::ConstructJob(Com
CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
}
- getToolChain().addProfileRTLibs(Args, CmdArgs);
+ getToolChain().addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs));
@@ -10018,6 +10057,7 @@ static std::string FindVisualStudioExecu
void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -10097,15 +10137,18 @@ void visualstudio::Linker::ConstructJob(
CmdArgs.push_back(Args.MakeArgString("-incremental:no"));
if (Args.hasArg(options::OPT__SLASH_MD, options::OPT__SLASH_MDd)) {
for (const auto &Lib : {"asan_dynamic", "asan_dynamic_runtime_thunk"})
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
+ CmdArgs.push_back(
+ TC.getCompilerRTArgString(EffectiveTriple, Args, Lib));
// Make sure the dynamic runtime thunk is not optimized out at link time
// to ensure proper SEH handling.
CmdArgs.push_back(Args.MakeArgString("-include:___asan_seh_interceptor"));
} else if (DLL) {
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
+ CmdArgs.push_back(
+ TC.getCompilerRTArgString(EffectiveTriple, Args, "asan_dll_thunk"));
} else {
for (const auto &Lib : {"asan", "asan_cxx"})
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
+ CmdArgs.push_back(
+ TC.getCompilerRTArgString(EffectiveTriple, Args, Lib));
}
}
@@ -10135,7 +10178,7 @@ void visualstudio::Linker::ConstructJob(
// Add compiler-rt lib in case if it was explicitly
// specified as an argument for --rtlib option.
if (!Args.hasArg(options::OPT_nostdlib)) {
- AddRunTimeLibs(TC, TC.getDriver(), CmdArgs, Args);
+ AddRunTimeLibs(TC, TC.getDriver(), EffectiveTriple, CmdArgs, Args);
}
// Add filenames, libraries, and other linker inputs.
@@ -10164,7 +10207,7 @@ void visualstudio::Linker::ConstructJob(
A.renderAsInput(Args, CmdArgs);
}
- TC.addProfileRTLibs(Args, CmdArgs);
+ TC.addProfileRTLibs(EffectiveTriple, Args, CmdArgs);
// We need to special case some linker paths. In the case of lld, we need to
// translate 'lld' into 'lld-link', and in the case of the regular msvc
@@ -10193,6 +10236,7 @@ void visualstudio::Linker::ConstructJob(
void visualstudio::Compiler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
C.addCommand(GetCommand(C, JA, Output, Inputs, Args, LinkingOutput));
@@ -10315,6 +10359,7 @@ std::unique_ptr<Command> visualstudio::C
void MinGW::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -10342,7 +10387,8 @@ void MinGW::Assembler::ConstructJob(Comp
SplitDebugName(Args, Inputs[0]));
}
-void MinGW::Linker::AddLibGCC(const ArgList &Args,
+void MinGW::Linker::AddLibGCC(const llvm::Triple &EffectiveTriple,
+ const ArgList &Args,
ArgStringList &CmdArgs) const {
if (Args.hasArg(options::OPT_mthreads))
CmdArgs.push_back("-lmingwthrd");
@@ -10364,7 +10410,8 @@ void MinGW::Linker::AddLibGCC(const ArgL
CmdArgs.push_back("-lgcc");
}
} else {
- AddRunTimeLibs(getToolChain(), getToolChain().getDriver(), CmdArgs, Args);
+ AddRunTimeLibs(getToolChain(), getToolChain().getDriver(), EffectiveTriple,
+ CmdArgs, Args);
}
CmdArgs.push_back("-lmoldname");
@@ -10375,6 +10422,7 @@ void MinGW::Linker::AddLibGCC(const ArgL
void MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const ToolChain &TC = getToolChain();
@@ -10497,7 +10545,7 @@ void MinGW::Linker::ConstructJob(Compila
if (Args.hasArg(options::OPT_fopenmp))
CmdArgs.push_back("-lgomp");
- AddLibGCC(Args, CmdArgs);
+ AddLibGCC(EffectiveTriple, Args, CmdArgs);
if (Args.hasArg(options::OPT_pg))
CmdArgs.push_back("-lgmon");
@@ -10518,7 +10566,7 @@ void MinGW::Linker::ConstructJob(Compila
if (Args.hasArg(options::OPT_static))
CmdArgs.push_back("--end-group");
else if (!LinkerName.equals_lower("lld"))
- AddLibGCC(Args, CmdArgs);
+ AddLibGCC(EffectiveTriple, Args, CmdArgs);
}
if (!Args.hasArg(options::OPT_nostartfiles)) {
@@ -10538,6 +10586,7 @@ void MinGW::Linker::ConstructJob(Compila
void XCore::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -10571,6 +10620,7 @@ void XCore::Assembler::ConstructJob(Comp
void XCore::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -10599,6 +10649,7 @@ void XCore::Linker::ConstructJob(Compila
void CrossWindows::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -10638,6 +10689,7 @@ void CrossWindows::Assembler::ConstructJ
void CrossWindows::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const auto &TC =
@@ -10761,17 +10813,19 @@ void CrossWindows::Linker::ConstructJob(
if (!Args.hasArg(options::OPT_nodefaultlibs)) {
// TODO handle /MT[d] /MD[d]
CmdArgs.push_back("-lmsvcrt");
- AddRunTimeLibs(TC, D, CmdArgs, Args);
+ AddRunTimeLibs(TC, D, EffectiveTriple, CmdArgs, Args);
}
}
if (TC.getSanitizerArgs().needsAsanRt()) {
// TODO handle /MT[d] /MD[d]
if (Args.hasArg(options::OPT_shared)) {
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
+ CmdArgs.push_back(
+ TC.getCompilerRTArgString(EffectiveTriple, Args, "asan_dll_thunk"));
} else {
for (const auto &Lib : {"asan_dynamic", "asan_dynamic_runtime_thunk"})
- CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
+ CmdArgs.push_back(
+ TC.getCompilerRTArgString(EffectiveTriple, Args, Lib));
// Make sure the dynamic runtime thunk is not optimized out at link time
// to ensure proper SEH handling.
CmdArgs.push_back(Args.MakeArgString("--undefined"));
@@ -10789,6 +10843,7 @@ void CrossWindows::Linker::ConstructJob(
void tools::SHAVE::Compiler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -10845,6 +10900,7 @@ void tools::SHAVE::Compiler::ConstructJo
void tools::SHAVE::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
@@ -10881,6 +10937,7 @@ void tools::SHAVE::Assembler::ConstructJ
void tools::Myriad::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const auto &TC =
@@ -10956,6 +11013,7 @@ void tools::Myriad::Linker::ConstructJob
void PS4cpu::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
@@ -11224,6 +11282,7 @@ static void ConstructGoldLinkJob(const T
void PS4cpu::Link::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const toolchains::FreeBSD &ToolChain =
@@ -11253,6 +11312,7 @@ void PS4cpu::Link::ConstructJob(Compilat
void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const auto &TC =
@@ -11329,6 +11389,7 @@ void NVPTX::Assembler::ConstructJob(Comp
void NVPTX::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const ArgList &Args,
const char *LinkingOutput) const {
const auto &TC =
Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=275895&r1=275894&r2=275895&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Mon Jul 18 14:56:38 2016
@@ -59,7 +59,8 @@ private:
const InputInfo &Output,
const InputInfoList &Inputs) const;
- void AddAArch64TargetArgs(const llvm::opt::ArgList &Args,
+ void AddAArch64TargetArgs(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const;
void AddARMTargetArgs(const llvm::Triple &Triple,
const llvm::opt::ArgList &Args,
@@ -114,6 +115,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -133,6 +135,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -160,6 +163,7 @@ public:
bool hasIntegratedAssembler() const override { return true; }
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
@@ -219,6 +223,7 @@ public:
llvm::opt::ArgStringList &CmdArgs) const;
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -234,6 +239,7 @@ public:
llvm::opt::ArgStringList &CmdArgs) const;
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -248,6 +254,7 @@ public:
bool hasIntegratedCPP() const override { return false; }
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -263,6 +270,7 @@ public:
bool hasIntegratedCPP() const override;
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -324,6 +332,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -363,6 +372,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -383,6 +393,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -395,6 +406,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -409,6 +421,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -422,6 +435,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -438,6 +452,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -451,6 +466,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -467,6 +483,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -480,6 +497,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -496,6 +514,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -509,6 +528,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -525,6 +545,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -538,6 +559,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -553,6 +575,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -566,6 +589,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -578,6 +602,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -591,6 +616,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -607,6 +633,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -620,6 +647,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -636,6 +664,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -649,6 +678,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -665,6 +695,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -678,6 +709,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -700,6 +732,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -716,6 +749,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
@@ -737,6 +771,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -750,11 +785,13 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
private:
- void AddLibGCC(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs) const;
+ void AddLibGCC(const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args, ArgStringList &CmdArgs) const;
};
} // end namespace MinGW
@@ -766,7 +803,9 @@ enum class FloatABI {
Hard,
};
-FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args);
+FloatABI getARMFloatABI(const ToolChain &TC,
+ const llvm::Triple &EffectiveTriple,
+ const llvm::opt::ArgList &Args);
} // end namespace arm
namespace ppc {
@@ -800,6 +839,7 @@ public:
bool hasIntegratedCPP() const override { return false; }
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -812,6 +852,7 @@ public:
bool isLinkJob() const override { return true; }
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -826,6 +867,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -840,6 +882,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -855,6 +898,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -867,6 +911,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -884,6 +929,7 @@ public:
bool isLinkJob() const override { return true; }
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -898,8 +944,8 @@ public:
bool hasIntegratedCPP() const override { return false; }
void ConstructJob(Compilation &C, const JobAction &JA,
- const InputInfo &Output,
- const InputInfoList &Inputs,
+ const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -914,6 +960,7 @@ public:
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -932,6 +979,7 @@ class LLVM_LIBRARY_VISIBILITY Assembler
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
@@ -948,6 +996,7 @@ class LLVM_LIBRARY_VISIBILITY Linker : p
void ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output, const InputInfoList &Inputs,
+ const llvm::Triple &EffectiveTriple,
const llvm::opt::ArgList &TCArgs,
const char *LinkingOutput) const override;
};
More information about the cfe-commits
mailing list