Home | History | Annotate | Download | only in Driver

Lines Matching refs:Args

55 static void handleTargetFeaturesGroup(const ArgList &Args,
58 for (const Arg *A : Args.filtered(Group)) {
69 Features.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name));
113 static void CheckPreprocessingOptions(const Driver &D, const ArgList &Args) {
114 if (Arg *A = Args.getLastArg(options::OPT_C, options::OPT_CC)) {
115 if (!Args.hasArg(options::OPT_E) && !Args.hasArg(options::OPT__SLASH_P) &&
116 !Args.hasArg(options::OPT__SLASH_EP) && !D.CCCIsCPP()) {
118 << A->getBaseArg().getAsString(Args)
126 static void CheckCodeGenerationOptions(const Driver &D, const ArgList &Args) {
128 if (Args.hasArg(options::OPT_static))
130 Args.getLastArg(options::OPT_dynamic, options::OPT_mdynamic_no_pic))
131 D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args)
181 static void addDirectoryList(const ArgList &Args, ArgStringList &CmdArgs,
201 CmdArgs.push_back(Args.MakeArgString(std::string(ArgName) + "."));
209 Args.MakeArgString(std::string(ArgName) + Dirs.substr(0, Delim)));
212 CmdArgs.push_back(Args.MakeArgString(Dirs.substr(0, Delim)));
220 CmdArgs.push_back(Args.MakeArgString(std::string(ArgName) + "."));
227 CmdArgs.push_back(Args.MakeArgString(std::string(ArgName) + Dirs));
230 CmdArgs.push_back(Args.MakeArgString(Dirs));
236 const ArgList &Args, ArgStringList &CmdArgs) {
241 Args.AddAllArgValues(CmdArgs, options::OPT_Zlinker_input);
259 TC.AddCXXStdlibLibArgs(Args, CmdArgs);
261 TC.AddCCKextLibArgs(Args, CmdArgs);
265 A.render(Args, CmdArgs);
267 A.renderAsInput(Args, CmdArgs);
274 addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH");
279 static bool isObjCAutoRefCount(const ArgList &Args) {
280 return Args.hasFlag(options::OPT_fobjc_arc, options::OPT_fno_objc_arc, false);
284 static bool isObjCRuntimeLinked(const ArgList &Args) {
285 if (isObjCAutoRefCount(Args)) {
286 Args.ClaimAllArgs(options::OPT_fobjc_link_runtime);
289 return Args.hasArg(options::OPT_fobjc_link_runtime);
300 const Driver &D, const ArgList &Args,
308 CheckPreprocessingOptions(D, Args);
310 Args.AddLastArg(CmdArgs, options::OPT_C);
311 Args.AddLastArg(CmdArgs, options::OPT_CC);
314 if ((A = Args.getLastArg(options::OPT_M, options::OPT_MM)) ||
315 (A = Args.getLastArg(options::OPT_MD)) ||
316 (A = Args.getLastArg(options::OPT_MMD))) {
319 if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
328 DepFile = getDependencyFileName(Args, Inputs);
335 if (!Args.hasArg(options::OPT_MT) && !Args.hasArg(options::OPT_MQ)) {
340 Arg *OutputOpt = Args.getLastArg(options::OPT_o);
349 DepTarget = Args.MakeArgString(llvm::sys::path::filename(P));
355 CmdArgs.push_back(Args.MakeArgString(Quoted));
362 !Args.hasArg(options::OPT_fno_module_file_deps)) ||
363 Args.hasArg(options::OPT_fmodule_file_deps))
367 if (Args.hasArg(options::OPT_MG)) {
374 Args.AddLastArg(CmdArgs, options::OPT_MP);
375 Args.AddLastArg(CmdArgs, options::OPT_MV);
377 // Convert all -MQ <target> args to -MT <quoted target>
378 for (const Arg *A : Args.filtered(options::OPT_MT, options::OPT_MQ)) {
385 CmdArgs.push_back(Args.MakeArgString(Quoted));
389 A->render(Args, CmdArgs);
401 const Arg *YcArg = Args.getLastArg(options::OPT__SLASH_Yc);
402 const Arg *YuArg = Args.getLastArg(options::OPT__SLASH_Yu);
403 for (const Arg *A : Args.filtered(options::OPT_clang_i_Group)) {
419 CmdArgs.push_back(Args.MakeArgString(Twine("-find-pch-source=") +
425 for (const Arg *A : Args.filtered(options::OPT_clang_i_Group)) {
459 Args.MakeArgString(D.GetClPchPath(C, A->getValue())));
505 CmdArgs.push_back(Args.MakeArgString(P));
510 << A->getAsString(Args);
524 A->render(Args, CmdArgs);
527 Args.AddAllArgs(CmdArgs,
537 Args.AddAllArgValues(CmdArgs, options::OPT_Wp_COMMA,
541 if (Arg *A = Args.getLastArg(options::OPT_I_))
542 D.Diag(diag::err_drv_I_dash_not_supported) << A->getAsString(Args);
548 if (!Args.hasArg(options::OPT_isysroot)) {
559 addDirectoryList(Args, CmdArgs, "-I", "CPATH");
561 addDirectoryList(Args, CmdArgs, "-c-isystem", "C_INCLUDE_PATH");
563 addDirectoryList(Args, CmdArgs, "-cxx-isystem", "CPLUS_INCLUDE_PATH");
565 addDirectoryList(Args, CmdArgs, "-objc-isystem", "OBJC_INCLUDE_PATH");
567 addDirectoryList(Args, CmdArgs, "-objcxx-isystem", "OBJCPLUS_INCLUDE_PATH");
576 getToolChain().AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
578 AuxToolChain->AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
583 getToolChain().AddClangSystemIncludeArgs(Args, CmdArgs);
585 AuxToolChain->AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
588 getToolChain().AddIAMCUIncludeArgs(Args, CmdArgs);
593 getToolChain().AddCudaIncludeArgs(Args, CmdArgs);
653 // Get Arch/CPU from args.
654 static void getARMArchCPUFromArgs(const ArgList &Args, llvm::StringRef &Arch,
656 if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
658 if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
664 Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
676 const ArgList &Args, StringRef HWDiv,
680 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
685 const ArgList &Args, StringRef FPU,
689 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
711 static void checkARMArchName(const Driver &D, const Arg *A, const ArgList &Args,
720 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
724 static void checkARMCPUName(const Driver &D, const Arg *A, const ArgList &Args,
733 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
745 arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
747 const llvm::Triple Triple(TC.ComputeEffectiveClangTriple(Args));
751 Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float,
764 D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
773 D.Diag(diag::err_drv_unsupported_opt_for_target) << A->getAsString(Args)
849 const ArgList &Args,
855 Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
856 arm::FloatABI ABI = arm::getARMFloatABI(TC, Args);
884 Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
899 const Arg *ArchArg = Args.getLastArg(options::OPT_march_EQ);
904 << ArchArg->getAsString(Args);
906 checkARMArchName(D, WaArch, Args, ArchName, Features, Triple);
908 D.Diag(clang::diag::warn_drv_unused_argument) << WaArch->getAsString(Args);
911 checkARMArchName(D, ArchArg, Args, ArchName, Features, Triple);
915 const Arg *CPUArg = Args.getLastArg(options::OPT_mcpu_EQ);
920 << CPUArg->getAsString(Args);
922 checkARMCPUName(D, WaCPU, Args, CPUName, ArchName, Features, Triple);
925 checkARMCPUName(D, CPUArg, Args, CPUName, ArchName, Features, Triple);
934 Args.MakeArgString((F.second ? "+" : "-") + F.first()));
938 const Arg *FPUArg = Args.getLastArg(options::OPT_mfpu_EQ);
942 << FPUArg->getAsString(Args);
943 getARMFPUFeatures(D, WaFPU, Args, StringRef(WaFPU->getValue()).substr(6),
946 getARMFPUFeatures(D, FPUArg, Args, FPUArg->getValue(), Features);
950 const Arg *HDivArg = Args.getLastArg(options::OPT_mhwdiv_EQ);
954 << HDivArg->getAsString(Args);
955 getARMHWDivFeatures(D, WaHDiv, Args,
958 getARMHWDivFeatures(D, HDivArg, Args, HDivArg->getValue(), Features);
969 if (Arg *A = Args.getLastArg(options::OPT_mcrc, options::OPT_mnocrc)) {
979 if (Arg *A = Args.getLastArg(options::OPT_mlong_calls,
991 else if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
1032 if (Args.hasArg(options::OPT_ffixed_r9))
1036 if (KernelOrKext || Args.hasArg(options::OPT_mno_movt))
1040 void Clang::AddARMTargetArgs(const llvm::Triple &Triple, const ArgList &Args,
1046 if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
1085 arm::FloatABI ABI = arm::getARMFloatABI(getToolChain(), Args);
1104 if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge,
1113 if (!Args.hasFlag(options::OPT_mimplicit_float,
1121 static std::string getAArch64TargetCPU(const ArgList &Args) {
1125 if ((A = Args.getLastArg(options::OPT_mtune_EQ))) {
1127 } else if ((A = Args.getLastArg(options::OPT_mcpu_EQ))) {
1140 if (Args.getLastArg(options::OPT_arch))
1146 void Clang::AddAArch64TargetArgs(const ArgList &Args,
1148 std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
1151 if (!Args.hasFlag(options::OPT_mred_zone, options::OPT_mno_red_zone, true) ||
1152 Args.hasArg(options::OPT_mkernel) ||
1153 Args.hasArg(options::OPT_fapple_kext))
1156 if (!Args.hasFlag(options::OPT_mimplicit_float,
1161 if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
1171 if (Arg *A = Args.getLastArg(options::OPT_mfix_cortex_a53_835769,
1185 if (Arg *A = Args.getLastArg(options::OPT_mglobal_merge,
1197 void mips::getMipsCPUAndABI(const ArgList &Args, const llvm::Triple &Triple,
1220 if (Arg *A = Args.getLastArg(options::OPT_march_EQ, options::OPT_mcpu_EQ))
1223 if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
1293 std::string mips::getMipsABILibSuffix(const ArgList &Args,
1296 tools::mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName);
1313 static mips::FloatABI getMipsFloatABI(const Driver &D, const ArgList &Args) {
1316 Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float,
1328 D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
1346 static void AddTargetFeature(const ArgList &Args,
1350 if (Arg *A = Args.getLastArg(OnOpt, OffOpt)) {
1352 Features.push_back(Args.MakeArgString("+" + FeatureName));
1354 Features.push_back(Args.MakeArgString("-" + FeatureName));
1359 const ArgList &Args,
1363 mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName);
1366 AddTargetFeature(Args, Features, options::OPT_mno_abicalls,
1369 mips::FloatABI FloatABI = getMipsFloatABI(D, Args);
1377 if (Arg *A = Args.getLastArg(options::OPT_mnan_EQ)) {
1398 AddTargetFeature(Args, Features, options::OPT_msingle_float,
1400 AddTargetFeature(Args, Features, options::OPT_mips16, options::OPT_mno_mips16,
1402 AddTargetFeature(Args, Features, options::OPT_mmicromips,
1404 AddTargetFeature(Args, Features, options::OPT_mdsp, options::OPT_mno_dsp,
1406 AddTargetFeature(Args, Features, options::OPT_mdspr2, options::OPT_mno_dspr2,
1408 AddTargetFeature(Args, Features, options::OPT_mmsa, options::OPT_mno_msa,
1414 if (Arg *A = Args.getLastArg(options::OPT_mfp32, options::OPT_mfpxx,
1417 Features.push_back(Args.MakeArgString("-fp64"));
1419 Features.push_back(Args.MakeArgString("+fpxx"));
1420 Features.push_back(Args.MakeArgString("+nooddspreg"));
1422 Features.push_back(Args.MakeArgString("+fp64"));
1423 } else if (mips::shouldUseFPXX(Args, Triple, CPUName, ABIName, FloatABI)) {
1424 Features.push_back(Args.MakeArgString("+fpxx"));
1425 Features.push_back(Args.MakeArgString("+nooddspreg"));
1427 Features.push_back(Args.MakeArgString("+fp64"));
1428 Features.push_back(Args.MakeArgString("+nooddspreg"));
1431 AddTargetFeature(Args, Features, options::OPT_mno_odd_spreg,
1435 void Clang::AddMIPSTargetArgs(const ArgList &Args,
1441 mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName);
1446 mips::FloatABI ABI = getMipsFloatABI(D, Args);
1459 if (Arg *A = Args.getLastArg(options::OPT_mxgot, options::OPT_mno_xgot)) {
1466 if (Arg *A = Args.getLastArg(options::OPT_mldc1_sdc1,
1474 if (Arg *A = Args.getLastArg(options::OPT_mcheck_zero_division,
1482 if (Arg *A = Args.getLastArg(options::OPT_G)) {
1485 CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v));
1489 if (Arg *A = Args.getLastArg(options::OPT_mcompact_branches_EQ)) {
1494 CmdArgs.push_back(Args.MakeArgString("-mips-compact-branches=" + Val));
1504 static std::string getPPCTargetCPU(const ArgList &Args) {
1505 if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
1570 const ArgList &Args,
1572 handleTargetFeaturesGroup(Args, Features, options::OPT_m_ppc_Features_Group);
1574 ppc::FloatABI FloatABI = ppc::getPPCFloatABI(D, Args);
1586 AddTargetFeature(Args, Features, options::OPT_faltivec,
1590 ppc::FloatABI ppc::getPPCFloatABI(const Driver &D, const ArgList &Args) {
1593 Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float,
1605 D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
1619 void Clang::AddPPCTargetArgs(const ArgList &Args,
1630 if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
1632 HasQPX = Args.hasFlag(options::OPT_mqpx, options::OPT_mno_qpx, HasQPX);
1648 if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
1656 ppc::getPPCFloatABI(getToolChain().getDriver(), Args);
1676 bool ppc::hasPPCAbiArg(const ArgList &Args, const char *Value) {
1677 Arg *A = Args.getLastArg(options::OPT_mabi_EQ);
1682 static std::string getR600TargetGPU(const ArgList &Args) {
1683 if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
1698 static std::string getLanaiTargetCPU(const ArgList &Args) {
1699 if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
1706 const ArgList &Args) {
1709 Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float,
1722 D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
1740 static void getSparcTargetFeatures(const Driver &D, const ArgList &Args,
1742 sparc::FloatABI FloatABI = sparc::getSparcFloatABI(D, Args);
1747 void Clang::AddSparcTargetArgs(const ArgList &Args,
1750 sparc::getSparcFloatABI(getToolChain().getDriver(), Args);
1765 void Clang::AddSystemZTargetArgs(const ArgList &Args,
1767 if (Args.hasFlag(options::OPT_mbackchain, options::OPT_mno_backchain, false))
1771 static const char *getSystemZTargetCPU(const ArgList &Args) {
1772 if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
1777 static void getSystemZTargetFeatures(const ArgList &Args,
1780 if (Arg *A = Args.getLastArg(options::OPT_mhtm, options::OPT_mno_htm)) {
1787 if (Arg *A = Args.getLastArg(options::OPT_mvx, options::OPT_mno_vx)) {
1795 static const char *getX86TargetCPU(const ArgList &Args,
1797 Args.getLastArg(options::OPT_march_EQ)) {
1812 return Args.MakeArgString(CPU);
1815 if (const Arg *A = Args.getLastArg(options::OPT__SLASH_arch)) {
1880 static StringRef getWebAssemblyTargetCPU(const ArgList &Args) {
1882 if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
1898 static std::string getCPUName(const ArgList &Args, const llvm::Triple &T,
1906 return getAArch64TargetCPU(Args);
1913 getARMArchCPUFromArgs(Args, MArch, MCPU, FromAs);
1922 mips::getMipsCPUAndABI(Args, T, CPUName, ABIName);
1928 if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
1935 std::string TargetCPUName = getPPCTargetCPU(Args);
1953 if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
1959 return getX86TargetCPU(Args, T);
1963 toolchains::HexagonToolChain::GetTargetCPUVersion(Args).str();
1966 return getLanaiTargetCPU(Args);
1969 return getSystemZTargetCPU(Args);
1973 return getR600TargetGPU(Args);
1977 return getWebAssemblyTargetCPU(Args);
1981 static void AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args,
1989 CmdArgs.push_back(Args.MakeArgString(Plugin));
1995 std::string CPU = getCPUName(Args, ToolChain.getTriple());
1997 CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=mcpu=") + CPU));
1999 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
2009 CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt));
2016 if (Arg *A = Args.getLastArg(options::OPT_gTune_Group,
2059 static void ParseMRecip(const Driver &D, const ArgList &Args,
2066 Arg *A = Args.getLastArg(options::OPT_mrecip, options::OPT_mrecip_EQ);
2073 OutStrings.push_back(Args.MakeArgString(Out + "all"));
2085 OutStrings.push_back(Args.MakeArgString(Out + Val));
2150 Out = Args.MakeArgString(Out + Prefix + Val);
2152 Out = Args.MakeArgString(Out + ",");
2155 OutStrings.push_back(Args.MakeArgString(Out));
2159 const ArgList &Args,
2162 if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
2168 Args.MakeArgString((F.second ? "+" : "-") + F.first()));
2194 if (Arg *A = Args.getLastArg(options::OPT__SLASH_arch)) {
2201 Features.push_back(Args.MakeArgString("+" + Arch.lower()));
2210 Features.push_back(Args.MakeArgString("+" + Arch.lower()));
2214 D.Diag(clang::diag::warn_drv_unused_argument) << A->getAsString(Args);
2219 handleTargetFeaturesGroup(Args, Features, options::OPT_m_x86_Features_Group);
2222 void Clang::AddX86TargetArgs(const ArgList &Args,
2224 if (!Args.hasFlag(options::OPT_mred_zone, options::OPT_mno_red_zone, true) ||
2225 Args.hasArg(options::OPT_mkernel) ||
2226 Args.hasArg(options::OPT_fapple_kext))
2231 bool NoImplicitFloat = (Args.hasArg(options::OPT_mkernel) ||
2232 Args.hasArg(options::OPT_fapple_kext));
2233 if (Arg *A = Args.getLastArg(
2243 if (Arg *A = Args.getLastArg(options::OPT_masm_EQ)) {
2247 CmdArgs.push_back(Args.MakeArgString("-x86-asm-syntax=" + Value));
2255 if (Args.hasFlag(options::OPT_miamcu, options::OPT_mno_iamcu, false)) {
2262 void Clang::AddHexagonTargetArgs(const ArgList &Args,
2267 if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
2271 CmdArgs.push_back(Args.MakeArgString(Opt));
2274 if (!Args.hasArg(options::OPT_fno_short_enums))
2276 if (Args.getLastArg(options::OPT_mieee_rnd_near)) {
2284 void Clang::AddLanaiTargetArgs(const ArgList &Args,
2286 if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
2290 CmdArgs.push_back(Args.MakeArgString(CPUName));
2292 if (Arg *A = Args.getLastArg(options::OPT_mregparm_EQ)) {
2307 void Clang::AddWebAssemblyTargetArgs(const ArgList &Args,
2310 if (!Args.hasArg(options::OPT_fvisibility_EQ,
2379 const ArgList &Args,
2402 const ArgList &Args,
2414 const ArgList &Args,
2429 const ArgList &Args,
2437 return getAArch64MicroArchFeaturesFromMtune(D, CPU, Args, Features);
2440 static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args,
2446 if ((A = Args.getLastArg(options::OPT_march_EQ)))
2447 success = getAArch64ArchFeaturesFromMarch(D, A->getValue(), Args, Features);
2448 else if ((A = Args.getLastArg(options::OPT_mcpu_EQ)))
2449 success = getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Features);
2450 else if (Args.hasArg(options::OPT_arch))
2451 success = getAArch64ArchFeaturesFromMcpu(D, getAArch64TargetCPU(Args), Args,
2454 if (success && (A = Args.getLastArg(options::OPT_mtune_EQ)))
2456 getAArch64MicroArchFeaturesFromMtune(D, A->getValue(), Args, Features);
2457 else if (success && (A = Args.getLastArg(options::OPT_mcpu_EQ)))
2459 getAArch64MicroArchFeaturesFromMcpu(D, A->getValue(), Args, Features);
2460 else if (Args.hasArg(options::OPT_arch))
2461 success = getAArch64MicroArchFeaturesFromMcpu(D, getAArch64TargetCPU(Args),
2462 Args, Features);
2465 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
2467 if (Args.getLastArg(options::OPT_mgeneral_regs_only)) {
2474 if (Arg *A = Args.getLastArg(options::OPT_mcrc, options::OPT_mnocrc)) {
2481 if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
2486 if (Args.hasArg(options::OPT_ffixed_x18))
2490 static void getHexagonTargetFeatures(const ArgList &Args,
2497 for (auto &A : Args) {
2516 static void getWebAssemblyTargetFeatures(const ArgList &Args,
2518 handleTargetFeaturesGroup(Args, Features, options::OPT_m_wasm_Features_Group);
2521 static void getAMDGPUTargetFeatures(const Driver &D, const ArgList &Args,
2523 if (const Arg *dAbi = Args.getLastArg(options::OPT_mamdgpu_debugger_abi)) {
2530 D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args);
2535 Args, Features, options::OPT_m_amdgpu_Features_Group);
2539 const ArgList &Args, ArgStringList &CmdArgs,
2550 getMIPSTargetFeatures(D, Triple, Args, Features);
2557 getARMTargetFeatures(TC, Triple, Args, Features, ForAS);
2563 getPPCTargetFeatures(D, Triple, Args, Features);
2566 getSystemZTargetFeatures(Args, Features);
2570 getAArch64TargetFeatures(D, Args, Features);
2574 getX86TargetFeatures(D, Triple, Args, Features);
2577 getHexagonTargetFeatures(Args, Features);
2581 getWebAssemblyTargetFeatures(Args, Features);
2586 getSparcTargetFeatures(D, Args, Features);
2590 getAMDGPUTargetFeatures(D, Args, Features);
2637 static void addExceptionArgs(const ArgList &Args, types::ID InputType,
2647 Args.ClaimAllArgs(options::OPT_fexceptions);
2648 Args.ClaimAllArgs(options::OPT_fno_exceptions);
2649 Args.ClaimAllArgs(options::OPT_fobjc_exceptions);
2650 Args.ClaimAllArgs(options::OPT_fno_objc_exceptions);
2651 Args.ClaimAllArgs(options::OPT_fcxx_exceptions);
2652 Args.ClaimAllArgs(options::OPT_fno_cxx_exceptions);
2657 bool EH = Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
2663 Args.hasFlag(options::OPT_fobjc_exceptions,
2674 Arg *ExceptionArg = Args.getLastArg(
2692 << RTTIArg->getAsString(Args) << ExceptionArg->getAsString(Args);
2708 static bool ShouldDisableAutolink(const ArgList &Args, const ToolChain &TC) {
2715 return !Args.hasFlag(options::OPT_fautolink, options::OPT_fno_autolink,
2719 Args,
2722 Args.hasFlag(options::OPT_fdwarf_directory_asm,
2741 static bool UseRelaxAll(Compilation &C, const ArgList &Args) {
2744 if (Arg *A = Args.getLastArg(options::OPT_O_Group))
2757 return Args.hasFlag(options::OPT_mrelax_all, options::OPT_mno_relax_all,
2787 static void RenderDebugEnablingArgs(const ArgList &Args, ArgStringList &CmdArgs,
2806 Args.MakeArgString("-dwarf-version=" + Twine(DwarfVersion)));
2823 const ArgList &Args,
2826 if (UseRelaxAll(C, Args))
2833 if (Args.hasFlag(options::OPT_mincremental_linker_compatible,
2852 Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
2943 RenderDebugEnablingArgs(Args, CmdArgs,
2973 static void addClangRT(const ToolChain &TC, const ArgList &Args,
2975 CmdArgs.push_back(TC.getCompilerRTArgString(Args, "builtins"));
3002 const ArgList &Args) {
3005 const Arg *A = Args.getLastArg(options::OPT_fopenmp_EQ);
3028 const ArgList &Args) {
3029 if (!Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
3033 switch (getOpenMPRuntime(TC, Args)) {
3049 static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args,
3055 CmdArgs.push_back(TC.getCompilerRTArgString(Args, Sanitizer, IsShared));
3061 static bool addSanitizerDynamicList(const ToolChain &TC, const ArgList &Args,
3064 SmallString<128> SanRT(TC.getCompilerRT(Args, Sanitizer));
3066 CmdArgs.push_back(Args.MakeArgString("--dynamic-list=" + SanRT + ".syms"));
3086 collectSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
3102 if (Args.hasArg(options::OPT_shared) || TC.getTriple().isAndroid()) {
3153 static bool addSanitizerRuntimes(const ToolChain &TC, const ArgList &Args,
3157 collectSanitizerRuntimes(TC, Args, SharedRuntimes, StaticRuntimes,
3161 addSanitizerRuntime(TC, Args, CmdArgs, RT, true, false);
3163 addSanitizerRuntime(TC, Args, CmdArgs, RT, false, true);
3166 addSanitizerRuntime(TC, Args, CmdArgs, RT, false, true);
3167 AddExportDynamic |= !addSanitizerDynamicList(TC, Args, CmdArgs, RT);
3170 addSanitizerRuntime(TC, Args, CmdArgs, RT, false, false);
3171 AddExportDynamic |= !addSanitizerDynamicList(TC, Args, CmdArgs, RT);
3175 CmdArgs.push_back(Args.MakeArgString(S));
3184 static bool addXRayRuntime(const ToolChain &TC, const ArgList &Args,
3186 if (Args.hasFlag(options::OPT_fxray_instrument,
3189 CmdArgs.push_back(TC.getCompilerRTArgString(Args, "xray", false));
3196 static void linkXRayRuntimeDeps(const ToolChain &TC, const ArgList &Args,
3203 if (TC.GetCXXStdlibType(Args) == ToolChain::CST_Libcxx)
3211 static bool areOptimizationsEnabled(const ArgList &Args) {
3213 if (Arg *A = Args.getLastArg(options::OPT_O_Group))
3219 static bool shouldUseFramePointerForTarget(const ArgList &Args,
3242 return !areOptimizationsEnabled(Args);
3251 return !areOptimizationsEnabled(Args);
3268 static bool shouldUseFramePointer(const ArgList &Args,
3270 if (Arg *A = Args.getLastArg(options::OPT_fno_omit_frame_pointer,
3273 if (Args.hasArg(options::OPT_pg))
3276 return shouldUseFramePointerForTarget(Args, Triple);
3279 static bool shouldUseLeafFramePointer(const ArgList &Args,
3281 if (Arg *A = Args.getLastArg(options::OPT_mno_omit_leaf_frame_pointer,
3284 if (Args.hasArg(options::OPT_pg))
3290 return shouldUseFramePointerForTarget(Args, Triple);
3294 static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs) {
3298 CmdArgs.push_back(Args.MakeArgString(cwd));
3302 static const char *SplitDebugName(const ArgList &Args, const InputInfo &Input) {
3303 Arg *FinalOutput = Args.getLastArg(options::OPT_o);
3304 if (FinalOutput && Args.hasArg(options::OPT_c)) {
3307 return Args.MakeArgString(T);
3311 Args.getLastArgValue(options::OPT_fdebug_compilation_dir));
3315 return Args.MakeArgString(F);
3320 const JobAction &JA, const ArgList &Args,
3333 const char *Exec = Args.MakeArgString(TC.GetProgramPath("objcopy"));
3345 static bool shouldEnableVectorizerAtOLevel(const ArgList &Args, bool isSlpVec) {
3346 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
3376 static void addDashXForInput(const ArgList &Args, const InputInfo &Input,
3380 if (Args.hasArg(options::OPT_verify_pch) && Input.getType() == types::TY_PCH)
3384 if (Args.hasArg(options::OPT_rewrite_objc))
3406 static void claimNoWarnArgs(const ArgList &Args) {
3409 Args.ClaimAllArgs(options::OPT_flto_EQ);
3410 Args.ClaimAllArgs(options::OPT_flto);
3411 Args.ClaimAllArgs(options::OPT_fno_lto);
3448 const llvm::opt::ArgList &Args,
3450 if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
3452 Args.hasArg(options::OPT_fmsc_version) ||
3453 Args.hasArg(options::OPT_fms_compatibility_version)) {
3454 const Arg *MSCVersion = Args.getLastArg(options::OPT_fmsc_version);
3456 Args.getLastArg(options::OPT_fms_compatibility_version);
3461 << MSCVersion->getAsString(Args)
3462 << MSCompatibilityVersion->getAsString(Args);
3470 << MSCompatibilityVersion->getAsString(Args)
3478 D->Diag(diag::err_drv_invalid_value) << MSCVersion->getAsString(Args)
3501 const InputInfo &Output, const ArgList &Args,
3503 auto *ProfileGenerateArg = Args.getLastArg(
3513 auto *ProfileUseArg = Args.getLastArg(
3528 CmdArgs.push_back(Args.MakeArgString(Twine("-fprofile-instrument-path=") +
3535 Args.MakeArgString(Twine("-fprofile-instrument-path=") + Path));
3543 CmdArgs.push_back(Args.MakeArgString(
3554 Args.MakeArgString(Twine("-fprofile-instrument-use-path=") + Path));
3558 if (Args.hasArg(options::OPT_ftest_coverage) ||
3559 Args.hasArg(options::OPT_coverage))
3561 if (Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
3563 Args.hasArg(options::OPT_coverage))
3566 if (Args.hasFlag(options::OPT_fcoverage_mapping,
3573 if (Args.hasFlag(options::OPT_fcoverage_mapping,
3594 CmdArgs.push_back(Args.MakeArgString(CoverageFilename));
3599 static void addPS4ProfileRTArgs(const ToolChain &TC, const ArgList &Args,
3601 if ((Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
3603 Args
3605 Args.hasFlag(options::OPT_fprofile_generate_EQ,
3607 Args.hasFlag(options::OPT_fprofile_instr_generate,
3609 Args.hasFlag(options::OPT_fprofile_instr_generate_EQ,
3611 Args.hasArg(options::OPT_fcreate_profile) ||
3612 Args.hasArg(options::OPT_coverage)))
3622 const ArgList &Args) {
3629 Args.hasArg(options::OPT_static))
3634 Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
3688 Arg *LastPICArg = Args.getLastArg(options::OPT_fPIC, options::OPT_fno_PIC,
3707 Arg *ModelArg = Args.getLastArg(options::OPT_mcmodel_EQ);
3731 if (Arg *A = Args.getLastArg(options::OPT_mdynamic_no_pic)) {
3766 static void AddAssemblerKPIC(const ToolChain &ToolChain, const ArgList &Args,
3772 ParsePICArgs(ToolChain, ToolChain.getTriple(), Args);
3780 const ArgList &Args, const char *LinkingOutput) const {
3781 std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
3785 Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
3816 CmdArgs.push_back(Args.MakeArgString(TripleStr));
3832 CmdArgs.push_back(Args.MakeArgString(AuxToolChain->getTriple().str()));
3863 if (Args.hasArg(options::OPT_rewrite_objc) &&
3864 !Args.hasArg(options::OPT_g_Group))
3870 CollectArgsForIntegratedAssembler(C, Args, CmdArgs, D);
3873 (void)Args.hasArg(options::OPT_force__cpusubtype__ALL);
3921 Args.AddLastArg(CmdArgs, options::OPT_flto, options::OPT_flto_EQ);
3924 if (const Arg *A = Args.getLastArg(options::OPT_fthinlto_index_EQ)) {
3926 D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args)
3928 Args.AddLastArg(CmdArgs, options::OPT_fthinlto_index_EQ);
3935 Args.AddLastArg(CmdArgs, options::OPT_fembed_bitcode_EQ);
3958 CmdArgs.push_back(getBaseInputName(Args, Input));
3962 if (Args.hasArg(options::OPT_static))
3975 if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) {
4023 if (Arg *A = Args.getLastArg(options::OPT__analyzer_output))
4034 Args.AddAllArgValues(CmdArgs, options::OPT_Xanalyzer);
4037 CheckCodeGenerationOptions(D, Args);
4043 ParsePICArgs(getToolChain(), Triple, Args);
4057 if (Arg *A = Args.getLastArg(options::OPT_meabi)) {
4063 if (Arg *A = Args.getLastArg(options::OPT_mthread_model))
4066 CmdArgs.push_back(Args.MakeArgString(getToolChain().getThreadModel()));
4068 Args.AddLastArg(CmdArgs, options::OPT_fveclib);
4070 if (!Args.hasFlag(options::OPT_fmerge_all_constants,
4076 if (Args.hasArg(options::OPT_frewrite_map_file) ||
4077 Args.hasArg(options::OPT_frewrite_map_file_EQ)) {
4078 for (const Arg *A : Args.filtered(options::OPT_frewrite_map_file,
4086 if (Arg *A = Args.getLastArg(options::OPT_Wframe_larger_than_EQ)) {
4089 CmdArgs.push_back(Args.MakeArgString("-warn-stack-size=" + v));
4093 if (!Args.hasFlag(options::OPT_fjump_tables, options::OPT_fno_jump_tables,
4097 if (Arg *A = Args.getLastArg(options::OPT_mregparm_EQ)) {
4102 if (Arg *A = Args.getLastArg(options::OPT_fpcc_struct_return,
4115 if (Args.hasFlag(options::OPT_mrtd, options::OPT_mno_rtd, false))
4118 if (shouldUseFramePointer(Args, getToolChain().getTriple()))
4120 if (!Args.hasFlag(options::OPT_fzero_initialized_in_bss,
4124 bool OFastEnabled = isOptimizationLevelFast(Args);
4132 if (!Args.hasFlag(options::OPT_fstrict_aliasing, StrictAliasingAliasOption,
4135 if (!Args.hasFlag(options::OPT_fstruct_path_tbaa,
4138 if (Args.hasFlag(options::OPT_fstrict_enums, options::OPT_fno_strict_enums,
4141 if (Args.hasFlag(options::OPT_fstrict_vtable_pointers,
4145 if (!Args.hasFlag(options::OPT_foptimize_sibling_calls,
4150 if (Args.hasArg(options::OPT_fsplit_stack))
4163 if (Arg *A = Args.getLastArg(
4172 if (Arg *A = Args.getLastArg(
4185 Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
4206 if (Arg *A = Args.getLastArg(
4216 if (Arg *A = Args.getLastArg(
4226 if (Arg *A = Args.getLastArg(
4236 if (Arg *A = Args.getLastArg(
4256 if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
4262 CmdArgs.push_back(Args.MakeArgString("-ffp-contract=" + Val));
4270 CmdArgs.push_back(Args.MakeArgString("-ffp-contract=fast"));
4274 ParseMRecip(getToolChain().getDriver(), Args, CmdArgs);
4281 if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption,
4285 if (Arg *A = Args.getLastArg(options::OPT_ffinite_math_only,
4294 if (Args.hasFlag(options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
4296 Args.hasArg(options::OPT_dA))
4299 if (!Args.hasFlag(options::OPT_fintegrated_as, options::OPT_fno_integrated_as,
4303 if (Args.hasArg(options::OPT_fdebug_pass_structure)) {
4307 if (Args.hasArg(options::OPT_fdebug_pass_arguments)) {
4324 if (Args.hasFlag(options::OPT_mms_bitfields, options::OPT_mno_ms_bitfields,
4333 Args.hasFlag(options::OPT_fasynchronous_unwind_tables,
4338 if (Args.hasFlag(options::OPT_funwind_tables, options::OPT_fno_unwind_tables,
4342 getToolChain().addClangTargetOptions(Args, CmdArgs);
4344 if (Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
4350 (void)Args.hasArg(options::OPT_mtune_EQ);
4352 if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
4358 std::string CPU = getCPUName(Args, Triple, /*FromAs*/ false);
4361 CmdArgs.push_back(Args.MakeArgString(CPU));
4364 if (const Arg *A = Args.getLastArg(options::OPT_mfpmath_EQ)) {
4370 getTargetFeatures(getToolChain(), Triple, Args, CmdArgs, false);
4382 AddARMTargetArgs(Triple, Args, CmdArgs, KernelOrKext);
4387 AddAArch64TargetArgs(Args, CmdArgs);
4394 AddMIPSTargetArgs(Args, CmdArgs);
4400 AddPPCTargetArgs(Args, CmdArgs);
4406 AddSparcTargetArgs(Args, CmdArgs);
4410 AddSystemZTargetArgs(Args, CmdArgs);
4415 AddX86TargetArgs(Args
4419 AddLanaiTargetArgs(Args, CmdArgs);
4423 AddHexagonTargetArgs(Args, CmdArgs);
4428 AddWebAssemblyTargetArgs(Args, CmdArgs);
4450 AddClangCLArgs(Args, InputType, CmdArgs, &DebugInfoKind, &EmitCodeView);
4453 if (Arg *A = Args.getLastArg(options::OPT_mlinker_version_EQ)) {
4458 if (!shouldUseLeafFramePointer(Args, getToolChain().getTriple()))
4463 if (!Args.hasArg(options::OPT_fallow_unsupported)) {
4467 if ((Unsupported = Args.getLastArg(options::OPT_fapple_kext)) ||
4468 (Unsupported = Args.getLastArg(options::OPT_mkernel)))
4474 Args.AddAllArgs(CmdArgs, options::OPT_v);
4475 Args.AddLastArg(CmdArgs, options::OPT_H);
4481 Args.AddLastArg(CmdArgs, options::OPT_P);
4482 Args.AddLastArg(CmdArgs, options::OPT_print_ivar_layout);
4490 Args.ClaimAllArgs(options::OPT_g_Group);
4491 Arg *SplitDwarfArg = Args.getLastArg(options::OPT_gsplit_dwarf);
4492 if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
4508 if (Arg *A = Args.getLastArg(options::OPT_gTune_Group,
4519 if (Arg *A = Args.getLastArg(options::OPT_gdwarf_2, options::OPT_gdwarf_3,
4525 if (Args.hasArg(options::OPT_gcodeview) || EmitCodeView) {
4534 Args.ClaimAllArgs(options::OPT_g_flags_Group);
4537 if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
4542 if (Args.hasArg(options::OPT_gmodules)) {
4562 bool NeedFullDebug = Args.hasFlag(options::OPT_fstandalone_debug,
4567 RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DwarfVersion,
4571 if (Args.hasArg(options::OPT_ggnu_pubnames)) {
4579 if (Args.hasArg(options::OPT_gdwarf_aranges) || IsPS4CPU) {
4584 if (Args.hasFlag(options::OPT_fdebug_types_section,
4596 if (Args.hasFlag(options::OPT_ffunction_sections,
4601 if (Args.hasFlag(options::OPT_fdata_sections, options::OPT_fno_data_sections,
4606 if (!Args.hasFlag(options::OPT_funique_section_names,
4610 Args.AddAllArgs(CmdArgs, options::OPT_finstrument_functions);
4612 if (Args.hasFlag(options::OPT_fxray_instrument,
4615 if (Arg *A = Args.getLastArg(options::OPT_fxray_instruction_threshold_,
4622 if (Args.hasFlag(options::OPT_fxray_instrument,
4626 Args.getLastArg(options::OPT_fxray_instruction_threshold_,
4633 addPGOAndCoverageFlags(C, D, Output, Args, CmdArgs);
4637 addPS4ProfileRTArgs(getToolChain(), Args, CmdArgs);
4640 if (Args.hasArg(options::OPT_nostdinc)) {
4644 if (Args.hasArg(options::OPT_nostdlibinc))
4646 Args.AddLastArg(CmdArgs, options::OPT_nostdincxx);
4647 Args.AddLastArg(CmdArgs, options::OPT_nobuiltininc);
4654 Args.AddLastArg(CmdArgs, options::OPT_working_directory);
4657 if (!Args.hasArg(options::OPT_fno_objc_arc, options::OPT_fobjc_arc)) {
4658 if (const Arg *A = Args.getLastArg(options::OPT_ccc_arcmt_check,
4676 Args.AddLastArg(CmdArgs, options::OPT_arcmt_migrate_report_output);
4677 Args.AddLastArg(CmdArgs, options::OPT_arcmt_migrate_emit_arc_errors);
4682 Args.ClaimAllArgs(options::OPT_ccc_arcmt_check);
4683 Args.ClaimAllArgs(options::OPT_ccc_arcmt_modify);
4684 Args.ClaimAllArgs(options::OPT_ccc_arcmt_migrate);
4687 if (const Arg *A = Args.getLastArg(options::OPT_ccc_objcmt_migrate)) {
4689 D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args)
4695 if (!Args.hasArg(options::OPT_objcmt_migrate_literals,
4703 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_literals);
4704 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_subscripting);
4705 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_property);
4708 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_literals);
4709 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_subscripting);
4710 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_property);
4711 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_all);
4712 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_readonly_property);
4713 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_readwrite_property);
4714 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_property_dot_syntax);
4715 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_annotation);
4716 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_instancetype);
4717 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_nsmacros);
4718 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_protocol_conformance);
4719 Args.AddLastArg(CmdArgs, options::OPT_objcmt_atomic_property);
4720 Args.AddLastArg(CmdArgs, options::OPT_objcmt_returns_innerpointer_property);
4721 Args.AddLastArg(CmdArgs, options::OPT_objcmt_ns_nonatomic_iosonly);
4722 Args.AddLastArg(CmdArgs, options::OPT_objcmt_migrate_designated_init);
4723 Args.AddLastArg(CmdArgs, options::OPT_objcmt_whitelist_dir_path);
4731 AddPreprocessingOptions(C, JA, D, Args, CmdArgs, Output, Inputs,
4738 Args.ClaimAllArgs(options::OPT_D);
4741 if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
4746 A->render(Args, CmdArgs);
4752 Args.filtered(options::OPT_clang_ignored_gcc_optimization_f_Group)) {
4753 D.Diag(diag::warn_ignored_gcc_optimization) << A->getAsString(Args);
4757 claimNoWarnArgs(Args);
4759 Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
4760 Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
4761 if (Args.hasFlag(options::OPT_pedantic, options::OPT_no_pedantic, false))
4763 Args.AddLastArg(CmdArgs, options::OPT_pedantic_errors);
4764 Args.AddLastArg(CmdArgs, options::OPT_w);
4772 if (Arg *Std = Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi)) {
4779 Std->render(Args, CmdArgs);
4782 if (Arg *A = Args.getLastArg(options::OPT_std_EQ, options::OPT_ansi,
4786 A->render(Args, CmdArgs);
4795 Args.AddAllArgsTranslated(CmdArgs, options::OPT_std_default_EQ, "-std=",
4800 Args.AddLastArg(CmdArgs, options::OPT_ftrigraphs,
4817 Args.getLastArg(options::OPT_Wwrite_strings,
4828 Args.hasFlag(options::OPT_Wdeprecated, options::OPT_Wno_deprecated,
4834 if (Arg *Asm = Args.getLastArg(options::OPT_fasm, options::OPT_fno_asm)) {
4841 if (ShouldDisableDwarfDirectory(Args, getToolChain()))
4844 if (ShouldDisableAutolink(Args, getToolChain()))
4848 addDebugCompDirArg(Args, CmdArgs);
4850 for (const Arg *A : Args.filtered(options::OPT_fdebug_prefix_map_EQ)) {
4855 CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map));
4859 if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_,
4865 if (Arg *A = Args.getLastArg(options::OPT_foperator_arrow_depth_EQ)) {
4870 if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_depth_EQ)) {
4875 if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_steps_EQ)) {
4880 if (Arg *A = Args.getLastArg(options::OPT_fbracket_depth_EQ)) {
4885 if (Arg *A = Args.getLastArg(options::OPT_Wlarge_by_value_copy_EQ,
4889 CmdArgs.push_back(Args.MakeArgString("-Wlarge-by-value-copy=" + bytes));
4894 if (Args.hasArg(options::OPT_relocatable_pch))
4897 if (Arg *A = Args.getLastArg(options::OPT_fconstant_string_class_EQ)) {
4902 if (Arg *A = Args.getLastArg(options::OPT_ftabstop_EQ)) {
4908 if (Arg *A = Args.getLastArg(options::OPT_ferror_limit_EQ))
4913 if (Arg *A = Args.getLastArg(options::OPT_fmacro_backtrace_limit_EQ)) {
4918 if (Arg *A = Args.getLastArg(options::OPT_ftemplate_backtrace_limit_EQ)) {
4923 if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_backtrace_limit_EQ)) {
4928 if (Arg *A = Args.getLastArg(options::OPT_fspell_checking_limit_EQ)) {
4935 if (Arg *A = Args.getLastArg(options::OPT_fmessage_length_EQ)) {
4941 CmdArgs.push_back(Args.MakeArgString(Twine(N)));
4945 if (const Arg *A = Args.getLastArg(options::OPT_fvisibility_EQ,
4959 Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden);
4961 Args.AddLastArg(CmdArgs, options::OPT_ftlsmodel_EQ);
4964 if (Args.hasFlag(options::OPT_ffreestanding, options::OPT_fhosted, false) ||
4969 Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls);
4970 Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions);
4971 Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
4975 if (Args.hasFlag(options::OPT_femulated_tls, options::OPT_fno_emulated_tls,
4980 Args.AddLastArg(CmdArgs, options::OPT_faltivec);
4981 Args.AddLastArg(CmdArgs, options::OPT_fzvector);
4983 Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_show_template_tree);
4984 Args.AddLastArg(CmdArgs, options::OPT_fno_elide_type);
4987 if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
4989 switch (getOpenMPRuntime(getToolChain(), Args)) {
4998 if (!Args.hasFlag(options::OPT_fopenmp_use_tls,
5001 Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
5015 Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType);
5018 if (const Arg *A = Args.getLastArg(options::OPT_faltivec)) {
5022 D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args)
5027 if (Arg *A = Args.getLastArg(options::OPT_fzvector))
5028 if (Args.hasArg(options::OPT_faltivec))
5029 D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args)
5033 Args.AddLastArg(CmdArgs, options::OPT_pg);
5036 if (!Args.hasFlag(options::OPT_flax_vector_conversions,
5040 if (Args.getLastArg(options::OPT_fapple_kext) ||
5041 (Args.hasArg(options::OPT_mkernel) && types::isCXX(InputType)))
5044 Args.AddLastArg(CmdArgs, options::OPT_fobjc_sender_dependent_dispatch);
5045 Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_print_source_range_info);
5046 Args.AddLastArg(CmdArgs, options::OPT_fdiagnostics_parseable_fixits);
5047 Args.AddLastArg(CmdArgs, options::OPT_ftime_report);
5048 Args.AddLastArg(CmdArgs, options::OPT_ftrapv);
5050 if (Arg *A = Args.getLastArg(options::OPT_ftrapv_handler_EQ)) {
5055 Args.AddLastArg(CmdArgs, options::OPT_ftrap_function_EQ);
5059 if (Arg *A = Args.getLastArg(options::OPT_fwrapv, options::OPT_fno_wrapv)) {
5062 } else if (Arg *A = Args.getLastArg(options::OPT_fstrict_overflow,
5068 if (Arg *A = Args.getLastArg(options::OPT_freroll_loops,
5073 Args.AddLastArg(CmdArgs, options::OPT_fwritable_strings);
5074 Args.AddLastArg(CmdArgs, options::OPT_funroll_loops,
5077 Args.AddLastArg(CmdArgs, options::OPT_pthread);
5081 if (Arg *A = Args.getLastArg(options::OPT_fno_stack_protector,
5099 CmdArgs.push_back(Args.MakeArgString(Twine(StackProtectorLevel)));
5103 for (const Arg *A : Args.filtered(options::OPT__param)) {
5109 CmdArgs.push_back(Args.MakeArgString(Str.drop_front(16)));
5116 if (Args.hasFlag(options::OPT_mstackrealign, options::OPT_mno_stackrealign,
5118 CmdArgs.push_back(Args.MakeArgString("-mstackrealign"));
5120 if (Args.hasArg(options::OPT_mstack_alignment)) {
5121 StringRef alignment = Args.getLastArgValue(options::OPT_mstack_alignment);
5122 CmdArgs.push_back(Args.MakeArgString("-mstack-alignment=" + alignment));
5125 if (Args.hasArg(options::OPT_mstack_probe_size)) {
5126 StringRef Size = Args.getLastArgValue(options::OPT_mstack_probe_size);
5129 CmdArgs.push_back(Args.MakeArgString("-mstack-probe-size=" + Size));
5148 if (Arg *A = Args.getLastArg(options::OPT_mrestrict_it,
5166 if (Args.getLastArg(options::OPT_cl_opt_disable)) {
5169 if (Args.getLastArg(options::OPT_cl_strict_aliasing)) {
5172 if (Args.getLastArg(options::OPT_cl_single_precision_constant)) {
5175 if (Args.getLastArg(options::OPT_cl_finite_math_only)) {
5178 if (Args.getLastArg(options::OPT_cl_kernel_arg_info)) {
5181 if (Args.getLastArg(options::OPT_cl_unsafe_math_optimizations)) {
5184 if (Args.getLastArg(options::OPT_cl_fast_relaxed_math)) {
5187 if (Args.getLastArg(options::OPT_cl_mad_enable)) {
5190 if (Args.getLastArg(options::OPT_cl_no_signed_zeros)) {
5193 if (Arg *A = Args.getLastArg(options::OPT_cl_std_EQ)) {
5196 CmdArgs.push_back(Args.MakeArgString(CLStdStr));
5198 if (Args.getLastArg(options::OPT_cl_denorms_are_zero)) {
5204 if (Arg *A = Args.getLastArg(options::OPT_fprofile_sample_use_EQ)) {
5209 A->render(Args, CmdArgs);
5214 Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin,
5215 !Args.hasArg(options::OPT_mkernel));
5220 if (Args.hasArg(options::OPT_ffreestanding))
5224 for (const auto &Arg : Args) {
5236 CmdArgs.push_back(Args.MakeArgString("-fno-builtin-" + FuncName));
5239 if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,
5244 if (Args.hasFlag(options::OPT_fblocks, options::OPT_fno_blocks,
5246 (Args.hasArg(options::OPT_fgnu_runtime) &&
5247 Args.hasArg(options::OPT_fobjc_nonfragile_abi) &&
5248 !Args.hasArg(options::OPT_fno_blocks))) {
5251 if (!Args.hasArg(options::OPT_fgnu_runtime) &&
5260 if (Args.hasFlag(options::OPT_fmodules, options::OPT_fno_modules, false)) {
5261 bool AllowedInCXX = Args.hasFlag(options::OPT_fcxx_modules,
5271 if (Args.hasFlag(options::OPT_fimplicit_module_maps,
5278 if (Args.hasFlag(options::OPT_fmodules_decluse,
5285 if (Args.hasFlag(options::OPT_fmodules_strict_decluse,
5291 if (!Args.hasFlag(options::OPT_fimplicit_modules,
5298 if (Arg *A = Args.getLastArg(options::OPT_fmodules_cache_path))
5315 CmdArgs.push_back(Args.MakeArgString(Path));
5320 Args.AddLastArg(CmdArgs, options::OPT_fmodule_name_EQ);
5324 Args.AddAllArgs(CmdArgs, options::OPT_fmodule_map_file);
5328 Args.AddAllArgs(CmdArgs, options::OPT_fmodule_file);
5330 Args.ClaimAllArgs(options::OPT_fmodule_file);
5338 C.addTempFile(Args.MakeArgString(VFSDir));
5342 CmdArgs.push_back(Args.MakeArgString(VFSDir));
5346 Args.AddLastArg(CmdArgs, options::OPT_fmodules_user_build_path);
5349 Args.AddAllArgs(CmdArgs, options::OPT_fmodules_ignore_macro);
5350 Args.AddLastArg(CmdArgs, options::OPT_fmodules_prune_interval);
5351 Args.AddLastArg(CmdArgs, options::OPT_fmodules_prune_after);
5353 Args.AddLastArg(CmdArgs, options::OPT_fbuild_session_timestamp);
5355 if (Arg *A = Args.getLastArg(options::OPT_fbuild_session_file)) {
5356 if (Args.hasArg(options::OPT_fbuild_session_timestamp))
5358 << A->getAsString(Args) << "-fbuild-session-timestamp";
5363 CmdArgs.push_back(Args.MakeArgString(
5368 if (Args.getLastArg(options::OPT_fmodules_validate_once_per_build_session)) {
5369 if (!Args.getLastArg(options::OPT_fbuild_session_timestamp,
5373 Args.AddLastArg(CmdArgs,
5377 Args.AddLastArg(CmdArgs, options::OPT_fmodules_validate_system_headers);
5380 if (Args.hasFlag(options::OPT_fno_access_control,
5385 if (Args.hasFlag(options::OPT_fno_elide_constructors,
5397 if (Args.hasFlag(options::OPT_fshort_enums, options::OPT_fno_short_enums,
5402 if (Arg *A = Args.getLastArg(
5414 if (!Args.hasFlag(
5427 if (Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions,
5432 if (Args.hasFlag(options::OPT_fuse_line_directives,
5437 if (Args.hasFlag(options::OPT_fms_compatibility,
5440 Args.hasFlag(options::OPT_fms_extensions,
5446 &D, getToolChain(), getToolChain().getTriple(), Args, IsWindowsMSVC);
5449 Args.MakeArgString("-fms-compatibility-version=" + MSVT.getAsString()));
5454 if (const Arg *StdArg = Args.getLastArg(options::OPT__SLASH_std)) {
5461 << StdArg->getAsString(Args);
5475 if (Args.hasFlag(options::OPT_fborland_extensions,
5480 if (Args.hasFlag(options::OPT_fdeclspec, options::OPT_fno_declspec,
5483 else if (Args.hasArg(options::OPT_fno_declspec))
5488 if (!Args.hasFlag(options::OPT_fthreadsafe_statics,
5495 if (Args.hasFlag(options::OPT_fdelayed_template_parsing,
5501 if (Arg *A = Args.getLastArg(options::OPT_fgnu_keywords,
5503 A->render(Args, CmdArgs);
5505 if (Args.hasFlag(options::OPT_fgnu89_inline, options::OPT_fno_gnu89_inline,
5509 if (Args.hasArg(options::OPT_fno_inline))
5512 if (Arg* InlineArg = Args.getLastArg(options::OPT_finline_functions,
5515 InlineArg->render(Args, CmdArgs);
5517 ObjCRuntime objcRuntime = AddObjCRuntimeArgs(Args, CmdArgs, rewriteKind);
5524 if (!Args.hasFlag(options::OPT_fobjc_legacy_dispatch,
5552 bool ARC = isObjCAutoRefCount(Args);
5562 if (getToolChain().GetCXXStdlibType(Args) == ToolChain::CST_Libcxx)
5570 if (Args.hasFlag(options::OPT_fobjc_arc_exceptions,
5584 const Arg *GCArg = Args.getLastArg(options::OPT_fobjc_gc_only);
5586 GCArg = Args.getLastArg(options::OPT_fobjc_gc);
5589 D.Diag(diag::err_drv_objc_gc_arr) << GCArg->getAsString(Args);
5591 GCArg->render(Args, CmdArgs);
5594 D.Diag(diag::warn_drv_objc_gc_unsupported) << GCArg->getAsString(Args);
5600 auto WeakArg = Args.getLastArg(options::OPT_fobjc_weak,
5611 WeakArg->render(Args, CmdArgs);
5615 if (Args.hasFlag(options::OPT_fapplication_extension,
5619 // Handle GCC-style exception args.
5621 addExceptionArgs(Args, InputType, getToolChain(), KernelOrKext, objcRuntime,
5624 if (Args.hasArg(options::OPT_fsjlj_exceptions) ||
5625 getToolChain().UseSjLjExceptions(Args))
5629 if (!Args.hasFlag(options::OPT_fassume_sane_operator_new,
5635 if (Args.hasFlag(options::OPT_fsized_deallocation,
5641 if (!Args.hasFlag(options::OPT_fconstant_cfstrings,
5643 !Args.hasFlag(options::OPT_mconstant_cfstrings,
5649 if (Arg *A = Args.getLastArg(options::OPT_fshort_wchar,
5651 A->render(Args, CmdArgs);
5654 if (Args.hasFlag(options::OPT_fpascal_strings,
5660 if (Arg *A = Args.getLastArg(options::OPT_fpack_struct_EQ)) {
5663 CmdArgs.push_back(Args.MakeArgString(PackStructStr));
5664 } else if (Args.hasFlag(options::OPT_fpack_struct,
5670 bool SkipMaxTypeAlign = Args.hasArg(options::OPT_fno_max_type_align);
5671 if (Arg *A = Args.getLastArg(options::OPT_fmax_type_align_EQ)) {
5675 CmdArgs.push_back(Args.MakeArgString(MaxTypeAlignStr));
5680 CmdArgs.push_back(Args.MakeArgString(MaxTypeAlignStr));
5687 if (!Args.hasFlag(options::OPT_fcommon, options::OPT_fno_common,
5693 if (!Args.hasFlag(options::OPT_fsigned_bitfields,
5696 << Args.getLastArg(options::OPT_funsigned_bitfields)->getAsString(Args);
5699 if (!Args.hasFlag(options::OPT_ffor_scope, options::OPT_fno_for_scope))
5701 << Args.getLastArg(options::OPT_fno_for_scope)->getAsString(Args);
5704 if (Arg *inputCharset = Args.getLastArg(options::OPT_finput_charset_EQ)) {
5707 D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args)
5712 if (Arg *execCharset = Args.getLastArg(options::OPT_fexec_charset_EQ)) {
5715 D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args)
5720 if (!Args.hasFlag(options::OPT_fcaret_diagnostics,
5725 if (!Args.hasFlag(options::OPT_fdiagnostics_fixit_info,
5730 if (Args.hasFlag(options::OPT_fdiagnostics_show_option,
5735 Args.getLastArg(options::OPT_fdiagnostics_show_category_EQ)) {
5740 if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_format_EQ)) {
5745 if (Arg *A = Args.getLastArg(
5759 for (Arg *A : Args) {
5778 if (Args.hasArg(options::OPT_fansi_escape_codes))
5781 if (!Args.hasFlag(options::OPT_fshow_source_location,
5785 if (!Args.hasFlag(options::OPT_fshow_column, options::OPT_fno_show_column,
5789 if (!Args.hasFlag(options::OPT_fspell_checking,
5794 if (Args.hasFlag(options::OPT_fasm_blocks, options::OPT_fno_asm_blocks,
5799 if (!Args.hasFlag(options::OPT_fgnu_inline_asm,
5806 bool EnableVec = shouldEnableVectorizerAtOLevel(Args, false);
5809 if (Args.hasFlag(options::OPT_fvectorize, VectorizeAliasOption,
5814 bool EnableSLPVec = shouldEnableVectorizerAtOLevel(Args, true);
5817 if (Args.hasFlag(options::OPT_fslp_vectorize, SLPVectAliasOption,
5822 if (Args.hasFlag(options::OPT_fslp_vectorize_aggressive,
5826 if (Arg *A = Args.getLastArg(options::OPT_fshow_overloads_EQ))
5827 A->render(Args, CmdArgs);
5829 if (Arg *A = Args.getLastArg(
5831 A->render(Args, CmdArgs);
5835 if (Arg *A = Args.getLastArg(options::OPT_fdollars_in_identifiers,
5845 if (Arg *A = Args.getLastArg(options::OPT_funit_at_a_time,
5848 D.Diag(diag::warn_drv_clang_unsupported) << A->getAsString(Args);
5851 if (Args.hasFlag(options::OPT_fapple_pragma_pack,
5869 if (!Args.hasArg(options::OPT_fbuiltin_strcat))
5871 if (!Args.hasArg(options::OPT_fbuiltin_strcpy))
5880 if (Args.hasFlag(options::OPT_frewrite_includes,
5886 if (Arg *A = Args.getLastArg(options::OPT_traditional,
5891 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
5894 Args.AddLastArg(CmdArgs, options::OPT_dM);
5895 Args.AddLastArg(CmdArgs, options::OPT_dD);
5898 if (Arg *A = Args.getLastArg(options::OPT__serialize_diags)) {
5900 CmdArgs.push_back(Args.MakeArgString(A->getValue()));
5903 if (Args.hasArg(options::OPT_fretain_comments_from_system_headers))
5907 Args.AddAllArgs(CmdArgs, options::OPT_fcomment_block_commands);
5909 Args.AddAllArgs(CmdArgs, options::OPT_fparse_all_comments);
5912 for (const Arg *A : Args.filtered(options::OPT_fplugin_EQ)) {
5920 Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
5921 for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
5929 A->render(Args, CmdArgs);
5953 addDashXForInput(Args, Input, CmdArgs);
5958 Input.getInputArg().renderAsInput(Args, CmdArgs);
5960 Args.AddAllArgs(CmdArgs, options::OPT_undef);
5968 for (const auto &Arg : Args)
5969 Arg->render(Args, OriginalArgs);
5980 CmdArgs.push_back(Args.MakeArgString(Flags));
5991 SplitDwarfOut = SplitDebugName(Args, Input);
6004 Args.hasFlag(options::OPT_fwhole_program_vtables,
6015 if (Args.hasArg(options::OPT__SLASH_fallback) &&
6019 getCLFallback()->GetCommand(C, JA, Output, Inputs, Args, LinkingOutput);
6022 } else if (Args.hasArg(options::OPT__SLASH_fallback) &&
6036 SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output, SplitDwarfOut);
6038 if (Arg *A = Args.getLastArg(options::OPT_pg))
6039 if (Args.hasArg(options::OPT_fomit_frame_pointer))
6041 << A->getAsString(Args);
6048 Args.ClaimAllArgs(options::OPT_fpch_preprocess);
6052 Args.ClaimAllArgs(options::OPT_clang_ignored_f_Group);
6053 Args.ClaimAllArgs(options::OPT_clang_ignored_m_Group);
6056 Args.ClaimAllArgs(options::OPT_emit_llvm);
6062 ObjCRuntime Clang::AddObjCRuntimeArgs(const ArgList &args,
6067 args.getLastArg(options::OPT_fnext_runtime, options::OPT_fgnu_runtime,
6081 runtimeArg->render(args, cmdArgs);
6092 if (Arg *abiArg = args.getLastArg(options::OPT_fobjc_abi_version_EQ)) {
6108 if (args.hasFlag(options::OPT_fobjc_nonfragile_abi,
6119 args.getLastArg(options::OPT_fobjc_nonfragile_abi_version_EQ)) {
6179 args.MakeArgString("-fobjc-runtime=" + runtime.getAsString()));
6204 static EHFlags parseClangCLEHFlags(const Driver &D, const ArgList &Args) {
6208 Args.getAllArgValues(options::OPT__SLASH_EH);
6235 Args.hasFlag(options::OPT__SLASH_GX, options::OPT__SLASH_GX_,
6244 void Clang::AddClangCLArgs(const ArgList &Args, types::ID InputType,
6250 if (Args.hasArg(options::OPT__SLASH_LDd))
6255 if (Arg *A = Args.getLastArg(options::OPT__SLASH_M_Group))
6261 if (Args.hasArg(options::OPT__SLASH_LDd))
6274 if (Args.hasArg(options::OPT__SLASH_LDd))
6290 if (Args.hasArg(options::OPT__SLASH_Zl)) {
6303 if (!Args.hasArg(options::OPT_E) && !Args.hasArg(options::OPT__SLASH_EP))
6304 if (Arg *A = Args.getLastArg(options::OPT_show_includes))
6305 A->render(Args, CmdArgs);
6308 if (Args.hasFlag(options::OPT__SLASH_GR_, options::OPT__SLASH_GR,
6314 if (Args.hasFlag(options::OPT__SLASH_GS, options::OPT__SLASH_GS_,
6317 CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong)));
6322 Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd)) {
6334 EHFlags EH = parseClangCLEHFlags(D, Args);
6344 if (Args.hasArg(options::OPT__SLASH_EP)) {
6356 if (Arg *A = Args.getLastArg(options::OPT__SLASH_volatile_Group))
6362 Arg *MostGeneralArg = Args.getLastArg(options::OPT__SLASH_vmg);
6363 Arg *BestCaseArg = Args.getLastArg(options::OPT__SLASH_vmb);
6366 << MostGeneralArg->getAsString(Args) << BestCaseArg->getAsString(Args);
6369 Arg *SingleArg = Args.getLastArg(options::OPT__SLASH_vms);
6370 Arg *MultipleArg = Args.getLastArg(options::OPT__SLASH_vmm);
6371 Arg *VirtualArg = Args.getLastArg(options::OPT__SLASH_vmv);
6377 << FirstConflict->getAsString(Args)
6378 << SecondConflict->getAsString(Args);
6388 if (Args.getLastArg(options::OPT__SLASH_Gd))
6390 else if (Args.getLastArg(options::OPT__SLASH_Gr))
6392 else if (Args.getLastArg(options::OPT__SLASH_Gz))
6394 else if (Args.getLastArg(options::OPT__SLASH_Gv))
6397 if (Arg *A = Args.getLastArg(options::OPT_vtordisp_mode_EQ))
6398 A->render(Args, CmdArgs);
6400 if (!Args.hasArg(options::OPT_fdiagnostics_format_EQ)) {
6402 if (Args.hasArg(options::OPT__SLASH_fallback))
6415 void ClangAs::AddMIPSTargetArgs(const ArgList &Args,
6420 mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName);
6428 const ArgList &Args,
6436 getToolChain().ComputeEffectiveClangTriple(Args, Input.getType());
6440 Args.ClaimAllArgs(options::OPT_w);
6442 Args.ClaimAllArgs(options::OPT_emit_llvm);
6444 claimNoWarnArgs(Args);
6453 CmdArgs.push_back(Args.MakeArgString(TripleStr));
6463 CmdArgs.push_back(Clang::getBaseInputName(Args, Input));
6466 std::string CPU = getCPUName(Args, Triple, /*FromAs*/ true);
6469 CmdArgs.push_back(Args.MakeArgString(CPU));
6473 getTargetFeatures(getToolChain(), Triple, Args, CmdArgs, true);
6476 (void)Args.hasArg(options::OPT_force__cpusubtype__ALL);
6479 Args.AddAllArgs(CmdArgs, options::OPT_I_Group);
6492 Args.ClaimAllArgs(options::OPT_g_Group);
6493 if (Arg *A = Args.getLastArg(options::OPT_g_Group)) {
6513 addDebugCompDirArg(Args, CmdArgs);
6518 CmdArgs.push_back(Args.MakeArgString(getClangFullVersion()));
6521 Args.AddAllArgs(CmdArgs, options::OPT_I);
6523 RenderDebugEnablingArgs(Args, CmdArgs, DebugInfoKind, DwarfVersion,
6532 ParsePICArgs(getToolChain(), Triple, Args);
6544 for (const auto &Arg : Args)
6545 Arg->render(Args, OriginalArgs);
6557 CmdArgs.push_back(Args.MakeArgString(Flags));
6571 AddMIPSTargetArgs(Args, CmdArgs);
6580 Args.ClaimAllArgs(options::OPT_W_Group);
6582 CollectArgsForIntegratedAssembler(C, Args, CmdArgs,
6585 Args.AddAllArgs(CmdArgs, options::OPT_mllvm);
6600 if (Args.hasArg(options::OPT_gsplit_dwarf) &&
6602 SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
6603 SplitDebugName(Args, Input));
6610 const InputInfoList &Inputs, const ArgList &Args,
6615 for (const auto &A : Args) {
6633 A->render(Args, CmdArgs);
6643 Args.MakeArgString(getToolChain().getDefaultUniversalArchName()));
6676 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
6714 A.render(Args, CmdArgs);
6727 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath(GCCName));
6777 const ArgList &Args,
6779 claimNoWarnArgs(Args);
6786 CmdArgs.push_back(Args.MakeArgString(MArchString));
6792 toolchains::HexagonToolChain::GetTargetCPUVersion(Args).str();
6794 CmdArgs.push_back(Args.MakeArgString(MCpuString));
6804 if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
6806 CmdArgs.push_back(Args.MakeArgString(std::string("-gpsize=") + N));
6809 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
6836 II.getInputArg().render(Args, CmdArgs);
6839 auto *Exec = Args.MakeArgString(HTC.GetProgramPath(AsName.c_str()));
6851 const ArgList &Args, ArgStringList &CmdArgs,
6859 bool IsStatic = Args.hasArg(options::OPT_static);
6860 bool IsShared = Args.hasArg(options::OPT_shared);
6861 bool IsPIE = Args.hasArg(options::OPT_pie);
6862 bool IncStdLib = !Args.hasArg(options::OPT_nostdlib);
6863 bool IncStartFiles = !Args.hasArg(options::OPT_nostartfiles);
6864 bool IncDefLibs = !Args.hasArg(options::OPT_nodefaultlibs);
6871 Args.ClaimAllArgs(options::OPT_g_Group);
6872 Args.ClaimAllArgs(options::OPT_emit_llvm);
6873 Args.ClaimAllArgs(options::OPT_w); // Other warning options are already
6875 Args.ClaimAllArgs(options::OPT_static_libgcc);
6880 if (Args.hasArg(options::OPT_s))
6883 if (Args.hasArg(options::OPT_r))
6891 toolchains::HexagonToolChain::GetTargetCPUVersion(Args).str();
6893 CmdArgs.push_back(Args.MakeArgString(MCpuString));
6907 if (auto G = toolchains::HexagonToolChain::getSmallDataThreshold(Args)) {
6909 CmdArgs.push_back(Args.MakeArgString(std::string("-G") + N));
6925 for (const Arg *A : Args.filtered(options::OPT_moslib_EQ)) {
6958 CmdArgs.push_back(Args.MakeArgString(Crt0SA));
6961 CmdArgs.push_back(Args.MakeArgString(Crt0));
6966 CmdArgs.push_back(Args.MakeArgString(Init));
6974 CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
6979 Args.AddAllArgs(CmdArgs,
6983 AddLinkerInputs(HTC, Inputs, Args, CmdArgs);
6990 HTC.AddCXXStdlibLibArgs(Args, CmdArgs);
6998 CmdArgs.push_back(Args.MakeArgString("-l" + Lib));
7013 CmdArgs.push_back(Args.MakeArgString(Fini));
7020 const ArgList &Args,
7025 constructHexagonLinkArgs(C, JA, HTC, Output, Inputs, Args, CmdArgs,
7029 C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker),
7037 const ArgList &Args,
7042 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
7046 C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Linker),
7065 const ArgList &Args,
7070 const char *Linker = Args.MakeArgString(ToolChain.GetLinkerPath());
7079 if (areOptimizationsEnabled(Args))
7082 if (Args.hasArg(options::OPT_rdynamic))
7084 if (Args.hasArg(options::OPT_s))
7086 if (Args.hasArg(options::OPT_shared))
7088 if (Args.hasArg(options::OPT_static))
7091 Args.AddAllArgs(CmdArgs, options::OPT_L);
7092 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
7094 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
7095 if (Args.hasArg(options::OPT_shared))
7096 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("rcrt1.o")));
7097 else if (Args.hasArg(options::OPT_pie))
7098 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("Scrt1.o")));
7100 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt1.o")));
7102 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
7105 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
7107 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
7109 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
7111 if (Args.hasArg(options::OPT_pthread))
7118 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles))
7119 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
7208 void arm::appendEBLinkFlags(const ArgList &Args, ArgStringList &CmdArgs,
7210 if (Args.hasArg(options::OPT_r))
7250 bool mips::hasMipsAbiArg(const ArgList &Args, const char *Value) {
7251 Arg *A = Args.getLastArg(options::OPT_mabi_EQ);
7255 bool mips::isUCLibc(const ArgList &Args) {
7256 Arg *A = Args.getLastArg(options::OPT_m_libc_Group);
7260 bool mips::isNaN2008(const ArgList &Args, const llvm::Triple &Triple) {
7261 if (Arg *NaNArg = Args.getLastArg(options::OPT_mnan_EQ))
7268 return llvm::StringSwitch<bool>(getCPUName(Args, Triple))
7307 bool mips::shouldUseFPXX(const ArgList &Args, const llvm::Triple &Triple,
7313 if (Arg *A = Args.getLastArg(options::OPT_msingle_float,
7368 const char *Clang::getBaseInputName(const ArgList &Args,
7370 return Args.MakeArgString(llvm::sys::path::filename(Input.getBaseInput()));
7373 const char *Clang::getBaseInputStem(const ArgList &Args,
7375 const char *Str = getBaseInputName(Args, Inputs[0]);
7378 return Args.MakeArgString(std::string(Str, End));
7383 const char *Clang::getDependencyFileName(const ArgList &Args,
7388 if (Arg *OutputOpt = Args.getLastArg(options::OPT_o)) {
7392 Res = getBaseInputStem(Args, Inputs);
7394 return Args.MakeArgString(Res + ".d");
7400 const ArgList &Args,
7407 Args.ClaimAllArgs(options::OPT_g_Group);
7409 Args.ClaimAllArgs(options::OPT_emit_llvm);
7412 Args.ClaimAllArgs(options::OPT_w);
7415 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
7435 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
7436 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt0.o")));
7437 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtbegin.o")));
7440 Args.AddAllArgs(CmdArgs, options::OPT_L);
7441 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
7442 Args.AddAllArgs(CmdArgs,
7447 AddGoldPlugin(ToolChain, Args, CmdArgs, D.getLTOMode() == LTOK_Thin);
7449 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
7451 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
7453 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
7458 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles))
7459 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
7461 const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
7468 const ArgList &Args,
7487 if (Args.hasArg(options::OPT_fno_integrated_as)) {
7496 if (Args.hasArg(options::OPT_gstabs))
7498 else if (Args.hasArg(options::OPT_g_Group))
7503 AddMachOArch(Args, CmdArgs);
7508 Args.hasArg(options::OPT_force__cpusubtype__ALL))
7512 (((Args.hasArg(options::OPT_mkernel) ||
7513 Args.hasArg(options::OPT_fapple_kext)) &&
7515 Args.hasArg(options::OPT_static)))
7518 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
7529 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
7535 void darwin::MachOTool::AddMachOArch(const ArgList &Args,
7537 StringRef ArchName = getMachOToolChain().getMachOArchName(Args);
7541 CmdArgs.push_back(Args.MakeArgString(ArchName));
7559 void darwin::Linker::AddLinkArgs(Compilation &C, const ArgList &Args,
7566 if (Arg *A = Args.getLastArg(options::OPT_mlinker_version_EQ)) {
7568 D.Diag(diag::err_drv_invalid_version_number) << A->getAsString(Args);
7573 if (Version[0] >= 100 && !Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
7576 if (Args.hasArg(options::OPT_rdynamic) && Version[0] >= 137)
7581 if (Args.hasFlag(options::OPT_fapplication_extension,
7616 Args.AddAllArgs(CmdArgs, options::OPT_static);
7617 if (!Args.hasArg(options::OPT_static))
7619 if (Args.hasArg(options::OPT_fgnu_runtime)) {
7620 // FIXME: gcc replaces -lobjc in forward args with -lobjc-gnu
7624 if (!Args.hasArg(options::OPT_dynamiclib)) {
7625 AddMachOArch(Args, CmdArgs);
7627 Args.AddLastArg(CmdArgs, options::OPT_force__cpusubtype__ALL);
7629 Args.AddLastArg(CmdArgs, options::OPT_bundle);
7630 Args.AddAllArgs(CmdArgs, options::OPT_bundle__loader);
7631 Args.AddAllArgs(CmdArgs, options::OPT_client__name);
7634 if ((A = Args.getLastArg(options::OPT_compatibility__version)) ||
7635 (A = Args.getLastArg(options::OPT_current__version)) ||
7636 (A = Args.getLastArg(options::OPT_install__name)))
7637 D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args)
7640 Args.AddLastArg(CmdArgs, options::OPT_force__flat__namespace);
7641 Args.AddLastArg(CmdArgs, options::OPT_keep__private__externs);
7642 Args.AddLastArg(CmdArgs, options::OPT_private__bundle);
7647 if ((A = Args.getLastArg(options::OPT_bundle)) ||
7648 (A = Args.getLastArg(options::OPT_bundle__loader)) ||
7649 (A = Args.getLastArg(options::OPT_client__name)) ||
7650 (A = Args.getLastArg(options::OPT_force__flat__namespace)) ||
7651 (A = Args.getLastArg(options::OPT_keep__private__externs)) ||
7652 (A = Args.getLastArg(options::OPT_private__bundle)))
7653 D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args)
7656 Args.AddAllArgsTranslated(CmdArgs, options::OPT_compatibility__version,
7658 Args.AddAllArgsTranslated(CmdArgs, options::OPT_current__version,
7661 AddMachOArch(Args, CmdArgs);
7663 Args.AddAllArgsTranslated(CmdArgs, options::OPT_install__name,
7667 Args.AddLastArg(CmdArgs, options::OPT_all__load);
7668 Args.AddAllArgs(CmdArgs, options::OPT_allowable__client);
7669 Args.AddLastArg(CmdArgs, options::OPT_bind__at__load);
7671 Args.AddLastArg(CmdArgs, options::OPT_arch__errors__fatal);
7672 Args.AddLastArg(CmdArgs, options::OPT_dead__strip);
7673 Args.AddLastArg(CmdArgs, options::OPT_no__dead__strip__inits__and__terms);
7674 Args.AddAllArgs(CmdArgs, options::OPT_dylib__file);
7675 Args.AddLastArg(CmdArgs, options::OPT_dynamic);
7676 Args.AddAllArgs(CmdArgs, options::OPT_exported__symbols__list);
7677 Args.AddLastArg(CmdArgs, options::OPT_flat__namespace);
7678 Args.AddAllArgs(CmdArgs, options::OPT_force__load);
7679 Args.AddAllArgs(CmdArgs, options::OPT_headerpad__max__install__names);
7680 Args.AddAllArgs(CmdArgs, options::OPT_image__base);
7681 Args.AddAllArgs(CmdArgs, options::OPT_init);
7684 MachOTC.addMinVersionArgs(Args, CmdArgs);
7686 Args.AddLastArg(CmdArgs, options::OPT_nomultidefs);
7687 Args.AddLastArg(CmdArgs, options::OPT_multi__module);
7688 Args.AddLastArg(CmdArgs, options::OPT_single__module);
7689 Args.AddAllArgs(CmdArgs, options::OPT_multiply__defined);
7690 Args.AddAllArgs(CmdArgs, options::OPT_multiply__defined__unused);
7693 Args.getLastArg(options::OPT_fpie, options::OPT_fPIE,
7711 Args.AddLastArg(CmdArgs, options::OPT_prebind);
7712 Args.AddLastArg(CmdArgs, options::OPT_noprebind);
7713 Args.AddLastArg(CmdArgs, options::OPT_nofixprebinding);
7714 Args.AddLastArg(CmdArgs, options::OPT_prebind__all__twolevel__modules);
7715 Args.AddLastArg(CmdArgs, options::OPT_read__only__relocs);
7716 Args.AddAllArgs(CmdArgs, options::OPT_sectcreate);
7717 Args.AddAllArgs(CmdArgs, options::OPT_sectorder);
7718 Args.AddAllArgs(CmdArgs, options::OPT_seg1addr);
7719 Args.AddAllArgs(CmdArgs, options::OPT_segprot);
7720 Args.AddAllArgs(CmdArgs, options::OPT_segaddr);
7721 Args.AddAllArgs(CmdArgs, options::OPT_segs__read__only__addr);
7722 Args.AddAllArgs(CmdArgs, options::OPT_segs__read__write__addr);
7723 Args.AddAllArgs(CmdArgs, options::OPT_seg__addr__table);
7724 Args.AddAllArgs(CmdArgs, options::OPT_seg__addr__table__filename);
7725 Args.AddAllArgs(CmdArgs, options::OPT_sub__library);
7726 Args.AddAllArgs(CmdArgs, options::OPT_sub__umbrella);
7734 } else if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
7739 Args.AddLastArg(CmdArgs, options::OPT_twolevel__namespace);
7740 Args.AddLastArg(CmdArgs, options::OPT_twolevel__namespace__hints);
7741 Args.AddAllArgs(CmdArgs, options::OPT_umbrella);
7742 Args.AddAllArgs(CmdArgs, options::OPT_undefined);
7743 Args.AddAllArgs(CmdArgs, options::OPT_unexported__symbols__list);
7744 Args.AddAllArgs(CmdArgs, options::OPT_weak__reference__mismatches);
7745 Args.AddLastArg(CmdArgs, options::OPT_X_Flag);
7746 Args.AddAllArgs(CmdArgs, options::OPT_y);
7747 Args.AddLastArg(CmdArgs, options::OPT_w);
7748 Args.AddAllArgs(CmdArgs, options::OPT_pagezero__size);
7749 Args.AddAllArgs(CmdArgs, options::OPT_segs__read__);
7750 Args.AddLastArg(CmdArgs, options::OPT_seglinkedit);
7751 Args.AddLastArg(CmdArgs, options::OPT_noseglinkedit);
7752 Args.AddAllArgs(CmdArgs, options::OPT_sectalign);
7753 Args.AddAllArgs(CmdArgs, options::OPT_sectobjectsymbols);
7754 Args.AddAllArgs(CmdArgs, options::OPT_segcreate);
7755 Args.AddLastArg(CmdArgs, options::OPT_whyload);
7756 Args.AddLastArg(CmdArgs, options::OPT_whatsloaded);
7757 Args.AddAllArgs(CmdArgs, options::OPT_dylinker__install__name);
7758 Args.AddLastArg(CmdArgs, options::OPT_dylinker);
7759 Args.AddLastArg(CmdArgs, options::OPT_Mach);
7765 const ArgList &Args,
7781 if (Args.hasArg(options::OPT_ccc_arcmt_check,
7783 for (const auto &Arg : Args)
7786 Args.MakeArgString(getToolChain().GetProgramPath("touch"));
7794 AddLinkArgs(C, Args, CmdArgs, Inputs);
7798 Args.AddAllArgs(CmdArgs, {options::OPT_d_Flag, options::OPT_s, options::OPT_t,
7805 if (Args.hasArg(options::OPT_ObjC) || Args.hasArg(options::OPT_ObjCXX))
7811 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles))
7812 getMachOToolChain().addStartObjectFileArgs(Args, CmdArgs);
7818 getMachOToolChain().AddLinkRuntimeLib(Args, CmdArgs,
7823 Args.AddAllArgs(CmdArgs, options::OPT_L);
7825 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
7843 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs))
7844 addOpenMPRuntime(CmdArgs, getToolChain(), Args);
7846 if (isObjCRuntimeLinked(Args) &&
7847 !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
7849 getMachOToolChain().AddLinkARCArgs(Args, CmdArgs);
7863 if (Args.hasArg(options::OPT_fnested_functions))
7866 getMachOToolChain().addProfileRTLibs(Args, CmdArgs);
7868 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
7870 getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
7875 getMachOToolChain().AddLinkRuntimeLibArgs(Args, CmdArgs);
7878 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
7882 Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
7883 Args.AddAllArgs(CmdArgs, options::OPT_F);
7886 for (const Arg *A : Args.filtered(options::OPT_iframework))
7887 CmdArgs.push_back(Args.MakeArgString(std::string("-F") + A->getValue()));
7889 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
7890 if (Arg *A = Args.getLastArg(options::OPT_fveclib)) {
7898 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
7908 const ArgList &Args,
7923 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("lipo"));
7930 const ArgList &Args,
7943 Args.MakeArgString(getToolChain().GetProgramPath("dsymutil"));
7950 const ArgList &Args,
7966 Args.MakeArgString(getToolChain().GetProgramPath("dwarfdump"));
7973 const ArgList &Args,
7975 claimNoWarnArgs(Args);
7978 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
7986 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
7993 const ArgList &Args,
8000 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_shared)) {
8005 if (Args.hasArg(options::OPT_static)) {
8010 if (Args.hasArg(options::OPT_shared)) {
8015 Args.MakeArgString(getToolChain().GetFilePath("ld.so.1")));
8026 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8027 if (!Args.hasArg(options::OPT_shared))
8029 Args.MakeArgString(getToolChain().GetFilePath("crt1.o")));
8031 CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
8033 Args.MakeArgString(getToolChain().GetFilePath("values-Xa.o")));
8035 Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
8038 getToolChain().AddFilePathLibArgs(Args, CmdArgs);
8040 Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
8043 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
8045 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
8047 getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
8050 if (!Args.hasArg(options::OPT_shared)) {
8056 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8058 Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
8060 CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
8062 getToolChain().addProfileRTLibs(Args, CmdArgs);
8064 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
8071 const ArgList &Args,
8073 claimNoWarnArgs(Args);
8091 std::string CPU = getCPUName(Args, getToolChain().getTriple());
8093 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
8099 std::string CPU = getCPUName(Args, getToolChain().getTriple());
8101 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
8109 mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
8119 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
8127 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
8135 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
8142 const ArgList &Args,
8148 Args.ClaimAllArgs(options::OPT_g_Group);
8150 Args.ClaimAllArgs(options::OPT_emit_llvm);
8153 Args.ClaimAllArgs(options::OPT_w);
8160 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_shared)) {
8165 if (Args.hasArg(options::OPT_static)) {
8168 if (Args.hasArg(options::OPT_rdynamic))
8172 if (Args.hasArg(options::OPT_shared)) {
8180 if (Args.hasArg(options::OPT_nopie))
8190 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8191 if (!Args.hasArg(options::OPT_shared)) {
8192 if (Args.hasArg(options::OPT_pg))
8194 Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
8197 Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
8199 Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
8202 Args.MakeArgString(getToolChain().GetFilePath("crtbeginS.o")));
8210 Args.MakeArgString("-L/usr/lib/gcc-lib/" + Triple + "/4.2.1"));
8212 Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
8216 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
8218 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
8220 getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
8221 if (Args
8231 if (Args.hasArg(options::OPT_pthread)) {
8232 if (!Args.hasArg(options::OPT_shared) && Args.hasArg(options::OPT_pg))
8238 if (!Args.hasArg(options::OPT_shared)) {
8239 if (Args.hasArg(options::OPT_pg))
8248 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8249 if (!Args.hasArg(options::OPT_shared))
8251 Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
8254 Args.MakeArgString(getToolChain().GetFilePath("crtendS.o")));
8257 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
8264 const ArgList &Args,
8266 claimNoWarnArgs(Args);
8269 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
8277 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
8284 const ArgList &Args,
8289 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_shared)) {
8294 if (Args.hasArg(options::OPT_static)) {
8297 if (Args.hasArg(options::OPT_rdynamic))
8301 if (Args.hasArg(options::OPT_shared)) {
8316 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8317 if (!Args.hasArg(options::OPT_shared)) {
8318 if (Args.hasArg(options::OPT_pg))
8320 Args.MakeArgString(getToolChain().GetFilePath("gcrt0.o")));
8323 Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
8325 Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
8328 Args.MakeArgString(getToolChain().GetFilePath("crtbeginS.o")));
8332 Args.AddAllArgs(CmdArgs,
8335 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
8337 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
8339 getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
8340 if (Args.hasArg(options::OPT_pg))
8346 if (Args.hasArg(options::OPT_pthread)) {
8347 if (!Args.hasArg(options::OPT_shared) && Args.hasArg(options::OPT_pg))
8353 if (!Args.hasArg(options::OPT_shared)) {
8354 if (Args.hasArg(options::OPT_pg))
8374 CmdArgs.push_back(Args.MakeArgString("-lclang_rt." + MyArch));
8377 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8378 if (!Args.hasArg(options::OPT_shared))
8380 Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
8383 Args.MakeArgString(getToolChain().GetFilePath("crtendS.o")));
8386 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
8393 const ArgList &Args,
8395 claimNoWarnArgs(Args);
8415 mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
8429 if (Arg *A = Args.getLastArg(options::OPT_G)) {
8431 CmdArgs.push_back(Args.MakeArgString("-G" + v));
8435 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
8442 arm::FloatABI ABI = arm::getARMFloatABI(getToolChain(), Args);
8464 std::string CPU = getCPUName(Args, getToolChain().getTriple());
8466 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
8471 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
8479 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
8486 const ArgList &Args,
8493 !Args.hasArg(options::OPT_shared) &&
8494 (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
8498 Args.ClaimAllArgs(options::OPT_g_Group);
8500 Args.ClaimAllArgs(options::OPT_emit_llvm);
8503 Args.ClaimAllArgs(options::OPT_w);
8506 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
8512 if (Args.hasArg(options::OPT_static)) {
8515 if (Args.hasArg(options::OPT_rdynamic))
8517 if (Args.hasArg(options::OPT_shared)) {
8544 if (Arg *A = Args.getLastArg(options::OPT_G)) {
8550 CmdArgs.push_back(Args.MakeArgString("-G" + v));
8562 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8564 if (!Args.hasArg(options::OPT_shared)) {
8565 if (Args.hasArg(options::OPT_pg))
8573 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
8575 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
8578 if (Args.hasArg(options::OPT_static))
8580 else if (Args.hasArg(options::OPT_shared) || IsPIE)
8585 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
8588 Args.AddAllArgs(CmdArgs, options::OPT_L);
8589 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
8590 Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
8591 Args.AddAllArgs(CmdArgs, options::OPT_e);
8592 Args.AddAllArgs(CmdArgs, options::OPT_s);
8593 Args.AddAllArgs(CmdArgs, options::OPT_t);
8594 Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
8595 Args.AddAllArgs(CmdArgs, options::OPT_r);
8598 AddGoldPlugin(ToolChain, Args, CmdArgs, D.getLTOMode() == LTOK_Thin);
8600 bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
8601 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
8603 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
8604 addOpenMPRuntime(CmdArgs, ToolChain, Args);
8606 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
8607 if (Args.hasArg(options::OPT_pg))
8616 if (Args.hasArg(options::OPT_pg))
8620 if (Args.hasArg(options::OPT_static)) {
8622 } else if (Args.hasArg(options::OPT_pg)) {
8630 if (Args.hasArg(options::OPT_pthread)) {
8631 if (Args.hasArg(options::OPT_pg))
8637 if (Args.hasArg(options::OPT_pg)) {
8638 if (Args.hasArg(options::OPT_shared))
8648 if (Args.hasArg(options::OPT_static)) {
8650 } else if (Args.hasArg(options::OPT_pg)) {
8659 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8660 if (Args.hasArg(options::OPT_shared) || IsPIE)
8661 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
8663 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
8664 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
8667 ToolChain.addProfileRTLibs(Args, CmdArgs);
8669 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
8676 const ArgList &Args,
8678 claimNoWarnArgs(Args);
8692 getARMArchCPUFromArgs(Args, MArch, MCPU, /*FromAs*/ true);
8695 CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch));
8705 mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
8719 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
8726 std::string CPU = getCPUName(Args, getToolChain().getTriple());
8728 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
8734 std::string CPU = getCPUName(Args, getToolChain().getTriple());
8736 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
8744 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
8752 const char *Exec = Args.MakeArgString((getToolChain().GetProgramPath("as")));
8759 const ArgList &Args,
8765 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
8768 if (Args.hasArg(options::OPT_static)) {
8771 if (Args.hasArg(options::OPT_rdynamic))
8773 if (Args.hasArg(options::OPT_shared)) {
8776 Args.AddAllArgs(CmdArgs, options::OPT_pie);
8809 Args, CmdArgs,
8810 llvm::Triple(getToolChain().ComputeEffectiveClangTriple(Args)));
8828 if (mips::hasMipsAbiArg(Args, "32")) {
8834 } else if (mips::hasMipsAbiArg(Args, "64")) {
8874 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8875 if (!Args.hasArg(options::OPT_shared)) {
8877 Args.MakeArgString(getToolChain().GetFilePath("crt0.o")));
8880 Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
8881 if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie)) {
8883 Args.MakeArgString(getToolChain().GetFilePath("crtbeginS.o")));
8886 Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
8890 Args.AddAllArgs(CmdArgs, options::OPT_L);
8891 Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
8892 Args.AddAllArgs(CmdArgs, options::OPT_e);
8893 Args.AddAllArgs(CmdArgs, options::OPT_s);
8894 Args.AddAllArgs(CmdArgs, options::OPT_t);
8895 Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
8896 Args.AddAllArgs(CmdArgs, options::OPT_r);
8898 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
8924 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
8925 addOpenMPRuntime(CmdArgs, getToolChain(), Args);
8927 getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
8930 if (Args.hasArg(options::OPT_pthread))
8935 if (Args.hasArg(options::OPT_static)) {
8951 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
8952 if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
8954 Args.MakeArgString(getToolChain().GetFilePath("crtendS.o")));
8957 Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
8958 CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
8961 getToolChain().addProfileRTLibs(Args, CmdArgs);
8963 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
8970 const ArgList &Args,
8972 claimNoWarnArgs(Args);
8974 std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
8983 ParsePICArgs(getToolChain(), Triple, Args);
9018 std::string CPU = getCPUName(Args, getToolChain().getTriple());
9020 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
9025 std::string CPU = getCPUName(Args, getToolChain().getTriple());
9027 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
9046 switch (arm::getARMFloatABI(getToolChain(), Args)) {
9049 CmdArgs.push_back(Args.MakeArgString("-mfloat-abi=soft"));
9052 CmdArgs.push_back(Args.MakeArgString("-mfloat-abi=softfp"));
9055 CmdArgs.push_back(Args.MakeArgString("-mfloat-abi=hard"));
9059 Args.AddLastArg(CmdArgs, options::OPT_march_EQ);
9065 if ((A = Args.getLastArg(options::OPT_mcpu_EQ)) &&
9069 Args.AddLastArg(CmdArgs, options::OPT_mcpu_EQ);
9070 Args.AddLastArg(CmdArgs, options::OPT_mfpu_EQ);
9079 mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
9103 if (Arg *A = Args.getLastArg(options::OPT_mnan_EQ)) {
9105 CmdArgs.push_back(Args.MakeArgString("-mnan=2008"));
9109 if (Arg *A = Args.getLastArg(options::OPT_mfp32, options::OPT_mfpxx,
9112 A->render(Args, CmdArgs);
9114 Args, getToolChain().getTriple(), CPUName, ABIName,
9115 getMipsFloatABI(getToolChain().getDriver(), Args)))
9121 Args.getLastArg(options::OPT_mips16, options::OPT_mno_mips16)) {
9124 A->render(Args, CmdArgs);
9131 Args.AddLastArg(CmdArgs, options::OPT_mmicromips,
9133 Args.AddLastArg(CmdArgs, options::OPT_mdsp, options::OPT_mno_dsp);
9134 Args.AddLastArg(CmdArgs, options::OPT_mdspr2, options::OPT_mno_dspr2);
9136 if (Arg *A = Args.getLastArg(options::OPT_mmsa, options::OPT_mno_msa)) {
9140 CmdArgs.push_back(Args.MakeArgString("-mmsa"));
9143 Args.AddLastArg(CmdArgs, options::OPT_mhard_float,
9146 Args.AddLastArg(CmdArgs, options::OPT_mdouble_float,
9149 Args.AddLastArg(CmdArgs, options::OPT_modd_spreg,
9152 AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
9158 StringRef CPUName = getSystemZTargetCPU(Args);
9159 CmdArgs.push_back(Args.MakeArgString("-march=" + CPUName));
9164 Args.AddAllArgs(CmdArgs, options::OPT_I);
9165 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
9173 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
9179 if (Args.hasArg(options::OPT_gsplit_dwarf) &&
9181 SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
9182 SplitDebugName(Args, Inputs[0]));
9186 ArgStringList &CmdArgs, const ArgList &Args) {
9190 bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) ||
9191 Args.hasArg(options::OPT_static);
9208 else if (!Args.hasArg(options::OPT_shared) && D.CCCIsCXX())
9221 ArgStringList &CmdArgs, const ArgList &Args) {
9223 ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(Args);
9232 addClangRT(TC, Args, CmdArgs);
9241 if (Args.hasArg(options::OPT_rtlib_EQ)) {
9243 << Args.getLastArg(options::OPT_rtlib_EQ)->getValue() << "MSVC";
9246 AddLibgcc(TC.getTriple(), D, CmdArgs, Args);
9251 static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) {
9283 if (mips::hasMipsAbiArg(Args, "n32"))
9287 if (mips::hasMipsAbiArg(Args, "n32"))
9304 const ArgList &Args,
9310 std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);
9317 !Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_static) &&
9318 (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
9326 Args.ClaimAllArgs(options::OPT_g_Group);
9328 Args.ClaimAllArgs(options::OPT_emit_llvm);
9331 Args.ClaimAllArgs(options::OPT_w);
9333 const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
9338 CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
9342 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
9347 if (Args.hasArg(options::OPT_rdynamic))
9350 if (Args.hasArg(options::OPT_s))
9354 arm::appendEBLinkFlags(Args, CmdArgs, Triple);
9359 if (!Args.hasArg(options::OPT_static)) {
9364 CmdArgs.push_back(getLDMOption(ToolChain.getTriple(), Args));
9366 if (Args.hasArg(options::OPT_static)) {
9372 } else if (Args.hasArg(options::OPT_shared)) {
9376 if (!Args.hasArg(options::OPT_static)) {
9377 if (Args.hasArg(options::OPT_rdynamic))
9380 if (!Args.hasArg(options::OPT_shared)) {
9382 D.DyldPrefix + ToolChain.getDynamicLinker(Args);
9384 CmdArgs.push_back(Args.MakeArgString(Loader));
9391 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
9394 if (!Args.hasArg(options::OPT_shared)) {
9395 if (Args.hasArg(options::OPT_pg))
9403 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
9405 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
9409 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt0.o")));
9412 if (Args.hasArg(options::OPT_static))
9414 else if (Args.hasArg(options::OPT_shared))
9422 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
9426 ToolChain.AddFastMathRuntimeIfAvailable(Args, CmdArgs);
9429 Args.AddAllArgs(CmdArgs, options::OPT_L);
9430 Args.AddAllArgs(CmdArgs, options::OPT_u);
9432 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
9435 AddGoldPlugin(ToolChain, Args, CmdArgs, D.getLTOMode() == LTOK_Thin);
9437 if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
9440 bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
9441 bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
9442 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
9444 getToolChain().addProfileRTLibs(Args, CmdArgs);
9447 !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
9448 bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
9449 !Args.hasArg(options::OPT_static);
9452 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
9458 Args.ClaimAllArgs(options::OPT_stdlib_EQ);
9460 if (!Args.hasArg(options::OPT_nostdlib)) {
9461 if (!Args.hasArg(options::OPT_nodefaultlibs)) {
9462 if (Args.hasArg(options::OPT_static))
9469 linkXRayRuntimeDeps(ToolChain, Args, CmdArgs);
9471 bool WantPthread = Args.hasArg(options::OPT_pthread) ||
9472 Args.hasArg(options::OPT_pthreads);
9474 if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
9481 switch (getOpenMPRuntime(ToolChain, Args)) {
9501 AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
9506 if (Args.hasArg(options::OPT_fsplit_stack))
9515 if (Args.hasArg(options::OPT_static))
9518 AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
9528 if (!Args.hasArg(options::OPT_nostartfiles) && !IsIAMCU) {
9530 if (Args.hasArg(options::OPT_shared))
9538 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
9540 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
9554 const ArgList &Args,
9563 gnutools::Assembler::ConstructJob(C, JA, Output, NewInputs, Args,
9574 const ArgList &Args,
9582 !Args.hasArg(options::OPT_dynamic) && !Args.hasArg(options::OPT_shared);
9587 Args.ClaimAllArgs(options::OPT_g_Group);
9589 Args.ClaimAllArgs(options::OPT_emit_llvm);
9592 Args.ClaimAllArgs(options::OPT_w);
9595 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
9597 if (Args.hasArg(options::OPT_rdynamic))
9600 if (Args.hasArg(options::OPT_s))
9625 else if (Args.hasArg(options::OPT_shared))
9630 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
9631 if (!Args.hasArg(options::OPT_shared))
9632 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt1.o")));
9633 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
9638 else if (Args.hasArg(options::OPT_shared))
9642 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
9645 Args.AddAllArgs(CmdArgs, options::OPT_L);
9646 Args.AddAllArgs(CmdArgs, options::OPT_u);
9648 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
9650 if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
9653 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
9656 !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
9658 Args.hasArg(options::OPT_static_libstdcxx) && !IsStatic;
9661 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
9667 if (!Args.hasArg(options::OPT_nostdlib)) {
9668 if (!Args.hasArg(options::OPT_nodefaultlibs)) {
9674 if (Args.hasArg(options::OPT_pthread) ||
9675 Args
9703 if (!Args.hasArg(options::OPT_nostartfiles)) {
9705 if (Args.hasArg(options::OPT_shared))
9710 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
9711 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
9715 const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
9722 const ArgList &Args,
9724 claimNoWarnArgs(Args);
9727 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
9735 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
9742 const ArgList &Args,
9754 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
9755 CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crt1.o")));
9756 CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
9758 Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
9759 CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
9762 Args.AddAllArgs(CmdArgs,
9765 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
9767 getToolChain().addProfileRTLibs(Args, CmdArgs);
9769 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
9771 getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
9776 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
9777 if (Args.hasArg(options::OPT_pthread))
9783 Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
9786 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
9797 const ArgList &Args,
9799 claimNoWarnArgs(Args);
9807 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
9815 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
9822 const ArgList &Args,
9828 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
9831 if (Args.hasArg(options::OPT_static)) {
9834 if (Args.hasArg(options::OPT_rdynamic))
9836 if (Args.hasArg(options::OPT_shared))
9860 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
9861 if (!Args.hasArg(options::OPT_shared)) {
9862 if (Args.hasArg(options::OPT_pg))
9864 Args.MakeArgString(getToolChain().GetFilePath("gcrt1.o")));
9866 if (Args.hasArg(options::OPT_pie))
9868 Args.MakeArgString(getToolChain().GetFilePath("Scrt1.o")));
9871 Args.MakeArgString(getToolChain().GetFilePath("crt1.o")));
9874 CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o")));
9875 if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
9877 Args.MakeArgString(getToolChain().GetFilePath("crtbeginS.o")));
9880 Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o")));
9883 Args.AddAllArgs(CmdArgs,
9886 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
9888 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
9891 if (!Args.hasArg(options::OPT_static)) {
9897 getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
9901 if (Args.hasArg(options::OPT_pthread))
9904 if (!Args.hasArg(options::OPT_nolibc)) {
9908 if (Args.hasArg(options::OPT_static) ||
9909 Args.hasArg(options::OPT_static_libgcc)) {
9913 if (Args.hasArg(options::OPT_shared_libgcc)) {
9915 if (!Args.hasArg(options::OPT_shared))
9926 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
9927 if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
9929 Args.MakeArgString(getToolChain().GetFilePath("crtendS.o")));
9932 Args.MakeArgString(getToolChain().GetFilePath("crtend.o")));
9933 CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o")));
9936 getToolChain().addProfileRTLibs(Args, CmdArgs);
9938 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
9965 const ArgList &Args,
9973 Args.MakeArgString(std::string("-out:") + Output.getFilename()));
9975 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles) &&
10003 Args.MakeArgString(std::string("-libpath:") + LibDir.c_str()));
10008 CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") +
10015 CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") +
10019 if (!C.getDriver().IsCLMode() && Args.hasArg(options::OPT_L))
10020 for (const auto &LibPath : Args.getAllArgValues(options::OPT_L))
10021 CmdArgs.push_back(Args.MakeArgString("-libpath:" + LibPath));
10025 if (Args.hasArg(options::OPT_g_Group, options::OPT__SLASH_Z7,
10029 bool DLL = Args.hasArg(options::OPT__SLASH_LD, options::OPT__SLASH_LDd,
10032 CmdArgs.push_back(Args.MakeArgString("-dll"));
10036 CmdArgs.push_back(Args.MakeArgString(std::string("-implib:") + ImplibName));
10040 CmdArgs.push_back(Args.MakeArgString("-debug"));
10041 CmdArgs.push_back(Args.MakeArgString("-incremental:no"));
10042 if (Args.hasArg(options::OPT__SLASH_MD, options::OPT__SLASH_MDd)) {
10044 CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
10047 CmdArgs.push_back(Args.MakeArgString("-include:___asan_seh_interceptor"));
10049 CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
10052 CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
10056 Args.AddAllArgValues(CmdArgs, options::OPT__SLASH_link);
10058 if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
10062 CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") +
10064 switch (getOpenMPRuntime(getToolChain(), Args)) {
10081 if (!Args.hasArg(options::OPT_nostdlib)) {
10082 AddRunTimeLibs(TC, TC.getDriver(), CmdArgs, Args);
10099 LinkLibArg = Args.MakeArgString(Lib);
10101 LinkLibArg = Args.MakeArgString(Lib + ".lib");
10108 A.renderAsInput(Args, CmdArgs);
10111 TC.addProfileRTLibs(Args, CmdArgs);
10117 StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "link");
10133 const char *Exec = Args.MakeArgString(linkPath);
10140 const ArgList &Args,
10142 C.addCommand(GetCommand(C, JA, Output, Inputs, Args, LinkingOutput));
10147 const InputInfoList &Inputs, const ArgList &Args,
10158 Args.AddAllArgs(CmdArgs, {options::OPT_D, options::OPT_U, options::OPT_I});
10161 if (Arg *A = Args.getLastArg(options::OPT_fbuiltin, options::OPT_fno_builtin))
10164 if (Arg *A = Args.getLastArg(options::OPT_O, options::OPT_O0)) {
10179 if (Arg *A = Args.getLastArg(options::OPT_fomit_frame_pointer,
10184 if (!Args.hasArg(options::OPT_fwritable_strings))
10190 if (Args.hasFlag(options::OPT__SLASH_GR_, options::OPT__SLASH_GR,
10194 if (Args.hasFlag(options::OPT__SLASH_GS_, options::OPT__SLASH_GS,
10198 if (Arg *A = Args.getLastArg(options::OPT_ffunction_sections,
10203 if (Arg *A = Args.getLastArg(options::OPT_fdata_sections,
10207 if (Args.hasArg(options::OPT_fsyntax_only))
10209 if (Args.hasArg(options::OPT_g_Flag, options::OPT_gline_tables_only,
10214 Args.getAllArgValues(options::OPT_include);
10216 CmdArgs.push_back(Args.MakeArgString(std::string("/FI") + Include));
10219 Args.AddAllArgs(CmdArgs, options::OPT__SLASH_LD);
10220 Args.AddAllArgs(CmdArgs, options::OPT__SLASH_LDd);
10221 Args.AddAllArgs(CmdArgs, options::OPT__SLASH_GX);
10222 Args.AddAllArgs(CmdArgs, options::OPT__SLASH_GX_);
10223 Args.AddAllArgs(CmdArgs, options::OPT__SLASH_EH);
10224 Args.AddAllArgs(CmdArgs, options::OPT__SLASH_Zl);
10227 if (Arg *A = Args.getLastArg(options::OPT__SLASH_MD, options::OPT__SLASH_MDd,
10229 A->render(Args, CmdArgs);
10233 Args.AddAllArgs(CmdArgs, options::OPT_UNKNOWN);
10243 II.getInputArg().renderAsInput(Args, CmdArgs);
10248 Args.MakeArgString(std::string("/Fo") + Output.getFilename());
10254 return llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Exec),
10262 const ArgList &Args,
10264 claimNoWarnArgs(Args);
10273 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
10281 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
10284 if (Args.hasArg(options::OPT_gsplit_dwarf))
10285 SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
10286 SplitDebugName(Args, Inputs[0]));
10289 void MinGW::Linker::AddLibGCC(const ArgList &Args,
10291 if (Args.hasArg(options::OPT_mthreads))
10296 ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
10298 bool Static = Args.hasArg(options::OPT_static_libgcc) ||
10299 Args.hasArg(options::OPT_static);
10300 bool Shared = Args.hasArg(options::OPT_shared);
10311 AddRunTimeLibs(getToolChain(), getToolChain().getDriver(), CmdArgs, Args);
10322 const ArgList &Args,
10331 Args.ClaimAllArgs(options::OPT_g_Group);
10333 Args.ClaimAllArgs(options::OPT_emit_llvm);
10336 Args.ClaimAllArgs(options::OPT_w);
10338 StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
10347 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
10349 if (Args.hasArg(options::OPT_s))
10360 if (Args.hasArg(options::OPT_mwindows)) {
10363 } else if (Args.hasArg(options::OPT_mconsole)) {
10368 if (Args.hasArg(options::OPT_static))
10371 if (Args.hasArg(options::OPT_mdll))
10373 else if (Args.hasArg(options::OPT_shared))
10376 if (Args.hasArg(options::OPT_mdll) || Args.hasArg(options::OPT_shared)) {
10389 Args.AddAllArgs(CmdArgs, options::OPT_e);
10391 Args.AddLastArg(CmdArgs, options::OPT_r);
10392 Args.AddLastArg(CmdArgs, options::OPT_s);
10393 Args.AddLastArg(CmdArgs, options::OPT_t);
10394 Args.AddAllArgs(CmdArgs, options::OPT_u_Group);
10395 Args.AddLastArg(CmdArgs, options::OPT_Z_Flag);
10397 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
10398 if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_mdll)) {
10399 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("dllcrt2.o")));
10401 if (Args.hasArg(options::OPT_municode))
10402 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crt2u.o")));
10404 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crt2.o")));
10406 if (Args.hasArg(options::OPT_pg))
10407 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("gcrt2.o")));
10408 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtbegin.o")));
10411 Args.AddAllArgs(CmdArgs, options::OPT_L);
10412 TC.AddFilePathLibArgs(Args, CmdArgs);
10413 AddLinkerInputs(TC, Inputs, Args, CmdArgs);
10420 !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
10421 bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
10422 !Args.hasArg(options::OPT_static);
10425 TC.AddCXXStdlibLibArgs(Args, CmdArgs);
10430 if (!Args.hasArg(options::OPT_nostdlib)) {
10431 if (!Args.hasArg(options::OPT_nodefaultlibs)) {
10432 if (Args.hasArg(options::OPT_static))
10435 if (Args.hasArg(options::OPT_fstack_protector) ||
10436 Args.hasArg(options::OPT_fstack_protector_strong) ||
10437 Args.hasArg(options::OPT_fstack_protector_all)) {
10441 if (Args.hasArg(options::OPT_fopenmp))
10444 AddLibGCC(Args, CmdArgs);
10446 if (Args.hasArg(options::OPT_pg))
10449 if (Args.hasArg(options::OPT_pthread))
10453 if (Args.hasArg(options::OPT_mwindows)) {
10462 if (Args.hasArg(options::OPT_static))
10465 AddLibGCC(Args, CmdArgs);
10468 if (!Args.hasArg(options::OPT_nostartfiles)) {
10470 TC.AddFastMathRuntimeIfAvailable(Args, CmdArgs);
10472 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
10475 const char *Exec = Args.MakeArgString(TC.GetProgramPath(LinkerName.data()));
10485 const ArgList &Args,
10487 claimNoWarnArgs(Args);
10495 if (Args.hasArg(options::OPT_v))
10498 if (Arg *A = Args.getLastArg(options::OPT_g_Group))
10502 if (Args.hasFlag(options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
10506 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
10511 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("xcc"));
10518 const ArgList &Args,
10529 if (Args.hasArg(options::OPT_v))
10533 if (Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
10537 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
10539 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("xcc"));
10546 const ArgList &Args,
10548 claimNoWarnArgs(Args);
10568 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
10577 Exec = Args.MakeArgString(Assembler);
10585 const ArgList &Args,
10596 Args.ClaimAllArgs(options::OPT_g_Group);
10598 Args.ClaimAllArgs(options::OPT_emit_llvm);
10600 Args.ClaimAllArgs(options::OPT_w);
10604 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
10606 if (Args.hasArg(options::OPT_pie))
10608 if (Args.hasArg(options::OPT_rdynamic))
10610 if (Args.hasArg(options::OPT_s))
10631 if (Args.hasArg(options::OPT_shared)) {
10651 CmdArgs.push_back(Args.MakeArgString(EntryPoint));
10655 CmdArgs.push_back(Args.hasArg(options::OPT_static) ? "-Bstatic"
10658 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
10660 CmdArgs.push_back(Args.MakeArgString(EntryPoint));
10672 if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_rdynamic)) {
10677 CmdArgs.push_back(Args.MakeArgString(ImpLib));
10680 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
10685 Args.hasArg(options::OPT_shared) ? "crtbeginS.obj" : "crtbegin.obj";
10686 CmdArgs.push_back(Args.MakeArgString(CRTPath + CRTBegin));
10689 Args.AddAllArgs(CmdArgs, options::OPT_L);
10690 TC.AddFilePathLibArgs(Args, CmdArgs);
10691 AddLinkerInputs(TC, Inputs, Args, CmdArgs);
10693 if (D.CCCIsCXX() && !Args.hasArg(options::OPT_nostdlib) &&
10694 !Args.hasArg(options::OPT_nodefaultlibs)) {
10695 bool StaticCXX = Args.hasArg(options::OPT_static_libstdcxx) &&
10696 !Args.hasArg(options::OPT_static);
10699 TC.AddCXXStdlibLibArgs(Args, CmdArgs);
10704 if (!Args.hasArg(options::OPT_nostdlib)) {
10705 if (!Args.hasArg(options::OPT_nodefaultlibs)) {
10708 AddRunTimeLibs(TC, D, CmdArgs, Args);
10714 if (Args.hasArg(options::OPT_shared)) {
10715 CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dll_thunk"));
10718 CmdArgs.push_back(TC.getCompilerRTArgString(Args, Lib));
10721 CmdArgs.push_back(Args.MakeArgString("--undefined"));
10722 CmdArgs.push_back(Args.MakeArgString(TC.getArch() == llvm::Triple::x86
10728 Exec = Args.MakeArgString(TC.GetLinkerPath());
10736 const ArgList &Args,
10745 Args.ClaimAllArgs();
10757 Args.AddAllArgs(CmdArgs, {options::OPT_I_Group, options::OPT_clang_i_Group,
10769 if (Args.getLastArg(options::OPT_MF) && !Args.getLastArg(options::OPT_MT) &&
10772 Arg *A = Args.getLastArg(options::OPT_o);
10775 CmdArgs.push_back(Args.MakeArgString(A->getValue()));
10784 Args.MakeArgString(getToolChain().GetProgramPath("moviCompile"));
10785 C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Exec),
10792 const ArgList &Args,
10802 const Arg *CPUArg = Args.getLastArg(options::OPT_mcpu_EQ);
10805 Args.MakeArgString("-cv:" + StringRef(CPUArg->getValue())));
10808 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
10809 for (const Arg *A : Args.filtered(options::OPT_I, options::OPT_isystem)) {
10812 Args.MakeArgString(std::string("-i:") + A->getValue(0)));
10817 Args.MakeArgString(std::string("-o:") + Output.getFilename()));
10820 Args.MakeArgString(getToolChain().GetProgramPath("moviAsm"));
10821 C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Exec),
10828 const ArgList &Args,
10835 !Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles);
10837 !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs);
10849 Args.ClaimAllArgs(options::OPT_g_Group);
10850 Args.ClaimAllArgs(options::OPT_w);
10851 Args.ClaimAllArgs(options::OPT_static_libgcc);
10853 if (Args.hasArg(options::OPT_s)) // Pass the 'strip' option.
10862 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crti.o")));
10863 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtbegin.o")));
10866 Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
10870 TC.AddFilePathLibArgs(Args, CmdArgs);
10872 AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
10890 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
10891 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtn.o")));
10895 Args.MakeArgString(TC.GetProgramPath("sparc-myriad-elf-ld"));
10896 C.addCommand(llvm::make_unique<Command>(JA, *this, Args.MakeArgString(Exec),
10903 const ArgList &Args,
10905 claimNoWarnArgs(Args);
10908 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
10919 Args.MakeArgString(getToolChain().GetProgramPath("orbis-as"));
10936 const ArgList &Args,
10944 Args.ClaimAllArgs(options::OPT_g_Group);
10946 Args.ClaimAllArgs(options::OPT_emit_llvm);
10949 Args.ClaimAllArgs(options::OPT_w);
10952 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
10954 if (Args.hasArg(options::OPT_pie))
10957 if (Args.hasArg(options::OPT_rdynamic))
10959 if (Args.hasArg(options::OPT_shared))
10971 Args.AddAllArgs(CmdArgs, options::OPT_L);
10972 Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
10973 Args.AddAllArgs(CmdArgs, options::OPT_e);
10974 Args.AddAllArgs(CmdArgs, options::OPT_s);
10975 Args.AddAllArgs(CmdArgs, options::OPT_t);
10976 Args.AddAllArgs(CmdArgs, options::OPT_r);
10978 if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
10981 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
10983 if (Args.hasArg(options::OPT_pthread)) {
10987 const char *Exec = Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld"));
10995 const ArgList &Args,
11003 Args.ClaimAllArgs(options::OPT_g_Group);
11005 Args.ClaimAllArgs(options::OPT_emit_llvm);
11008 Args.ClaimAllArgs(options::OPT_w);
11011 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
11013 if (Args.hasArg(options::OPT_pie))
11016 if (Args.hasArg(options::OPT_static)) {
11019 if (Args.hasArg(options::OPT_rdynamic))
11022 if (Args.hasArg(options::OPT_shared)) {
11040 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
11042 if (!Args.hasArg(options::OPT_shared)) {
11043 if (Args.hasArg(options::OPT_pg))
11045 else if (Args.hasArg(options::OPT_pie))
11051 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
11053 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
11056 if (Args.hasArg(options::OPT_static))
11058 else if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
11063 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
11066 Args.AddAllArgs(CmdArgs, options::OPT_L);
11067 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
11068 Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
11069 Args.AddAllArgs(CmdArgs, options::OPT_e);
11070 Args.AddAllArgs(CmdArgs, options::OPT_s);
11071 Args.AddAllArgs(CmdArgs, options::OPT_t);
11072 Args.AddAllArgs(CmdArgs, options::OPT_r);
11074 if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
11077 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs);
11079 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
11084 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
11085 if (Args.hasArg(options::OPT_pg))
11092 if (Args.hasArg(options::OPT_pg))
11096 if (Args.hasArg(options::OPT_static)) {
11098 } else if (Args.hasArg(options::OPT_pg)) {
11106 if (Args.hasArg(options::OPT_pthread)) {
11107 if (Args.hasArg(options::OPT_pg))
11113 if (Args.hasArg(options::OPT_pg)) {
11114 if (Args.hasArg(options::OPT_shared))
11117 if (Args.hasArg(options::OPT_static)) {
11128 if (Args.hasArg(options::OPT_static)) {
11139 if (Args.hasArg(options::OPT_static)) {
11141 } else if (Args.hasArg(options::OPT_pg)) {
11150 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
11151 if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
11152 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
11154 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
11155 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
11160 Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld.gold"));
11162 Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld"));
11171 const ArgList &Args,
11178 if (const Arg *A = Args.getLastArg(options::OPT_fuse_ld_EQ)) {
11189 PS4Linker = !Args.hasArg(options::OPT_shared);
11192 ConstructPS4LinkJob(*this, C, JA, Output, Inputs, Args, LinkingOutput);
11194 ConstructGoldLinkJob(*this, C, JA, Output, Inputs, Args, LinkingOutput);
11200 const ArgList &Args,
11207 Args.getAllArgValues(options::OPT_march_EQ);
11212 if (!Args.hasArg(options::OPT_no_cuda_version_check)) {
11219 if (Args.hasFlag(options::OPT_cuda_noopt_device_debug,
11226 } else if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
11250 CmdArgs.push_back(Args.MakeArgString(llvm::Twine("-O") + OOpt));
11258 CmdArgs.push_back(Args.MakeArgString(gpu_arch));
11260 CmdArgs.push_back(Args.MakeArgString(Output.getFilename()));
11262 CmdArgs.push_back(Args.MakeArgString(II.getFilename()));
11264 for (const auto& A : Args.getAllArgValues(options::OPT_Xcuda_ptxas))
11265 CmdArgs.push_back(Args.MakeArgString(A));
11267 const char *Exec = Args.MakeArgString(TC.GetProgramPath("ptxas"));
11277 const ArgList &Args,
11286 CmdArgs.push_back(Args.MakeArgString("--create"));
11287 CmdArgs.push_back(Args.MakeArgString(Output.getFilename()));
11297 CmdArgs.push_back(Args.MakeArgString(llvm::Twine("--image=profile=") +
11301 for (const auto& A : Args.getAllArgValues(options::OPT_Xcuda_fatbinary))
11302 CmdArgs.push_back(Args.MakeArgString(A));
11304 const char *Exec = Args.MakeArgString(TC.GetProgramPath("fatbinary"));