Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -323,7 +323,7 @@ const InputInfo &Output, const InputInfoList &Inputs) const { Arg *A; - const bool IsIAMCU = getToolChain().getTriple().isOSIAMCU(); + const bool IsIAMCU = getToolChain().getEffectiveTriple().isOSIAMCU(); CheckPreprocessingOptions(D, Args); @@ -1456,7 +1456,7 @@ const Driver &D = getToolChain().getDriver(); StringRef CPUName; StringRef ABIName; - const llvm::Triple &Triple = getToolChain().getTriple(); + const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName); CmdArgs.push_back("-target-abi"); @@ -2011,7 +2011,7 @@ // the plugin. // Handle flags for selecting CPU variants. - std::string CPU = getCPUName(Args, ToolChain.getTriple()); + std::string CPU = getCPUName(Args, ToolChain.getEffectiveTriple()); if (!CPU.empty()) CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=mcpu=") + CPU)); @@ -2631,7 +2631,7 @@ const ObjCRuntime &objcRuntime, ArgStringList &CmdArgs) { const Driver &D = TC.getDriver(); - const llvm::Triple &Triple = TC.getTriple(); + const llvm::Triple &Triple = TC.getEffectiveTriple(); if (KernelOrKext) { // -mkernel and -fapple-kext imply no exceptions, so claim exception related @@ -2699,7 +2699,7 @@ static bool ShouldDisableAutolink(const ArgList &Args, const ToolChain &TC) { bool Default = true; - if (TC.getTriple().isOSDarwin()) { + if (TC.getEffectiveTriple().isOSDarwin()) { // The native darwin assembler doesn't support the linker_option directives, // so we disable them if we think the .s file will be passed to it. Default = TC.useIntegratedAs(); @@ -2821,7 +2821,7 @@ // Only default to -mincremental-linker-compatible if we think we are // targeting the MSVC linker. bool DefaultIncrementalLinkerCompatible = - C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment(); + C.getDefaultToolChain().getEffectiveTriple().isWindowsMSVCEnvironment(); if (Args.hasFlag(options::OPT_mincremental_linker_compatible, options::OPT_mno_incremental_linker_compatible, DefaultIncrementalLinkerCompatible)) @@ -3091,7 +3091,7 @@ CmdArgs.push_back("-lrt"); CmdArgs.push_back("-lm"); // There's no libdl on FreeBSD. - if (TC.getTriple().getOS() != llvm::Triple::FreeBSD) + if (TC.getEffectiveTriple().getOS() != llvm::Triple::FreeBSD) CmdArgs.push_back("-ldl"); } @@ -3112,7 +3112,7 @@ StaticRuntimes.push_back("stats_client"); // Collect static runtimes. - if (Args.hasArg(options::OPT_shared) || TC.getTriple().isAndroid()) { + if (Args.hasArg(options::OPT_shared) || TC.getEffectiveTriple().isAndroid()) { // Don't link static runtimes into DSOs or if compiling for Android. return; } @@ -3217,7 +3217,7 @@ CmdArgs.push_back("-lc++"); else CmdArgs.push_back("-lstdc++"); - if (TC.getTriple().getOS() != llvm::Triple::FreeBSD) + if (TC.getEffectiveTriple().getOS() != llvm::Triple::FreeBSD) CmdArgs.push_back("-ldl"); } @@ -6186,7 +6186,7 @@ // -fnext-runtime } else if (runtimeArg->getOption().matches(options::OPT_fnext_runtime)) { // On Darwin, make this use the default behavior for the toolchain. - if (getToolChain().getTriple().isOSDarwin()) { + if (getToolChain().getEffectiveTriple().isOSDarwin()) { runtime = getToolChain().getDefaultObjCRuntime(isNonFragile); // Otherwise, build for a generic macosx port. @@ -6446,7 +6446,7 @@ ArgStringList &CmdArgs) const { StringRef CPUName; StringRef ABIName; - const llvm::Triple &Triple = getToolChain().getTriple(); + const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName); CmdArgs.push_back("-target-abi"); @@ -6646,7 +6646,7 @@ // creating an object. // TODO: Currently only works on linux with newer objcopy. if (Args.hasArg(options::OPT_gsplit_dwarf) && - getToolChain().getTriple().isOSLinux()) + getToolChain().getEffectiveTriple().isOSLinux()) SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output, SplitDebugName(Args, Input)); } @@ -7533,7 +7533,7 @@ // FIXME: at run-time detect assembler capabilities or rely on version // information forwarded by -target-assembler-version. if (Args.hasArg(options::OPT_fno_integrated_as)) { - const llvm::Triple &T(getToolChain().getTriple()); + const llvm::Triple &T(getToolChain().getEffectiveTriple()); if (!(T.isMacOSX() && T.isMacOSXVersionLT(10, 7))) CmdArgs.push_back("-Q"); } @@ -8406,7 +8406,7 @@ } StringRef MyArch; - switch (getToolChain().getArch()) { + switch (getToolChain().getEffectiveTriple().getArch()) { case llvm::Triple::arm: MyArch = "arm"; break; @@ -8947,7 +8947,7 @@ AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs); unsigned Major, Minor, Micro; - getToolChain().getTriple().getOSVersion(Major, Minor, Micro); + getToolChain().getEffectiveTriple().getOSVersion(Major, Minor, Micro); bool useLibgcc = true; if (Major >= 7 || Major == 0) { switch (getToolChain().getArch()) { @@ -9227,7 +9227,7 @@ // creating an object. // TODO: Currently only works on linux with newer objcopy. if (Args.hasArg(options::OPT_gsplit_dwarf) && - getToolChain().getTriple().isOSLinux()) + getToolChain().getEffectiveTriple().isOSLinux()) SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output, SplitDebugName(Args, Inputs[0])); } @@ -9626,7 +9626,7 @@ const toolchains::NaClToolChain &ToolChain = static_cast(getToolChain()); const Driver &D = ToolChain.getDriver(); - const llvm::Triple::ArchType Arch = ToolChain.getArch(); + const llvm::Triple::ArchType Arch = ToolChain.getEffectiveTriple().getArch(); const bool IsStatic = !Args.hasArg(options::OPT_dynamic) && !Args.hasArg(options::OPT_shared); @@ -9726,7 +9726,7 @@ // without '-lnacl' it prefers symbols from libpthread.a over libnacl.a, // which is not a desired behaviour here. // See https://sourceware.org/ml/binutils/2015-03/msg00034.html - if (getToolChain().getArch() == llvm::Triple::mipsel) + if (Arch == llvm::Triple::mipsel) CmdArgs.push_back("-lnacl"); CmdArgs.push_back("-lpthread"); @@ -9743,7 +9743,7 @@ // Mips needs to create and use pnacl_legacy library that contains // definitions from bitcode/pnaclmm.c and definitions for // __nacl_tp_tls_offset() and __nacl_tp_tdb_offset(). - if (getToolChain().getArch() == llvm::Triple::mipsel) + if (Arch == llvm::Triple::mipsel) CmdArgs.push_back("-lpnacl_legacy"); CmdArgs.push_back("--end-group"); @@ -9850,7 +9850,7 @@ // When building 32-bit code on DragonFly/pc64, we have to explicitly // instruct as in the base system to assemble 32-bit code. - if (getToolChain().getArch() == llvm::Triple::x86) + if (getToolChain().getEffectiveTriple().getArch() == llvm::Triple::x86) CmdArgs.push_back("--32"); Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler); @@ -9894,7 +9894,7 @@ // When building 32-bit code on DragonFly/pc64, we have to explicitly // instruct ld in the base system to link 32-bit code. - if (getToolChain().getArch() == llvm::Triple::x86) { + if (getToolChain().getEffectiveTriple().getArch() == llvm::Triple::x86) { CmdArgs.push_back("-m"); CmdArgs.push_back("elf_i386"); }