Lines Matching +full:- +full:msoft +full:- +full:float
1 //===--- Tools.cpp - Tools Implementations ----------------------*- C++ -*-===//
8 //===----------------------------------------------------------------------===//
59 StringRef Name = A->getOption().getName(); in handleTargetFeaturesGroup()
60 A->claim(); in handleTargetFeaturesGroup()
62 // Skip over "-m". in handleTargetFeaturesGroup()
66 bool IsNegative = Name.startswith("no-"); in handleTargetFeaturesGroup()
69 Features.push_back(Args.MakeArgString((IsNegative ? "-" : "+") + Name)); in handleTargetFeaturesGroup()
77 .Case("niagara", "-Av9b") in getSparcAsmModeForCPU()
78 .Case("niagara2", "-Av9b") in getSparcAsmModeForCPU()
79 .Case("niagara3", "-Av9d") in getSparcAsmModeForCPU()
80 .Case("niagara4", "-Av9d") in getSparcAsmModeForCPU()
81 .Default("-Av9"); in getSparcAsmModeForCPU()
84 .Case("v8", "-Av8") in getSparcAsmModeForCPU()
85 .Case("supersparc", "-Av8") in getSparcAsmModeForCPU()
86 .Case("sparclite", "-Asparclite") in getSparcAsmModeForCPU()
87 .Case("f934", "-Asparclite") in getSparcAsmModeForCPU()
88 .Case("hypersparc", "-Av8") in getSparcAsmModeForCPU()
89 .Case("sparclite86x", "-Asparclite") in getSparcAsmModeForCPU()
90 .Case("sparclet", "-Asparclet") in getSparcAsmModeForCPU()
91 .Case("tsc701", "-Asparclet") in getSparcAsmModeForCPU()
92 .Case("v9", "-Av8plus") in getSparcAsmModeForCPU()
93 .Case("ultrasparc", "-Av8plus") in getSparcAsmModeForCPU()
94 .Case("ultrasparc3", "-Av8plus") in getSparcAsmModeForCPU()
95 .Case("niagara", "-Av8plusb") in getSparcAsmModeForCPU()
96 .Case("niagara2", "-Av8plusb") in getSparcAsmModeForCPU()
97 .Case("niagara3", "-Av8plusd") in getSparcAsmModeForCPU()
98 .Case("niagara4", "-Av8plusd") in getSparcAsmModeForCPU()
99 .Case("leon2", "-Av8") in getSparcAsmModeForCPU()
100 .Case("at697e", "-Av8") in getSparcAsmModeForCPU()
101 .Case("at697f", "-Av8") in getSparcAsmModeForCPU()
102 .Case("leon3", "-Av8") in getSparcAsmModeForCPU()
103 .Case("ut699", "-Av8") in getSparcAsmModeForCPU()
104 .Case("gr712rc", "-Av8") in getSparcAsmModeForCPU()
105 .Case("leon4", "-Av8") in getSparcAsmModeForCPU()
106 .Case("gr740", "-Av8") in getSparcAsmModeForCPU()
107 .Default("-Av8"); in getSparcAsmModeForCPU()
111 /// CheckPreprocessingOptions - Perform some validation of preprocessing
118 << A->getBaseArg().getAsString(Args) in CheckPreprocessingOptions()
119 << (D.IsCLMode() ? "/E, /P or /EP" : "-E"); in CheckPreprocessingOptions()
124 /// CheckCodeGenerationOptions - Perform some validation of code generation
131 D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args) in CheckCodeGenerationOptions()
132 << "-static"; in CheckCodeGenerationOptions()
136 // This is used for the space-separated argument list specified with
137 // the -dwarf-debug-flags option.
161 for (int j = i - 1; j >= 0 && Target[j] == '\\'; --j) in QuoteTarget()
190 if (Name.equals("-I") || Name.equals("-L")) in addDirectoryList()
240 // (constructed via -Xarch_). in AddLinkerInputs()
263 // Pass -z prefix for gcc linker compatibility. in AddLinkerInputs()
271 // LIBRARY_PATH - included following the user specified library paths. in AddLinkerInputs()
274 addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); in AddLinkerInputs()
277 /// \brief Determine whether Objective-C automated reference counting is
320 DepFile = MF->getValue(); in AddPreprocessingOptions()
324 } else if (A->getOption().matches(options::OPT_M) || in AddPreprocessingOptions()
325 A->getOption().matches(options::OPT_MM)) { in AddPreprocessingOptions()
326 DepFile = "-"; in AddPreprocessingOptions()
331 CmdArgs.push_back("-dependency-file"); in AddPreprocessingOptions()
338 // If user provided -o, that is the dependency target, except in AddPreprocessingOptions()
342 DepTarget = OutputOpt->getValue(); in AddPreprocessingOptions()
352 CmdArgs.push_back("-MT"); in AddPreprocessingOptions()
358 if (A->getOption().matches(options::OPT_M) || in AddPreprocessingOptions()
359 A->getOption().matches(options::OPT_MD)) in AddPreprocessingOptions()
360 CmdArgs.push_back("-sys-header-deps"); in AddPreprocessingOptions()
364 CmdArgs.push_back("-module-file-deps"); in AddPreprocessingOptions()
368 if (!A || A->getOption().matches(options::OPT_MD) || in AddPreprocessingOptions()
369 A->getOption().matches(options::OPT_MMD)) in AddPreprocessingOptions()
371 CmdArgs.push_back("-MG"); in AddPreprocessingOptions()
377 // Convert all -MQ <target> args to -MT <quoted target> in AddPreprocessingOptions()
379 A->claim(); in AddPreprocessingOptions()
381 if (A->getOption().matches(options::OPT_MQ)) { in AddPreprocessingOptions()
382 CmdArgs.push_back("-MT"); in AddPreprocessingOptions()
384 QuoteTarget(A->getValue(), Quoted); in AddPreprocessingOptions()
387 // -MT flag - no change in AddPreprocessingOptions()
389 A->render(Args, CmdArgs); in AddPreprocessingOptions()
393 // Add -i* options, and automatically translate to in AddPreprocessingOptions()
394 // -include-pch/-include-pth for transparent PCH support. It's in AddPreprocessingOptions()
398 int YcIndex = -1, YuIndex = -1; in AddPreprocessingOptions()
400 int AI = -1; in AddPreprocessingOptions()
404 // Walk the whole i_Group and skip non "-include" flags so that the index in AddPreprocessingOptions()
407 if (!A->getOption().matches(options::OPT_include)) in AddPreprocessingOptions()
409 if (YcArg && strcmp(A->getValue(), YcArg->getValue()) == 0) in AddPreprocessingOptions()
411 if (YuArg && strcmp(A->getValue(), YuArg->getValue()) == 0) in AddPreprocessingOptions()
415 if (isa<PrecompileJobAction>(JA) && YcIndex != -1) { in AddPreprocessingOptions()
419 CmdArgs.push_back(Args.MakeArgString(Twine("-find-pch-source=") + in AddPreprocessingOptions()
420 Inputs[0].second->getValue())); in AddPreprocessingOptions()
424 int AI = -1; in AddPreprocessingOptions()
429 A->getOption().matches(options::OPT_include)) { in AddPreprocessingOptions()
430 // In clang-cl mode, /Ycfoo.h means that all code up to a foo.h in AddPreprocessingOptions()
442 int PchIndex = YcIndex != -1 ? YcIndex : YuIndex; in AddPreprocessingOptions()
443 if (PchIndex != -1) { in AddPreprocessingOptions()
446 assert(YcIndex != -1 && PchIndex == YcIndex); in AddPreprocessingOptions()
452 A->claim(); in AddPreprocessingOptions()
456 A->claim(); in AddPreprocessingOptions()
457 CmdArgs.push_back("-include-pch"); in AddPreprocessingOptions()
459 Args.MakeArgString(D.GetClPchPath(C, A->getValue()))); in AddPreprocessingOptions()
464 } else if (A->getOption().matches(options::OPT_include)) { in AddPreprocessingOptions()
465 // Handling of gcc-style gch precompiled headers. in AddPreprocessingOptions()
474 SmallString<128> P(A->getValue()); in AddPreprocessingOptions()
500 A->claim(); in AddPreprocessingOptions()
502 CmdArgs.push_back("-include-pch"); in AddPreprocessingOptions()
504 CmdArgs.push_back("-include-pth"); in AddPreprocessingOptions()
510 << A->getAsString(Args); in AddPreprocessingOptions()
513 } else if (A->getOption().matches(options::OPT_isystem_after)) { in AddPreprocessingOptions()
523 A->claim(); in AddPreprocessingOptions()
524 A->render(Args, CmdArgs); in AddPreprocessingOptions()
531 // Add -Wp, and -Xpreprocessor if using the preprocessor. in AddPreprocessingOptions()
534 // souls abuse -Wp, to pass preprocessor options in gcc syntax. To in AddPreprocessingOptions()
540 // -I- is a deprecated GCC feature, reject it. in AddPreprocessingOptions()
542 D.Diag(diag::err_drv_I_dash_not_supported) << A->getAsString(Args); in AddPreprocessingOptions()
544 // If we have a --sysroot, and don't have an explicit -isysroot flag, add an in AddPreprocessingOptions()
545 // -isysroot to the CC1 invocation. in AddPreprocessingOptions()
549 CmdArgs.push_back("-isysroot"); in AddPreprocessingOptions()
557 // CPATH - included following the user specified includes (but prior to in AddPreprocessingOptions()
559 addDirectoryList(Args, CmdArgs, "-I", "CPATH"); in AddPreprocessingOptions()
560 // C_INCLUDE_PATH - system includes enabled when compiling C. in AddPreprocessingOptions()
561 addDirectoryList(Args, CmdArgs, "-c-isystem", "C_INCLUDE_PATH"); in AddPreprocessingOptions()
562 // CPLUS_INCLUDE_PATH - system includes enabled when compiling C++. in AddPreprocessingOptions()
563 addDirectoryList(Args, CmdArgs, "-cxx-isystem", "CPLUS_INCLUDE_PATH"); in AddPreprocessingOptions()
564 // OBJC_INCLUDE_PATH - system includes enabled when compiling ObjC. in AddPreprocessingOptions()
565 addDirectoryList(Args, CmdArgs, "-objc-isystem", "OBJC_INCLUDE_PATH"); in AddPreprocessingOptions()
566 // OBJCPLUS_INCLUDE_PATH - system includes enabled when compiling ObjC++. in AddPreprocessingOptions()
567 addDirectoryList(Args, CmdArgs, "-objcxx-isystem", "OBJCPLUS_INCLUDE_PATH"); in AddPreprocessingOptions()
578 AuxToolChain->AddClangCXXStdlibIncludeArgs(Args, CmdArgs); in AddPreprocessingOptions()
585 AuxToolChain->AddClangCXXStdlibIncludeArgs(Args, CmdArgs); in AddPreprocessingOptions()
646 // True if M-profile.
657 CPU = A->getValue(); in getARMArchCPUFromArgs()
659 Arch = A->getValue(); in getARMArchCPUFromArgs()
665 StringRef Value = A->getValue(); in getARMArchCPUFromArgs()
666 if (Value.startswith("-mcpu=")) in getARMArchCPUFromArgs()
668 if (Value.startswith("-march=")) in getARMArchCPUFromArgs()
673 // Handle -mhwdiv=.
680 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); in getARMHWDivFeatures()
683 // Handle -mfpu=.
689 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); in getARMFPUFeatures()
696 text.split(Split, StringRef("+"), -1, false); in DecodeARMFeatures()
708 // Check if -march is valid by checking if it can be canonicalised and parsed.
709 // getARMArch is used here instead of just checking the -march value in order
710 // to handle -march=native correctly.
720 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); in checkARMArchName()
723 // Check -mcpu=. Needs ArchName to handle -mcpu=generic.
733 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); in checkARMCPUName()
737 // The backend is hardwired to assume AAPCS for M-class processors, ensure in useAAPCSForMachO()
743 // Select the float ABI as determined by -msoft-float, -mhard-float, and
744 // -mfloat-abi=.
753 if (A->getOption().matches(options::OPT_msoft_float)) { in getARMFloatABI()
755 } else if (A->getOption().matches(options::OPT_mhard_float)) { in getARMFloatABI()
758 ABI = llvm::StringSwitch<arm::FloatABI>(A->getValue()) in getARMFloatABI()
763 if (ABI == FloatABI::Invalid && !StringRef(A->getValue()).empty()) { in getARMFloatABI()
764 D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args); in getARMFloatABI()
769 // It is incorrect to select hard float ABI on MachO platforms if the ABI is in getARMFloatABI()
770 // "apcs-gnu". in getARMFloatABI()
773 D.Diag(diag::err_drv_unsupported_opt_for_target) << A->getAsString(Args) in getARMFloatABI()
805 // FreeBSD defaults to soft float in getARMFloatABI()
862 // yet (it uses the -mfloat-abi and -msoft-float options), and it is in getARMTargetFeatures()
864 // -target-option, which is handled by the -cc1/-cc1as invocation. in getARMTargetFeatures()
875 Features.push_back("+soft-float"); in getARMTargetFeatures()
879 Features.push_back("+soft-float-abi"); in getARMTargetFeatures()
881 // Here, we make sure that -Wa,-mfpu/cpu/arch/hwdiv will be passed down in getARMTargetFeatures()
885 StringRef Value = A->getValue(); in getARMTargetFeatures()
886 if (Value.startswith("-mfpu=")) { in getARMTargetFeatures()
888 } else if (Value.startswith("-mcpu=")) { in getARMTargetFeatures()
890 } else if (Value.startswith("-mhwdiv=")) { in getARMTargetFeatures()
892 } else if (Value.startswith("-march=")) { in getARMTargetFeatures()
898 // Check -march. ClangAs gives preference to -Wa,-march=. in getARMTargetFeatures()
904 << ArchArg->getAsString(Args); in getARMTargetFeatures()
905 ArchName = StringRef(WaArch->getValue()).substr(7); in getARMTargetFeatures()
908 D.Diag(clang::diag::warn_drv_unused_argument) << WaArch->getAsString(Args); in getARMTargetFeatures()
910 ArchName = ArchArg->getValue(); in getARMTargetFeatures()
914 // Check -mcpu. ClangAs gives preference to -Wa,-mcpu=. in getARMTargetFeatures()
920 << CPUArg->getAsString(Args); in getARMTargetFeatures()
921 CPUName = StringRef(WaCPU->getValue()).substr(6); in getARMTargetFeatures()
924 CPUName = CPUArg->getValue(); in getARMTargetFeatures()
934 Args.MakeArgString((F.second ? "+" : "-") + F.first())); in getARMTargetFeatures()
937 // Honor -mfpu=. ClangAs gives preference to -Wa,-mfpu=. in getARMTargetFeatures()
942 << FPUArg->getAsString(Args); in getARMTargetFeatures()
943 getARMFPUFeatures(D, WaFPU, Args, StringRef(WaFPU->getValue()).substr(6), in getARMTargetFeatures()
946 getARMFPUFeatures(D, FPUArg, Args, FPUArg->getValue(), Features); in getARMTargetFeatures()
949 // Honor -mhwdiv=. ClangAs gives preference to -Wa,-mhwdiv=. in getARMTargetFeatures()
954 << HDivArg->getAsString(Args); in getARMTargetFeatures()
956 StringRef(WaHDiv->getValue()).substr(8), Features); in getARMTargetFeatures()
958 getARMHWDivFeatures(D, HDivArg, Args, HDivArg->getValue(), Features); in getARMTargetFeatures()
960 // Setting -msoft-float effectively disables NEON because of the GCC in getARMTargetFeatures()
963 Features.push_back("-neon"); in getARMTargetFeatures()
965 Features.push_back("-crypto"); in getARMTargetFeatures()
970 if (A->getOption().matches(options::OPT_mcrc)) in getARMTargetFeatures()
973 Features.push_back("-crc"); in getARMTargetFeatures()
976 // Look for the last occurrence of -mlong-calls or -mno-long-calls. If in getARMTargetFeatures()
978 // decide whether to pass "+long-calls" based on the OS and its version. in getARMTargetFeatures()
981 if (A->getOption().matches(options::OPT_mlong_calls)) in getARMTargetFeatures()
982 Features.push_back("+long-calls"); in getARMTargetFeatures()
985 Features.push_back("+long-calls"); in getARMTargetFeatures()
990 Features.push_back("+strict-align"); in getARMTargetFeatures()
993 if (A->getOption().matches(options::OPT_munaligned_access)) { in getARMTargetFeatures()
1002 Features.push_back("+strict-align"); in getARMTargetFeatures()
1004 // Assume pre-ARMv6 doesn't support unaligned accesses. in getARMTargetFeatures()
1007 // SCTLR.U bit, which is architecture-specific. We assume ARMv6 in getARMTargetFeatures()
1012 // defaults this bit to 0 and handles it as a system-wide (not in getARMTargetFeatures()
1013 // per-process) setting. It is therefore safe to assume that ARMv7+ in getARMTargetFeatures()
1021 Features.push_back("+strict-align"); in getARMTargetFeatures()
1024 Features.push_back("+strict-align"); in getARMTargetFeatures()
1026 Features.push_back("+strict-align"); in getARMTargetFeatures()
1030 // for reserving r9 on ARM though (defined as a platform-specific register in getARMTargetFeatures()
1033 Features.push_back("+reserve-r9"); in getARMTargetFeatures()
1037 Features.push_back("+no-movt"); in getARMTargetFeatures()
1043 // FIXME: Support -meabi. in AddARMTargetArgs()
1047 ABIName = A->getValue(); in AddARMTargetArgs()
1054 ABIName = "apcs-gnu"; in AddARMTargetArgs()
1067 ABIName = "aapcs-linux"; in AddARMTargetArgs()
1075 ABIName = "apcs-gnu"; in AddARMTargetArgs()
1081 CmdArgs.push_back("-target-abi"); in AddARMTargetArgs()
1088 // FIXME: This changes CPP defines, we need -target-soft-float. in AddARMTargetArgs()
1089 CmdArgs.push_back("-msoft-float"); in AddARMTargetArgs()
1090 CmdArgs.push_back("-mfloat-abi"); in AddARMTargetArgs()
1094 CmdArgs.push_back("-mfloat-abi"); in AddARMTargetArgs()
1098 assert(ABI == arm::FloatABI::Hard && "Invalid float abi!"); in AddARMTargetArgs()
1099 CmdArgs.push_back("-mfloat-abi"); in AddARMTargetArgs()
1103 // Forward the -mglobal-merge option for explicit control over the pass. in AddARMTargetArgs()
1106 CmdArgs.push_back("-backend-option"); in AddARMTargetArgs()
1107 if (A->getOption().matches(options::OPT_mno_global_merge)) in AddARMTargetArgs()
1108 CmdArgs.push_back("-arm-global-merge=false"); in AddARMTargetArgs()
1110 CmdArgs.push_back("-arm-global-merge=true"); in AddARMTargetArgs()
1115 CmdArgs.push_back("-no-implicit-float"); in AddARMTargetArgs()
1119 /// getAArch64TargetCPU - Get the (LLVM) name of the AArch64 cpu we are
1124 // If we have -mtune or -mcpu, use that. in getAArch64TargetCPU()
1126 CPU = StringRef(A->getValue()).lower(); in getAArch64TargetCPU()
1128 StringRef Mcpu = A->getValue(); in getAArch64TargetCPU()
1138 // Make sure we pick "cyclone" if -arch is used. in getAArch64TargetCPU()
1154 CmdArgs.push_back("-disable-red-zone"); in AddAArch64TargetArgs()
1158 CmdArgs.push_back("-no-implicit-float"); in AddAArch64TargetArgs()
1162 ABIName = A->getValue(); in AddAArch64TargetArgs()
1168 CmdArgs.push_back("-target-abi"); in AddAArch64TargetArgs()
1173 CmdArgs.push_back("-backend-option"); in AddAArch64TargetArgs()
1174 if (A->getOption().matches(options::OPT_mfix_cortex_a53_835769)) in AddAArch64TargetArgs()
1175 CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1"); in AddAArch64TargetArgs()
1177 CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=0"); in AddAArch64TargetArgs()
1180 CmdArgs.push_back("-backend-option"); in AddAArch64TargetArgs()
1181 CmdArgs.push_back("-aarch64-fix-cortex-a53-835769=1"); in AddAArch64TargetArgs()
1184 // Forward the -mglobal-merge option for explicit control over the pass. in AddAArch64TargetArgs()
1187 CmdArgs.push_back("-backend-option"); in AddAArch64TargetArgs()
1188 if (A->getOption().matches(options::OPT_mno_global_merge)) in AddAArch64TargetArgs()
1189 CmdArgs.push_back("-aarch64-global-merge=false"); in AddAArch64TargetArgs()
1191 CmdArgs.push_back("-aarch64-global-merge=true"); in AddAArch64TargetArgs()
1202 // MIPS32r6 is the default for mips(el)?-img-linux-gnu and MIPS64r6 is the in getMipsCPUAndABI()
1203 // default for mips64(el)?-img-linux-gnu. in getMipsCPUAndABI()
1210 // MIPS64r6 is the default for Android MIPS64 (mips64el-linux-android). in getMipsCPUAndABI()
1216 // MIPS3 is the default for mips64*-unknown-openbsd. in getMipsCPUAndABI()
1221 CPUName = A->getValue(); in getMipsCPUAndABI()
1224 ABIName = A->getValue(); in getMipsCPUAndABI()
1290 // FIXME: Warn on inconsistent use of -march and -mabi. in getMipsCPUAndABI()
1311 // Select the MIPS float ABI as determined by -msoft-float, -mhard-float,
1312 // and -mfloat-abi=.
1318 if (A->getOption().matches(options::OPT_msoft_float)) in getMipsFloatABI()
1320 else if (A->getOption().matches(options::OPT_mhard_float)) in getMipsFloatABI()
1323 ABI = llvm::StringSwitch<mips::FloatABI>(A->getValue()) in getMipsFloatABI()
1327 if (ABI == mips::FloatABI::Invalid && !StringRef(A->getValue()).empty()) { in getMipsFloatABI()
1328 D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args); in getMipsFloatABI()
1351 if (A->getOption().matches(OnOpt)) in AddTargetFeature()
1354 Features.push_back(Args.MakeArgString("-" + FeatureName)); in AddTargetFeature()
1371 // FIXME: Note, this is a hack. We need to pass the selected float in getMIPSTargetFeatures()
1374 Features.push_back("+soft-float"); in getMIPSTargetFeatures()
1378 StringRef Val = StringRef(A->getValue()); in getMIPSTargetFeatures()
1383 Features.push_back("-nan2008"); in getMIPSTargetFeatures()
1388 Features.push_back("-nan2008"); in getMIPSTargetFeatures()
1395 << A->getOption().getName() << Val; in getMIPSTargetFeatures()
1399 options::OPT_mdouble_float, "single-float"); in getMIPSTargetFeatures()
1411 // Add the last -mfp32/-mfpxx/-mfp64, if none are given and the ABI is O32 in getMIPSTargetFeatures()
1412 // pass -mfpxx, or if none are given and fp64a is default, pass fp64 and in getMIPSTargetFeatures()
1416 if (A->getOption().matches(options::OPT_mfp32)) in getMIPSTargetFeatures()
1417 Features.push_back(Args.MakeArgString("-fp64")); in getMIPSTargetFeatures()
1418 else if (A->getOption().matches(options::OPT_mfpxx)) { in getMIPSTargetFeatures()
1443 CmdArgs.push_back("-target-abi"); in AddMIPSTargetArgs()
1449 CmdArgs.push_back("-msoft-float"); in AddMIPSTargetArgs()
1450 CmdArgs.push_back("-mfloat-abi"); in AddMIPSTargetArgs()
1454 assert(ABI == mips::FloatABI::Hard && "Invalid float abi!"); in AddMIPSTargetArgs()
1455 CmdArgs.push_back("-mfloat-abi"); in AddMIPSTargetArgs()
1460 if (A->getOption().matches(options::OPT_mxgot)) { in AddMIPSTargetArgs()
1461 CmdArgs.push_back("-mllvm"); in AddMIPSTargetArgs()
1462 CmdArgs.push_back("-mxgot"); in AddMIPSTargetArgs()
1468 if (A->getOption().matches(options::OPT_mno_ldc1_sdc1)) { in AddMIPSTargetArgs()
1469 CmdArgs.push_back("-mllvm"); in AddMIPSTargetArgs()
1470 CmdArgs.push_back("-mno-ldc1-sdc1"); in AddMIPSTargetArgs()
1476 if (A->getOption().matches(options::OPT_mno_check_zero_division)) { in AddMIPSTargetArgs()
1477 CmdArgs.push_back("-mllvm"); in AddMIPSTargetArgs()
1478 CmdArgs.push_back("-mno-check-zero-division"); in AddMIPSTargetArgs()
1483 StringRef v = A->getValue(); in AddMIPSTargetArgs()
1484 CmdArgs.push_back("-mllvm"); in AddMIPSTargetArgs()
1485 CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v)); in AddMIPSTargetArgs()
1486 A->claim(); in AddMIPSTargetArgs()
1490 StringRef Val = StringRef(A->getValue()); in AddMIPSTargetArgs()
1493 CmdArgs.push_back("-mllvm"); in AddMIPSTargetArgs()
1494 CmdArgs.push_back(Args.MakeArgString("-mips-compact-branches=" + Val)); in AddMIPSTargetArgs()
1497 << A->getOption().getName() << Val; in AddMIPSTargetArgs()
1503 /// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting.
1506 StringRef CPUName = A->getValue(); in getPPCTargetCPU()
1578 Features.push_back("+soft-float"); in getPPCTargetFeatures()
1583 << "soft float is not supported for ppc64"; in getPPCTargetFeatures()
1595 if (A->getOption().matches(options::OPT_msoft_float)) in getPPCFloatABI()
1597 else if (A->getOption().matches(options::OPT_mhard_float)) in getPPCFloatABI()
1600 ABI = llvm::StringSwitch<ppc::FloatABI>(A->getValue()) in getPPCFloatABI()
1604 if (ABI == ppc::FloatABI::Invalid && !StringRef(A->getValue()).empty()) { in getPPCFloatABI()
1605 D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args); in getPPCFloatABI()
1631 HasQPX = A->getValue() == StringRef("a2q"); in AddPPCTargetArgs()
1634 ABIName = "elfv1-qpx"; in AddPPCTargetArgs()
1652 if (StringRef(A->getValue()) != "altivec") in AddPPCTargetArgs()
1653 ABIName = A->getValue(); in AddPPCTargetArgs()
1660 CmdArgs.push_back("-msoft-float"); in AddPPCTargetArgs()
1661 CmdArgs.push_back("-mfloat-abi"); in AddPPCTargetArgs()
1665 assert(FloatABI == ppc::FloatABI::Hard && "Invalid float abi!"); in AddPPCTargetArgs()
1666 CmdArgs.push_back("-mfloat-abi"); in AddPPCTargetArgs()
1671 CmdArgs.push_back("-target-abi"); in AddPPCTargetArgs()
1678 return A && (A->getValue() == StringRef(Value)); in hasPPCAbiArg()
1684 const char *GPUName = A->getValue(); in getR600TargetGPU()
1700 return A->getValue(); in getLanaiTargetCPU()
1711 if (A->getOption().matches(options::OPT_msoft_float)) in getSparcFloatABI()
1713 else if (A->getOption().matches(options::OPT_mhard_float)) in getSparcFloatABI()
1716 ABI = llvm::StringSwitch<sparc::FloatABI>(A->getValue()) in getSparcFloatABI()
1721 !StringRef(A->getValue()).empty()) { in getSparcFloatABI()
1722 D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args); in getSparcFloatABI()
1729 // Only the hard-float ABI on Sparc is standardized, and it is the in getSparcFloatABI()
1730 // default. GCC also supports a nonstandard soft-float ABI mode, also in getSparcFloatABI()
1732 // to be hard-float. in getSparcFloatABI()
1744 Features.push_back("+soft-float"); in getSparcTargetFeatures()
1754 CmdArgs.push_back("-msoft-float"); in AddSparcTargetArgs()
1755 CmdArgs.push_back("-mfloat-abi"); in AddSparcTargetArgs()
1759 assert(FloatABI == sparc::FloatABI::Hard && "Invalid float abi!"); in AddSparcTargetArgs()
1760 CmdArgs.push_back("-mfloat-abi"); in AddSparcTargetArgs()
1768 CmdArgs.push_back("-mbackchain"); in AddSystemZTargetArgs()
1773 return A->getValue(); in getSystemZTargetCPU()
1779 // -m(no-)htm overrides use of the transactional-execution facility. in getSystemZTargetFeatures()
1781 if (A->getOption().matches(options::OPT_mhtm)) in getSystemZTargetFeatures()
1782 Features.push_back("+transactional-execution"); in getSystemZTargetFeatures()
1784 Features.push_back("-transactional-execution"); in getSystemZTargetFeatures()
1786 // -m(no-)vx overrides use of the vector facility. in getSystemZTargetFeatures()
1788 if (A->getOption().matches(options::OPT_mvx)) in getSystemZTargetFeatures()
1791 Features.push_back("-vector"); in getSystemZTargetFeatures()
1798 if (StringRef(A->getValue()) != "native") { in getX86TargetCPU()
1800 return "core-avx2"; in getX86TargetCPU()
1802 return A->getValue(); in getX86TargetCPU()
1805 // FIXME: Reject attempts to use -march=native unless the target matches in getX86TargetCPU()
1809 // with -native. in getX86TargetCPU()
1817 StringRef Arch = A->getValue(); in getX86TargetCPU()
1848 return "core-avx2"; in getX86TargetCPU()
1858 return Is64Bit ? "x86-64" : "i686"; in getX86TargetCPU()
1860 // Everything else goes to x86-64 in 64-bit mode. in getX86TargetCPU()
1862 return "x86-64"; in getX86TargetCPU()
1881 // If we have -mcpu=, use that. in getWebAssemblyTargetCPU()
1883 StringRef CPU = A->getValue(); in getWebAssemblyTargetCPU()
1929 return A->getValue(); in getCPUName()
1954 return A->getValue(); in getCPUName()
1984 // as gold requires -plugin to come before any -plugin-opt that -Wl might in AddGoldPlugin()
1986 CmdArgs.push_back("-plugin"); in AddGoldPlugin()
1997 CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=mcpu=") + CPU)); in AddGoldPlugin()
2001 if (A->getOption().matches(options::OPT_O4) || in AddGoldPlugin()
2002 A->getOption().matches(options::OPT_Ofast)) in AddGoldPlugin()
2004 else if (A->getOption().matches(options::OPT_O)) in AddGoldPlugin()
2005 OOpt = A->getValue(); in AddGoldPlugin()
2006 else if (A->getOption().matches(options::OPT_O0)) in AddGoldPlugin()
2009 CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=O") + OOpt)); in AddGoldPlugin()
2013 CmdArgs.push_back("-plugin-opt=thinlto"); in AddGoldPlugin()
2018 if (A->getOption().matches(options::OPT_glldb)) in AddGoldPlugin()
2019 CmdArgs.push_back("-plugin-opt=-debugger-tune=lldb"); in AddGoldPlugin()
2020 else if (A->getOption().matches(options::OPT_gsce)) in AddGoldPlugin()
2021 CmdArgs.push_back("-plugin-opt=-debugger-tune=sce"); in AddGoldPlugin()
2023 CmdArgs.push_back("-plugin-opt=-debugger-tune=gdb"); in AddGoldPlugin()
2039 // step parameter. This is reasonable for all currently-supported in getRefinementStep()
2042 // under-perform the native operation. Also, if the estimate does not in getRefinementStep()
2058 /// The -mrecip flag requires processing of many optional parameters.
2064 StringRef Out = "-mrecip="; in ParseMRecip()
2070 unsigned NumOptions = A->getNumValues(); in ParseMRecip()
2079 StringRef Val = A->getValue(0); in ParseMRecip()
2097 OptionStrings.insert(std::make_pair("vec-divd", false)); in ParseMRecip()
2098 OptionStrings.insert(std::make_pair("vec-divf", false)); in ParseMRecip()
2101 OptionStrings.insert(std::make_pair("vec-sqrtd", false)); in ParseMRecip()
2102 OptionStrings.insert(std::make_pair("vec-sqrtf", false)); in ParseMRecip()
2105 StringRef Val = A->getValue(i); in ParseMRecip()
2119 // Try again specifying float suffix. in ParseMRecip()
2126 // The option was specified without a float or double suffix. in ParseMRecip()
2128 // The float entry will be checked below. in ParseMRecip()
2130 D.Diag(diag::err_drv_invalid_value) << A->getOption().getName() << Val; in ParseMRecip()
2135 if (OptionIter->second == true) { in ParseMRecip()
2137 D.Diag(diag::err_drv_invalid_value) << A->getOption().getName() << Val; in ParseMRecip()
2142 OptionIter->second = true; in ParseMRecip()
2151 if (i != NumOptions - 1) in ParseMRecip()
2161 // If -march=native, autodetect the feature list. in getX86TargetFeatures()
2163 if (StringRef(A->getValue()) == "native") { in getX86TargetFeatures()
2168 Args.MakeArgString((F.second ? "+" : "-") + F.first())); in getX86TargetFeatures()
2174 // for Haswell class CPUs, but not all of them. Opt-out of a few. in getX86TargetFeatures()
2175 Features.push_back("-rdrnd"); in getX86TargetFeatures()
2176 Features.push_back("-aes"); in getX86TargetFeatures()
2177 Features.push_back("-pclmul"); in getX86TargetFeatures()
2178 Features.push_back("-rtm"); in getX86TargetFeatures()
2179 Features.push_back("-hle"); in getX86TargetFeatures()
2180 Features.push_back("-fsgsbase"); in getX86TargetFeatures()
2193 // Set features according to the -arch flag on MSVC. in getX86TargetFeatures()
2195 StringRef Arch = A->getValue(); in getX86TargetFeatures()
2197 // First, look for flags that are shared in x86 and x86-64. in getX86TargetFeatures()
2204 // Then, look for x86-specific flags. in getX86TargetFeatures()
2214 D.Diag(clang::diag::warn_drv_unused_argument) << A->getAsString(Args); in getX86TargetFeatures()
2227 CmdArgs.push_back("-disable-red-zone"); in AddX86TargetArgs()
2229 // Default to avoid implicit floating-point for kernel/kext code, but allow in AddX86TargetArgs()
2230 // that to be overridden with -mno-soft-float. in AddX86TargetArgs()
2236 const Option &O = A->getOption(); in AddX86TargetArgs()
2241 CmdArgs.push_back("-no-implicit-float"); in AddX86TargetArgs()
2244 StringRef Value = A->getValue(); in AddX86TargetArgs()
2246 CmdArgs.push_back("-mllvm"); in AddX86TargetArgs()
2247 CmdArgs.push_back(Args.MakeArgString("-x86-asm-syntax=" + Value)); in AddX86TargetArgs()
2250 << A->getOption().getName() << Value; in AddX86TargetArgs()
2256 CmdArgs.push_back("-mfloat-abi"); in AddX86TargetArgs()
2258 CmdArgs.push_back("-mstack-alignment=4"); in AddX86TargetArgs()
2264 CmdArgs.push_back("-mqdsp6-compat"); in AddHexagonTargetArgs()
2265 CmdArgs.push_back("-Wreturn-type"); in AddHexagonTargetArgs()
2269 std::string Opt = std::string("-hexagon-small-data-threshold=") + N; in AddHexagonTargetArgs()
2270 CmdArgs.push_back("-mllvm"); in AddHexagonTargetArgs()
2275 CmdArgs.push_back("-fshort-enums"); in AddHexagonTargetArgs()
2277 CmdArgs.push_back("-mllvm"); in AddHexagonTargetArgs()
2278 CmdArgs.push_back("-enable-hexagon-ieee-rnd-near"); in AddHexagonTargetArgs()
2280 CmdArgs.push_back("-mllvm"); in AddHexagonTargetArgs()
2281 CmdArgs.push_back("-machine-sink-split=0"); in AddHexagonTargetArgs()
2287 StringRef CPUName = A->getValue(); in AddLanaiTargetArgs()
2289 CmdArgs.push_back("-target-cpu"); in AddLanaiTargetArgs()
2293 StringRef Value = A->getValue(); in AddLanaiTargetArgs()
2301 << A->getOption().getName() << Value; in AddLanaiTargetArgs()
2312 CmdArgs.push_back("-fvisibility"); in AddWebAssemblyTargetArgs()
2321 text.split(Split, StringRef("+"), -1, false); in DecodeAArch64Features()
2325 .Case("fp", "+fp-armv8") in DecodeAArch64Features()
2332 .Case("nofp", "-fp-armv8") in DecodeAArch64Features()
2333 .Case("nosimd", "-neon") in DecodeAArch64Features()
2334 .Case("nocrc", "-crc") in DecodeAArch64Features()
2335 .Case("nocrypto", "-crypto") in DecodeAArch64Features()
2336 .Case("nofp16", "-fullfp16") in DecodeAArch64Features()
2337 .Case("noprofile", "-spe") in DecodeAArch64Features()
2338 .Case("noras", "-ras") in DecodeAArch64Features()
2350 // Check if the CPU name and feature modifiers in -mcpu are legal. If yes,
2356 if (CPU == "cortex-a53" || CPU == "cortex-a57" || in DecodeAArch64Mcpu()
2357 CPU == "cortex-a72" || CPU == "cortex-a35" || CPU == "exynos-m1" || in DecodeAArch64Mcpu()
2358 CPU == "kryo" || CPU == "cortex-a73" || CPU == "vulcan") { in DecodeAArch64Mcpu()
2384 if (Split.first == "armv8-a" || Split.first == "armv8a") { in getAArch64ArchFeaturesFromMarch()
2386 } else if (Split.first == "armv8.1-a" || Split.first == "armv8.1a") { in getAArch64ArchFeaturesFromMarch()
2388 } else if (Split.first == "armv8.2-a" || Split.first == "armv8.2a" ) { in getAArch64ArchFeaturesFromMarch()
2447 success = getAArch64ArchFeaturesFromMarch(D, A->getValue(), Args, Features); in getAArch64TargetFeatures()
2449 success = getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Features); in getAArch64TargetFeatures()
2456 getAArch64MicroArchFeaturesFromMtune(D, A->getValue(), Args, Features); in getAArch64TargetFeatures()
2459 getAArch64MicroArchFeaturesFromMcpu(D, A->getValue(), Args, Features); in getAArch64TargetFeatures()
2465 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); in getAArch64TargetFeatures()
2468 Features.push_back("-fp-armv8"); in getAArch64TargetFeatures()
2469 Features.push_back("-crypto"); in getAArch64TargetFeatures()
2470 Features.push_back("-neon"); in getAArch64TargetFeatures()
2475 if (A->getOption().matches(options::OPT_mcrc)) in getAArch64TargetFeatures()
2478 Features.push_back("-crc"); in getAArch64TargetFeatures()
2483 if (A->getOption().matches(options::OPT_mno_unaligned_access)) in getAArch64TargetFeatures()
2484 Features.push_back("+strict-align"); in getAArch64TargetFeatures()
2487 Features.push_back("+reserve-x18"); in getAArch64TargetFeatures()
2498 auto &Opt = A->getOption(); in getHexagonTargetFeatures()
2509 A->claim(); in getHexagonTargetFeatures()
2512 Features.push_back(HasHVX ? "+hvx" : "-hvx"); in getHexagonTargetFeatures()
2513 Features.push_back(HasHVXD ? "+hvx-double" : "-hvx-double"); in getHexagonTargetFeatures()
2524 StringRef value = dAbi->getValue(); in getAMDGPUTargetFeatures()
2526 Features.push_back("+amdgpu-debugger-insert-nops"); in getAMDGPUTargetFeatures()
2527 Features.push_back("+amdgpu-debugger-reserve-regs"); in getAMDGPUTargetFeatures()
2528 Features.push_back("+amdgpu-debugger-emit-prologue"); in getAMDGPUTargetFeatures()
2530 D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args); in getAMDGPUTargetFeatures()
2598 assert(Name[0] == '-' || Name[0] == '+'); in getTargetFeatures()
2607 unsigned Last = LastI->second; in getTargetFeatures()
2611 CmdArgs.push_back("-target-feature"); in getTargetFeatures()
2619 // We use the zero-cost exception tables for Objective-C if the non-fragile in shouldUseExceptionTablesForObjCExceptions()
2634 /// master flag, -fexceptions and also language specific flags to enable/disable
2635 /// C++ and Objective-C exceptions. This makes it possible to for example
2636 /// disable C++ exceptions but enable Objective-C exceptions.
2645 // -mkernel and -fapple-kext imply no exceptions, so claim exception related in addExceptionArgs()
2660 // Obj-C exceptions are enabled by default, regardless of -fexceptions. This in addExceptionArgs()
2665 CmdArgs.push_back("-fobjc-exceptions"); in addExceptionArgs()
2679 ExceptionArg->getOption().matches(options::OPT_fcxx_exceptions) || in addExceptionArgs()
2680 ExceptionArg->getOption().matches(options::OPT_fexceptions); in addExceptionArgs()
2692 << RTTIArg->getAsString(Args) << ExceptionArg->getAsString(Args); in addExceptionArgs()
2698 CmdArgs.push_back("-fcxx-exceptions"); in addExceptionArgs()
2705 CmdArgs.push_back("-fexceptions"); in addExceptionArgs()
2732 for (const auto &AI : A->inputs()) in ContainsCompileAction()
2739 /// \brief Check if -relax-all should be passed to the internal assembler.
2740 /// This is done by default when compiling non-assembler source with -O0.
2745 RelaxDefault = A->getOption().matches(options::OPT_O0); in UseRelaxAll()
2761 // Convert an arg of the form "-gN" or "-ggdbN" or one of their aliases
2765 "Not a -g option that specifies a debug-info level"); in DebugLevelToInfoKind()
2775 // Extract the integer N from a string spelled "-dwarf-N", returning 0
2777 // for use by the "-Xassembler" option parser.
2780 .Case("-gdwarf-2", 2) in DwarfVersionNum()
2781 .Case("-gdwarf-3", 3) in DwarfVersionNum()
2782 .Case("-gdwarf-4", 4) in DwarfVersionNum()
2783 .Case("-gdwarf-5", 5) in DwarfVersionNum()
2793 CmdArgs.push_back("-debug-info-kind=line-tables-only"); in RenderDebugEnablingArgs()
2796 CmdArgs.push_back("-debug-info-kind=limited"); in RenderDebugEnablingArgs()
2799 CmdArgs.push_back("-debug-info-kind=standalone"); in RenderDebugEnablingArgs()
2806 Args.MakeArgString("-dwarf-version=" + Twine(DwarfVersion))); in RenderDebugEnablingArgs()
2809 CmdArgs.push_back("-debugger-tuning=gdb"); in RenderDebugEnablingArgs()
2812 CmdArgs.push_back("-debugger-tuning=lldb"); in RenderDebugEnablingArgs()
2815 CmdArgs.push_back("-debugger-tuning=sce"); in RenderDebugEnablingArgs()
2827 CmdArgs.push_back("-mrelax-all"); in CollectArgsForIntegratedAssembler()
2829 // Only default to -mincremental-linker-compatible if we think we are in CollectArgsForIntegratedAssembler()
2836 CmdArgs.push_back("-mincremental-linker-compatible"); in CollectArgsForIntegratedAssembler()
2838 // When passing -I arguments to the assembler we sometimes need to in CollectArgsForIntegratedAssembler()
2840 // '-Wa,-I -Wa,foo' we need to accept the -Wa,foo arg after seeing the in CollectArgsForIntegratedAssembler()
2841 // -Wa,-I arg and when parsing '-Wa,-I,foo' we need to accept the 'foo' in CollectArgsForIntegratedAssembler()
2842 // arg after parsing the '-I' arg. in CollectArgsForIntegratedAssembler()
2845 // When using an integrated assembler, translate -Wa, and -Xassembler in CollectArgsForIntegratedAssembler()
2853 A->claim(); in CollectArgsForIntegratedAssembler()
2855 for (StringRef Value : A->getValues()) { in CollectArgsForIntegratedAssembler()
2869 if (Value == "--trap") { in CollectArgsForIntegratedAssembler()
2870 CmdArgs.push_back("-target-feature"); in CollectArgsForIntegratedAssembler()
2871 CmdArgs.push_back("+use-tcc-in-div"); in CollectArgsForIntegratedAssembler()
2874 if (Value == "--break") { in CollectArgsForIntegratedAssembler()
2875 CmdArgs.push_back("-target-feature"); in CollectArgsForIntegratedAssembler()
2876 CmdArgs.push_back("-use-tcc-in-div"); in CollectArgsForIntegratedAssembler()
2879 if (Value.startswith("-msoft-float")) { in CollectArgsForIntegratedAssembler()
2880 CmdArgs.push_back("-target-feature"); in CollectArgsForIntegratedAssembler()
2881 CmdArgs.push_back("+soft-float"); in CollectArgsForIntegratedAssembler()
2884 if (Value.startswith("-mhard-float")) { in CollectArgsForIntegratedAssembler()
2885 CmdArgs.push_back("-target-feature"); in CollectArgsForIntegratedAssembler()
2886 CmdArgs.push_back("-soft-float"); in CollectArgsForIntegratedAssembler()
2891 .Case("-mips1", "+mips1") in CollectArgsForIntegratedAssembler()
2892 .Case("-mips2", "+mips2") in CollectArgsForIntegratedAssembler()
2893 .Case("-mips3", "+mips3") in CollectArgsForIntegratedAssembler()
2894 .Case("-mips4", "+mips4") in CollectArgsForIntegratedAssembler()
2895 .Case("-mips5", "+mips5") in CollectArgsForIntegratedAssembler()
2896 .Case("-mips32", "+mips32") in CollectArgsForIntegratedAssembler()
2897 .Case("-mips32r2", "+mips32r2") in CollectArgsForIntegratedAssembler()
2898 .Case("-mips32r3", "+mips32r3") in CollectArgsForIntegratedAssembler()
2899 .Case("-mips32r5", "+mips32r5") in CollectArgsForIntegratedAssembler()
2900 .Case("-mips32r6", "+mips32r6") in CollectArgsForIntegratedAssembler()
2901 .Case("-mips64", "+mips64") in CollectArgsForIntegratedAssembler()
2902 .Case("-mips64r2", "+mips64r2") in CollectArgsForIntegratedAssembler()
2903 .Case("-mips64r3", "+mips64r3") in CollectArgsForIntegratedAssembler()
2904 .Case("-mips64r5", "+mips64r5") in CollectArgsForIntegratedAssembler()
2905 .Case("-mips64r6", "+mips64r6") in CollectArgsForIntegratedAssembler()
2911 if (Value == "-force_cpusubtype_ALL") { in CollectArgsForIntegratedAssembler()
2913 } else if (Value == "-L") { in CollectArgsForIntegratedAssembler()
2914 CmdArgs.push_back("-msave-temp-labels"); in CollectArgsForIntegratedAssembler()
2915 } else if (Value == "--fatal-warnings") { in CollectArgsForIntegratedAssembler()
2916 CmdArgs.push_back("-massembler-fatal-warnings"); in CollectArgsForIntegratedAssembler()
2917 } else if (Value == "--noexecstack") { in CollectArgsForIntegratedAssembler()
2918 CmdArgs.push_back("-mnoexecstack"); in CollectArgsForIntegratedAssembler()
2919 } else if (Value == "-compress-debug-sections" || in CollectArgsForIntegratedAssembler()
2920 Value == "--compress-debug-sections") { in CollectArgsForIntegratedAssembler()
2922 } else if (Value == "-nocompress-debug-sections" || in CollectArgsForIntegratedAssembler()
2923 Value == "--nocompress-debug-sections") { in CollectArgsForIntegratedAssembler()
2925 } else if (Value == "-mrelax-relocations=yes" || in CollectArgsForIntegratedAssembler()
2926 Value == "--mrelax-relocations=yes") { in CollectArgsForIntegratedAssembler()
2928 } else if (Value == "-mrelax-relocations=no" || in CollectArgsForIntegratedAssembler()
2929 Value == "--mrelax-relocations=no") { in CollectArgsForIntegratedAssembler()
2931 } else if (Value.startswith("-I")) { in CollectArgsForIntegratedAssembler()
2934 // -I. The next arg will be the include directory. in CollectArgsForIntegratedAssembler()
2935 if (Value == "-I") in CollectArgsForIntegratedAssembler()
2937 } else if (Value.startswith("-gdwarf-")) { in CollectArgsForIntegratedAssembler()
2938 // "-gdwarf-N" options are not cc1as options. in CollectArgsForIntegratedAssembler()
2947 } else if (Value.startswith("-mcpu") || Value.startswith("-mfpu") || in CollectArgsForIntegratedAssembler()
2948 Value.startswith("-mhwdiv") || Value.startswith("-march")) { in CollectArgsForIntegratedAssembler()
2952 << A->getOption().getName() << Value; in CollectArgsForIntegratedAssembler()
2958 CmdArgs.push_back("-compress-debug-sections"); in CollectArgsForIntegratedAssembler()
2963 CmdArgs.push_back("--mrelax-relocations"); in CollectArgsForIntegratedAssembler()
2965 CmdArgs.push_back("-target-feature"); in CollectArgsForIntegratedAssembler()
2970 // This adds the static libclang_rt.builtins-arch.a directly to the command line
3007 RuntimeName = A->getValue(); in getOpenMPRuntime()
3018 << A->getOption().getName() << A->getValue(); in getOpenMPRuntime()
3021 TC.getDriver().Diag(diag::err_drv_unsupported_opt) << "-fopenmp"; in getOpenMPRuntime()
3035 CmdArgs.push_back("-lomp"); in addOpenMPRuntime()
3038 CmdArgs.push_back("-lgomp"); in addOpenMPRuntime()
3041 CmdArgs.push_back("-liomp5"); in addOpenMPRuntime()
3053 // whole-archive. in addSanitizerRuntime()
3054 if (IsWhole) CmdArgs.push_back("-whole-archive"); in addSanitizerRuntime()
3056 if (IsWhole) CmdArgs.push_back("-no-whole-archive"); in addSanitizerRuntime()
3066 CmdArgs.push_back(Args.MakeArgString("--dynamic-list=" + SanRT + ".syms")); in addSanitizerDynamicList()
3076 CmdArgs.push_back("--no-as-needed"); in linkSanitizerRuntimeDeps()
3077 CmdArgs.push_back("-lpthread"); in linkSanitizerRuntimeDeps()
3078 CmdArgs.push_back("-lrt"); in linkSanitizerRuntimeDeps()
3079 CmdArgs.push_back("-lm"); in linkSanitizerRuntimeDeps()
3082 CmdArgs.push_back("-ldl"); in linkSanitizerRuntimeDeps()
3108 HelperStaticRuntimes.push_back("asan-preinit"); in collectSanitizerRuntimes()
3174 CmdArgs.push_back("-u"); in addSanitizerRuntimes()
3180 CmdArgs.push_back("-export-dynamic"); in addSanitizerRuntimes()
3188 CmdArgs.push_back("-whole-archive"); in addXRayRuntime()
3190 CmdArgs.push_back("-no-whole-archive"); in addXRayRuntime()
3198 CmdArgs.push_back("--no-as-needed"); in linkXRayRuntimeDeps()
3199 CmdArgs.push_back("-lpthread"); in linkXRayRuntimeDeps()
3200 CmdArgs.push_back("-lrt"); in linkXRayRuntimeDeps()
3201 CmdArgs.push_back("-lm"); in linkXRayRuntimeDeps()
3202 CmdArgs.push_back("-latomic"); in linkXRayRuntimeDeps()
3204 CmdArgs.push_back("-lc++"); in linkXRayRuntimeDeps()
3206 CmdArgs.push_back("-lstdc++"); in linkXRayRuntimeDeps()
3208 CmdArgs.push_back("-ldl"); in linkXRayRuntimeDeps()
3212 // Find the last -O arg and see if it is non-zero. in areOptimizationsEnabled()
3214 return !A->getOption().matches(options::OPT_O0); in areOptimizationsEnabled()
3215 // Defaults to -O0. in areOptimizationsEnabled()
3272 return A->getOption().matches(options::OPT_fno_omit_frame_pointer); in shouldUseFramePointer()
3283 return A->getOption().matches(options::OPT_mno_omit_leaf_frame_pointer); in shouldUseLeafFramePointer()
3297 CmdArgs.push_back("-fdebug-compilation-dir"); in addDebugCompDirArg()
3305 SmallString<128> T(FinalOutput->getValue()); in SplitDebugName()
3323 ExtractArgs.push_back("--extract-dwo"); in SplitDebugInfo()
3326 StripArgs.push_back("--strip-dwo"); in SplitDebugInfo()
3343 /// \brief Vectorize at all optimization levels greater than 1 except for -Oz.
3344 /// For -Oz the loop vectorizer is disable, while the slp vectorizer is enabled.
3347 if (A->getOption().matches(options::OPT_O4) || in shouldEnableVectorizerAtOLevel()
3348 A->getOption().matches(options::OPT_Ofast)) in shouldEnableVectorizerAtOLevel()
3351 if (A->getOption().matches(options::OPT_O0)) in shouldEnableVectorizerAtOLevel()
3354 assert(A->getOption().matches(options::OPT_O) && "Must have a -O flag"); in shouldEnableVectorizerAtOLevel()
3356 // Vectorize -Os. in shouldEnableVectorizerAtOLevel()
3357 StringRef S(A->getValue()); in shouldEnableVectorizerAtOLevel()
3361 // Don't vectorize -Oz, unless it's the slp vectorizer. in shouldEnableVectorizerAtOLevel()
3375 /// Add -x lang to \p CmdArgs for \p Input.
3378 // When using -verify-pch, we don't want to provide the type in addDashXForInput()
3379 // 'precompiled-header' if it was inferred from the file extension in addDashXForInput()
3383 CmdArgs.push_back("-x"); in addDashXForInput()
3407 // Don't warn about unused -f(no-)?lto. This can happen when we're in claimNoWarnArgs()
3460 D->Diag(diag::err_drv_argument_not_allowed_with) in getMSVCVersion()
3461 << MSCVersion->getAsString(Args) in getMSVCVersion()
3462 << MSCompatibilityVersion->getAsString(Args); in getMSVCVersion()
3468 if (MSVT.tryParse(MSCompatibilityVersion->getValue()) && D) in getMSVCVersion()
3469 D->Diag(diag::err_drv_invalid_value) in getMSVCVersion()
3470 << MSCompatibilityVersion->getAsString(Args) in getMSVCVersion()
3471 << MSCompatibilityVersion->getValue(); in getMSVCVersion()
3477 if (StringRef(MSCVersion->getValue()).getAsInteger(10, Version) && D) in getMSVCVersion()
3478 D->Diag(diag::err_drv_invalid_value) << MSCVersion->getAsString(Args) in getMSVCVersion()
3479 << MSCVersion->getValue(); in getMSVCVersion()
3509 ProfileGenerateArg->getOption().matches( in addPGOAndCoverageFlags()
3518 ProfileUseArg->getOption().matches(options::OPT_fno_profile_instr_use)) in addPGOAndCoverageFlags()
3523 << ProfileGenerateArg->getSpelling() << ProfileUseArg->getSpelling(); in addPGOAndCoverageFlags()
3526 if (ProfileGenerateArg->getOption().matches( in addPGOAndCoverageFlags()
3528 CmdArgs.push_back(Args.MakeArgString(Twine("-fprofile-instrument-path=") + in addPGOAndCoverageFlags()
3529 ProfileGenerateArg->getValue())); in addPGOAndCoverageFlags()
3530 else if (ProfileGenerateArg->getOption().matches( in addPGOAndCoverageFlags()
3532 SmallString<128> Path(ProfileGenerateArg->getValue()); in addPGOAndCoverageFlags()
3535 Args.MakeArgString(Twine("-fprofile-instrument-path=") + Path)); in addPGOAndCoverageFlags()
3538 CmdArgs.push_back("-fprofile-instrument=clang"); in addPGOAndCoverageFlags()
3542 if (ProfileUseArg->getOption().matches(options::OPT_fprofile_instr_use_EQ)) in addPGOAndCoverageFlags()
3544 Twine("-fprofile-instrument-use-path=") + ProfileUseArg->getValue())); in addPGOAndCoverageFlags()
3545 else if ((ProfileUseArg->getOption().matches( in addPGOAndCoverageFlags()
3547 ProfileUseArg->getOption().matches( in addPGOAndCoverageFlags()
3550 ProfileUseArg->getNumValues() == 0 ? "" : ProfileUseArg->getValue()); in addPGOAndCoverageFlags()
3554 Args.MakeArgString(Twine("-fprofile-instrument-use-path=") + Path)); in addPGOAndCoverageFlags()
3560 CmdArgs.push_back("-femit-coverage-notes"); in addPGOAndCoverageFlags()
3564 CmdArgs.push_back("-femit-coverage-data"); in addPGOAndCoverageFlags()
3570 << "-fcoverage-mapping" in addPGOAndCoverageFlags()
3571 << "-fprofile-instr-generate"; in addPGOAndCoverageFlags()
3575 CmdArgs.push_back("-fcoverage-mapping"); in addPGOAndCoverageFlags()
3580 CmdArgs.push_back("-coverage-file"); in addPGOAndCoverageFlags()
3583 CoverageFilename = FinalOutput->getValue(); in addPGOAndCoverageFlags()
3613 CmdArgs.push_back("--dependent-lib=libclang_rt.profile-x86_64.a"); in addPS4ProfileRTArgs()
3616 /// Parses the various -fpic/-fPIC/-fpie/-fPIE arguments. Then,
3627 // The Darwin/MachO default to use PIC does not apply when using -static. in ParsePICArgs()
3636 // Android-specific defaults for PIC/PIE in ParsePICArgs()
3648 PIC = true; // "-fpic" in ParsePICArgs()
3653 PIC = true; // "-fPIC" in ParsePICArgs()
3662 // OpenBSD-specific defaults for PIE in ParsePICArgs()
3670 IsPICLevelTwo = false; // "-fpie" in ParsePICArgs()
3676 IsPICLevelTwo = true; // "-fPIE" in ParsePICArgs()
3686 // '-fno-...' arguments, both PIC and PIE are disabled. Any PIE in ParsePICArgs()
3692 // Check whether the tool chain trumps the PIC-ness decision. If the PIC-ness in ParsePICArgs()
3696 Option O = LastPICArg->getOption(); in ParsePICArgs()
3708 StringRef Model = ModelArg ? ModelArg->getValue() : ""; in ParsePICArgs()
3712 << LastPICArg->getSpelling(); in ParsePICArgs()
3719 // Introduce a Darwin and PS4-specific hack. If the default is PIC, but the in ParsePICArgs()
3725 // This kernel flags are a trump-card: they will disable PIC/PIE in ParsePICArgs()
3736 << A->getSpelling() << ToolChain.getTriple().str(); in ParsePICArgs()
3742 // match that of llvm-gcc and Apple GCC before that. in ParsePICArgs()
3761 return "dynamic-no-pic"; in RelocationModelName()
3775 CmdArgs.push_back("-KPIC"); in AddAssemblerKPIC()
3800 // device-side compilations). All other jobs are expected to have exactly one in ConstructJob()
3809 // Invoke ourselves in -cc1 mode. in ConstructJob()
3812 CmdArgs.push_back("-cc1"); in ConstructJob()
3815 CmdArgs.push_back("-triple"); in ConstructJob()
3831 CmdArgs.push_back("-aux-triple"); in ConstructJob()
3832 CmdArgs.push_back(Args.MakeArgString(AuxToolChain->getTriple().str())); in ConstructJob()
3855 CmdArgs.push_back("-analyze"); in ConstructJob()
3857 CmdArgs.push_back("-migrate"); in ConstructJob()
3860 CmdArgs.push_back("-Eonly"); in ConstructJob()
3862 CmdArgs.push_back("-E"); in ConstructJob()
3865 CmdArgs.push_back("-P"); in ConstructJob()
3868 CmdArgs.push_back("-emit-obj"); in ConstructJob()
3872 // Also ignore explicit -force_cpusubtype_ALL option. in ConstructJob()
3879 CmdArgs.push_back("-fsyntax-only"); in ConstructJob()
3881 CmdArgs.push_back("-emit-pch"); in ConstructJob()
3883 CmdArgs.push_back("-emit-pth"); in ConstructJob()
3885 CmdArgs.push_back("-verify-pch"); in ConstructJob()
3890 CmdArgs.push_back("-fsyntax-only"); in ConstructJob()
3893 CmdArgs.push_back("-emit-llvm"); in ConstructJob()
3896 CmdArgs.push_back("-emit-llvm-bc"); in ConstructJob()
3898 CmdArgs.push_back("-S"); in ConstructJob()
3900 CmdArgs.push_back("-emit-pch"); in ConstructJob()
3902 CmdArgs.push_back("-module-file-info"); in ConstructJob()
3904 CmdArgs.push_back("-rewrite-objc"); in ConstructJob()
3907 CmdArgs.push_back("-rewrite-objc"); in ConstructJob()
3913 // Preserve use-list order by default when emitting bitcode, so that in ConstructJob()
3916 // the use-list order, since serialization to bitcode is part of the flow. in ConstructJob()
3918 CmdArgs.push_back("-emit-llvm-uselists"); in ConstructJob()
3926 D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args) in ConstructJob()
3927 << "-x ir"; in ConstructJob()
3931 // Embed-bitcode option. in ConstructJob()
3934 // Add flags implied by -fembed-bitcode. in ConstructJob()
3937 CmdArgs.push_back("-disable-llvm-optzns"); in ConstructJob()
3940 CmdArgs.push_back("-fembed-bitcode=marker"); in ConstructJob()
3946 CmdArgs.push_back("-disable-free"); in ConstructJob()
3948 // Disable the verification pass in -asserts builds. in ConstructJob()
3950 CmdArgs.push_back("-disable-llvm-verifier"); in ConstructJob()
3951 // Discard LLVM value names in -asserts builds. in ConstructJob()
3952 CmdArgs.push_back("-discard-value-names"); in ConstructJob()
3956 // -save-temps. in ConstructJob()
3957 CmdArgs.push_back("-main-file-name"); in ConstructJob()
3963 CmdArgs.push_back("-static-define"); in ConstructJob()
3967 CmdArgs.push_back("-analyzer-store=region"); in ConstructJob()
3970 CmdArgs.push_back("-analyzer-opt-analyze-nested-blocks"); in ConstructJob()
3972 CmdArgs.push_back("-analyzer-eagerly-assume"); in ConstructJob()
3976 CmdArgs.push_back("-analyzer-checker=core"); in ConstructJob()
3979 CmdArgs.push_back("-analyzer-checker=unix"); in ConstructJob()
3982 CmdArgs.push_back("-analyzer-checker=unix.API"); in ConstructJob()
3983 CmdArgs.push_back("-analyzer-checker=unix.Malloc"); in ConstructJob()
3984 CmdArgs.push_back("-analyzer-checker=unix.MallocSizeof"); in ConstructJob()
3985 CmdArgs.push_back("-analyzer-checker=unix.MismatchedDeallocator"); in ConstructJob()
3986 CmdArgs.push_back("-analyzer-checker=unix.cstring.BadSizeArg"); in ConstructJob()
3987 CmdArgs.push_back("-analyzer-checker=unix.cstring.NullArg"); in ConstructJob()
3992 CmdArgs.push_back("-analyzer-disable-checker=unix.API"); in ConstructJob()
3993 CmdArgs.push_back("-analyzer-disable-checker=unix.Vfork"); in ConstructJob()
3997 CmdArgs.push_back("-analyzer-checker=osx"); in ConstructJob()
3999 CmdArgs.push_back("-analyzer-checker=deadcode"); in ConstructJob()
4002 CmdArgs.push_back("-analyzer-checker=cplusplus"); in ConstructJob()
4006 "-analyzer-checker=security.insecureAPI.UncheckedReturn"); in ConstructJob()
4007 CmdArgs.push_back("-analyzer-checker=security.insecureAPI.getpw"); in ConstructJob()
4008 CmdArgs.push_back("-analyzer-checker=security.insecureAPI.gets"); in ConstructJob()
4009 CmdArgs.push_back("-analyzer-checker=security.insecureAPI.mktemp"); in ConstructJob()
4010 CmdArgs.push_back("-analyzer-checker=security.insecureAPI.mkstemp"); in ConstructJob()
4011 CmdArgs.push_back("-analyzer-checker=security.insecureAPI.vfork"); in ConstructJob()
4015 CmdArgs.push_back("-analyzer-checker=nullability.NullPassedToNonnull"); in ConstructJob()
4017 "-analyzer-checker=nullability.NullReturnedFromNonnull"); in ConstructJob()
4022 CmdArgs.push_back("-analyzer-output"); in ConstructJob()
4024 CmdArgs.push_back(A->getValue()); in ConstructJob()
4029 // using --analyze. We only want to show static analyzer diagnostics in ConstructJob()
4031 CmdArgs.push_back("-w"); in ConstructJob()
4033 // Add -Xanalyzer arguments when running as analyzer. in ConstructJob()
4047 CmdArgs.push_back("-mrelocation-model"); in ConstructJob()
4051 CmdArgs.push_back("-pic-level"); in ConstructJob()
4054 CmdArgs.push_back("-pic-is-pie"); in ConstructJob()
4058 CmdArgs.push_back("-meabi"); in ConstructJob()
4059 CmdArgs.push_back(A->getValue()); in ConstructJob()
4062 CmdArgs.push_back("-mthread-model"); in ConstructJob()
4064 CmdArgs.push_back(A->getValue()); in ConstructJob()
4072 CmdArgs.push_back("-fno-merge-all-constants"); in ConstructJob()
4080 CmdArgs.push_back("-frewrite-map-file"); in ConstructJob()
4081 CmdArgs.push_back(A->getValue()); in ConstructJob()
4082 A->claim(); in ConstructJob()
4087 StringRef v = A->getValue(); in ConstructJob()
4088 CmdArgs.push_back("-mllvm"); in ConstructJob()
4089 CmdArgs.push_back(Args.MakeArgString("-warn-stack-size=" + v)); in ConstructJob()
4090 A->claim(); in ConstructJob()
4095 CmdArgs.push_back("-fno-jump-tables"); in ConstructJob()
4098 CmdArgs.push_back("-mregparm"); in ConstructJob()
4099 CmdArgs.push_back(A->getValue()); in ConstructJob()
4106 << A->getSpelling() << getToolChain().getTriple().str(); in ConstructJob()
4107 } else if (A->getOption().matches(options::OPT_fpcc_struct_return)) { in ConstructJob()
4108 CmdArgs.push_back("-fpcc-struct-return"); in ConstructJob()
4110 assert(A->getOption().matches(options::OPT_freg_struct_return)); in ConstructJob()
4111 CmdArgs.push_back("-freg-struct-return"); in ConstructJob()
4116 CmdArgs.push_back("-fdefault-calling-conv=stdcall"); in ConstructJob()
4119 CmdArgs.push_back("-mdisable-fp-elim"); in ConstructJob()
4122 CmdArgs.push_back("-mno-zero-initialized-in-bss"); in ConstructJob()
4125 // If -Ofast is the optimization level, then -fstrict-aliasing should be in ConstructJob()
4134 CmdArgs.push_back("-relaxed-aliasing"); in ConstructJob()
4137 CmdArgs.push_back("-no-struct-path-tbaa"); in ConstructJob()
4140 CmdArgs.push_back("-fstrict-enums"); in ConstructJob()
4144 CmdArgs.push_back("-fstrict-vtable-pointers"); in ConstructJob()
4147 CmdArgs.push_back("-mdisable-tail-calls"); in ConstructJob()
4151 CmdArgs.push_back("-split-stacks"); in ConstructJob()
4153 // If -Ofast is the optimization level, then -ffast-math should be enabled. in ConstructJob()
4168 if (A->getOption().getID() != options::OPT_fno_fast_math && in ConstructJob()
4169 A->getOption().getID() != options::OPT_fno_finite_math_only && in ConstructJob()
4170 A->getOption().getID() != options::OPT_fhonor_infinities) in ConstructJob()
4171 CmdArgs.push_back("-menable-no-infs"); in ConstructJob()
4177 if (A->getOption().getID() != options::OPT_fno_fast_math && in ConstructJob()
4178 A->getOption().getID() != options::OPT_fno_finite_math_only && in ConstructJob()
4179 A->getOption().getID() != options::OPT_fhonor_nans) in ConstructJob()
4180 CmdArgs.push_back("-menable-no-nans"); in ConstructJob()
4182 // -fmath-errno is the default on some platforms, e.g. BSD-derived OSes. in ConstructJob()
4188 // Turning on -ffast_math (with either flag) removes the need for MathErrno. in ConstructJob()
4189 // However, turning *off* -ffast_math merely restores the toolchain default in ConstructJob()
4191 if (A->getOption().getID() == options::OPT_fno_math_errno || in ConstructJob()
4192 A->getOption().getID() == options::OPT_ffast_math || in ConstructJob()
4193 A->getOption().getID() == options::OPT_Ofast) in ConstructJob()
4195 else if (A->getOption().getID() == options::OPT_fmath_errno) in ConstructJob()
4199 CmdArgs.push_back("-fmath-errno"); in ConstructJob()
4211 if (A->getOption().getID() != options::OPT_fno_fast_math && in ConstructJob()
4212 A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations && in ConstructJob()
4213 A->getOption().getID() != options::OPT_fno_associative_math) in ConstructJob()
4221 if (A->getOption().getID() != options::OPT_fno_fast_math && in ConstructJob()
4222 A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations && in ConstructJob()
4223 A->getOption().getID() != options::OPT_fno_reciprocal_math) in ConstructJob()
4231 if (A->getOption().getID() != options::OPT_fno_fast_math && in ConstructJob()
4232 A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations && in ConstructJob()
4233 A->getOption().getID() != options::OPT_fsigned_zeros) in ConstructJob()
4241 if (A->getOption().getID() != options::OPT_fno_fast_math && in ConstructJob()
4242 A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations && in ConstructJob()
4243 A->getOption().getID() != options::OPT_ftrapping_math) in ConstructJob()
4247 CmdArgs.push_back("-menable-unsafe-fp-math"); in ConstructJob()
4250 CmdArgs.push_back("-fno-signed-zeros"); in ConstructJob()
4253 CmdArgs.push_back("-freciprocal-math"); in ConstructJob()
4255 // Validate and pass through -fp-contract option. in ConstructJob()
4259 if (A->getOption().getID() == options::OPT_ffp_contract) { in ConstructJob()
4260 StringRef Val = A->getValue(); in ConstructJob()
4262 CmdArgs.push_back(Args.MakeArgString("-ffp-contract=" + Val)); in ConstructJob()
4265 << A->getOption().getName() << Val; in ConstructJob()
4267 } else if (A->getOption().matches(options::OPT_ffast_math) || in ConstructJob()
4268 (OFastEnabled && A->getOption().matches(options::OPT_Ofast))) { in ConstructJob()
4269 // If fast-math is set then set the fp-contract mode to fast. in ConstructJob()
4270 CmdArgs.push_back(Args.MakeArgString("-ffp-contract=fast")); in ConstructJob()
4276 // We separately look for the '-ffast-math' and '-ffinite-math-only' flags, in ConstructJob()
4283 if (!A->getOption().matches(options::OPT_fno_fast_math)) in ConstructJob()
4284 CmdArgs.push_back("-ffast-math"); in ConstructJob()
4287 if (A->getOption().matches(options::OPT_ffinite_math_only)) in ConstructJob()
4288 CmdArgs.push_back("-ffinite-math-only"); in ConstructJob()
4297 CmdArgs.push_back("-masm-verbose"); in ConstructJob()
4301 CmdArgs.push_back("-no-integrated-as"); in ConstructJob()
4304 CmdArgs.push_back("-mdebug-pass"); in ConstructJob()
4308 CmdArgs.push_back("-mdebug-pass"); in ConstructJob()
4312 // Enable -mconstructor-aliases except on darwin, where we have to work around in ConstructJob()
4317 CmdArgs.push_back("-mconstructor-aliases"); in ConstructJob()
4322 CmdArgs.push_back("-fforbid-guard-variables"); in ConstructJob()
4326 CmdArgs.push_back("-mms-bitfields"); in ConstructJob()
4329 // This is a coarse approximation of what llvm-gcc actually does, both in ConstructJob()
4330 // -fasynchronous-unwind-tables and -fnon-call-exceptions interact in more in ConstructJob()
4340 CmdArgs.push_back("-munwind-tables"); in ConstructJob()
4345 CmdArgs.push_back("-mlimit-float-precision"); in ConstructJob()
4346 CmdArgs.push_back(A->getValue()); in ConstructJob()
4349 // FIXME: Handle -mtune=. in ConstructJob()
4353 CmdArgs.push_back("-mcode-model"); in ConstructJob()
4354 CmdArgs.push_back(A->getValue()); in ConstructJob()
4360 CmdArgs.push_back("-target-cpu"); in ConstructJob()
4365 CmdArgs.push_back("-mfpmath"); in ConstructJob()
4366 CmdArgs.push_back(A->getValue()); in ConstructJob()
4434 // reach cc1 they've been factored into three well-defined orthogonal choices: in ConstructJob()
4447 // Add clang-cl arguments. in ConstructJob()
4454 CmdArgs.push_back("-target-linker-version"); in ConstructJob()
4455 CmdArgs.push_back(A->getValue()); in ConstructJob()
4459 CmdArgs.push_back("-momit-leaf-frame-pointer"); in ConstructJob()
4470 << Unsupported->getOption().getName(); in ConstructJob()
4477 CmdArgs.push_back("-header-include-file"); in ConstructJob()
4479 : "-"); in ConstructJob()
4485 CmdArgs.push_back("-diagnostic-log-file"); in ConstructJob()
4487 : "-"); in ConstructJob()
4493 // If the last option explicitly specified a debug-info level, use it. in ConstructJob()
4494 if (A->getOption().matches(options::OPT_gN_Group)) { in ConstructJob()
4496 // If you say "-gsplit-dwarf -gline-tables-only", -gsplit-dwarf loses. in ConstructJob()
4497 // But -gsplit-dwarf is not a g_group option, hence we have to check the in ConstructJob()
4498 // order explicitly. (If -gsplit-dwarf wins, we fix DebugInfoKind later.) in ConstructJob()
4500 A->getIndex() > SplitDwarfArg->getIndex()) in ConstructJob()
4510 if (A->getOption().matches(options::OPT_glldb)) in ConstructJob()
4512 else if (A->getOption().matches(options::OPT_gsce)) in ConstructJob()
4518 // If a -gdwarf argument appeared, remember it. in ConstructJob()
4521 DwarfVersion = DwarfVersionNum(A->getSpelling()); in ConstructJob()
4523 // Forward -gcodeview. in ConstructJob()
4524 // 'EmitCodeView might have been set by CL-compatibility argument parsing. in ConstructJob()
4527 CmdArgs.push_back("-gcodeview"); in ConstructJob()
4533 // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now. in ConstructJob()
4539 CmdArgs.push_back("-dwarf-column-info"); in ConstructJob()
4544 CmdArgs.push_back("-dwarf-ext-refs"); in ConstructJob()
4545 CmdArgs.push_back("-fmodule-format=obj"); in ConstructJob()
4548 // -gsplit-dwarf should turn on -g and enable the backend dwarf in ConstructJob()
4553 CmdArgs.push_back("-backend-option"); in ConstructJob()
4554 CmdArgs.push_back("-split-dwarf=Enable"); in ConstructJob()
4560 // We parse these two '-f' options whether or not they will be used, in ConstructJob()
4561 // to claim them even if you wrote "-fstandalone-debug -gline-tables-only" in ConstructJob()
4570 // -ggnu-pubnames turns on gnu style pubnames in the backend. in ConstructJob()
4572 CmdArgs.push_back("-backend-option"); in ConstructJob()
4573 CmdArgs.push_back("-generate-gnu-dwarf-pub-sections"); in ConstructJob()
4576 // -gdwarf-aranges turns on the emission of the aranges section in the in ConstructJob()
4580 CmdArgs.push_back("-backend-option"); in ConstructJob()
4581 CmdArgs.push_back("-generate-arange-section"); in ConstructJob()
4586 CmdArgs.push_back("-backend-option"); in ConstructJob()
4587 CmdArgs.push_back("-generate-type-units"); in ConstructJob()
4590 // CloudABI and WebAssembly use -ffunction-sections and -fdata-sections by in ConstructJob()
4598 CmdArgs.push_back("-ffunction-sections"); in ConstructJob()
4603 CmdArgs.push_back("-fdata-sections"); in ConstructJob()
4608 CmdArgs.push_back("-fno-unique-section-names"); in ConstructJob()
4614 CmdArgs.push_back("-fxray-instrument"); in ConstructJob()
4617 CmdArgs.push_back("-fxray-instruction-threshold"); in ConstructJob()
4618 CmdArgs.push_back(A->getValue()); in ConstructJob()
4624 CmdArgs.push_back("-fxray-instrument"); in ConstructJob()
4628 CmdArgs.push_back("-fxray-instruction-threshold"); in ConstructJob()
4629 CmdArgs.push_back(A->getValue()); in ConstructJob()
4641 CmdArgs.push_back("-nostdsysteminc"); in ConstructJob()
4642 CmdArgs.push_back("-nobuiltininc"); in ConstructJob()
4645 CmdArgs.push_back("-nostdsysteminc"); in ConstructJob()
4651 CmdArgs.push_back("-resource-dir"); in ConstructJob()
4662 switch (A->getOption().getID()) { in ConstructJob()
4666 CmdArgs.push_back("-arcmt-check"); in ConstructJob()
4669 CmdArgs.push_back("-arcmt-modify"); in ConstructJob()
4672 CmdArgs.push_back("-arcmt-migrate"); in ConstructJob()
4673 CmdArgs.push_back("-mt-migrate-directory"); in ConstructJob()
4674 CmdArgs.push_back(A->getValue()); in ConstructJob()
4689 D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args) in ConstructJob()
4690 << "-ccc-arcmt-migrate"; in ConstructJob()
4692 CmdArgs.push_back("-mt-migrate-directory"); in ConstructJob()
4693 CmdArgs.push_back(A->getValue()); in ConstructJob()
4699 CmdArgs.push_back("-objcmt-migrate-literals"); in ConstructJob()
4700 CmdArgs.push_back("-objcmt-migrate-subscripting"); in ConstructJob()
4701 CmdArgs.push_back("-objcmt-migrate-property"); in ConstructJob()
4726 // Add preprocessing options like -I, -D, etc. if we are using the in ConstructJob()
4729 // FIXME: Support -fpreprocessed in ConstructJob()
4734 // Don't warn about "clang -c -DPIC -fPIC test.i" because libtool.m4 assumes in ConstructJob()
4736 // When building with ccache, it will pass -D options to clang even on in ConstructJob()
4737 // preprocessed inputs and configure concludes that -fPIC is not supported. in ConstructJob()
4740 // Manually translate -O4 to -O3; let clang reject others. in ConstructJob()
4742 if (A->getOption().matches(options::OPT_O4)) { in ConstructJob()
4743 CmdArgs.push_back("-O3"); in ConstructJob()
4746 A->render(Args, CmdArgs); in ConstructJob()
4753 D.Diag(diag::warn_ignored_gcc_optimization) << A->getAsString(Args); in ConstructJob()
4754 A->claim(); in ConstructJob()
4762 CmdArgs.push_back("-pedantic"); in ConstructJob()
4766 // Handle -{std, ansi, trigraphs} -- take the last of -{std, ansi} in ConstructJob()
4767 // (-ansi is equivalent to -std=c89 or -std=c++98). in ConstructJob()
4769 // If a std is supplied, only add -trigraphs if it follows the in ConstructJob()
4773 if (Std->getOption().matches(options::OPT_ansi)) in ConstructJob()
4775 CmdArgs.push_back("-std=c++98"); in ConstructJob()
4777 CmdArgs.push_back("-std=c89"); in ConstructJob()
4779 Std->render(Args, CmdArgs); in ConstructJob()
4781 // If -f(no-)trigraphs appears after the language standard flag, honor it. in ConstructJob()
4786 A->render(Args, CmdArgs); in ConstructJob()
4788 // Honor -std-default. in ConstructJob()
4790 // FIXME: Clang doesn't correctly handle -std= when the input language in ConstructJob()
4793 // splitting it between the driver and clang -cc1. in ConstructJob()
4795 Args.AddAllArgsTranslated(CmdArgs, options::OPT_std_default_EQ, "-std=", in ConstructJob()
4804 // GCC's behavior for -Wwrite-strings is a bit strange: in ConstructJob()
4812 // a non-const char* in C, rather than using this crude hack. in ConstructJob()
4815 // respect -Weverything, -Wno-everything, -Werror=write-strings, and so on. in ConstructJob()
4820 WriteStrings->getOption().matches(options::OPT_Wwrite_strings)) in ConstructJob()
4821 CmdArgs.push_back("-fconst-strings"); in ConstructJob()
4824 // GCC provides a macro definition '__DEPRECATED' when -Wdeprecated is active in ConstructJob()
4826 // in the presence of '-w', match this behavior bug-for-bug. in ConstructJob()
4830 CmdArgs.push_back("-fdeprecated-macro"); in ConstructJob()
4833 // Translate GCC's misnamer '-fasm' arguments to '-fgnu-keywords'. in ConstructJob()
4835 if (Asm->getOption().matches(options::OPT_fasm)) in ConstructJob()
4836 CmdArgs.push_back("-fgnu-keywords"); in ConstructJob()
4838 CmdArgs.push_back("-fno-gnu-keywords"); in ConstructJob()
4842 CmdArgs.push_back("-fno-dwarf-directory-asm"); in ConstructJob()
4845 CmdArgs.push_back("-fno-autolink"); in ConstructJob()
4847 // Add in -fdebug-compilation-dir if necessary. in ConstructJob()
4851 StringRef Map = A->getValue(); in ConstructJob()
4855 CmdArgs.push_back(Args.MakeArgString("-fdebug-prefix-map=" + Map)); in ConstructJob()
4856 A->claim(); in ConstructJob()
4861 CmdArgs.push_back("-ftemplate-depth"); in ConstructJob()
4862 CmdArgs.push_back(A->getValue()); in ConstructJob()
4866 CmdArgs.push_back("-foperator-arrow-depth"); in ConstructJob()
4867 CmdArgs.push_back(A->getValue()); in ConstructJob()
4871 CmdArgs.push_back("-fconstexpr-depth"); in ConstructJob()
4872 CmdArgs.push_back(A->getValue()); in ConstructJob()
4876 CmdArgs.push_back("-fconstexpr-steps"); in ConstructJob()
4877 CmdArgs.push_back(A->getValue()); in ConstructJob()
4881 CmdArgs.push_back("-fbracket-depth"); in ConstructJob()
4882 CmdArgs.push_back(A->getValue()); in ConstructJob()
4887 if (A->getNumValues()) { in ConstructJob()
4888 StringRef bytes = A->getValue(); in ConstructJob()
4889 CmdArgs.push_back(Args.MakeArgString("-Wlarge-by-value-copy=" + bytes)); in ConstructJob()
4891 CmdArgs.push_back("-Wlarge-by-value-copy=64"); // default value in ConstructJob()
4895 CmdArgs.push_back("-relocatable-pch"); in ConstructJob()
4898 CmdArgs.push_back("-fconstant-string-class"); in ConstructJob()
4899 CmdArgs.push_back(A->getValue()); in ConstructJob()
4903 CmdArgs.push_back("-ftabstop"); in ConstructJob()
4904 CmdArgs.push_back(A->getValue()); in ConstructJob()
4907 CmdArgs.push_back("-ferror-limit"); in ConstructJob()
4909 CmdArgs.push_back(A->getValue()); in ConstructJob()
4914 CmdArgs.push_back("-fmacro-backtrace-limit"); in ConstructJob()
4915 CmdArgs.push_back(A->getValue()); in ConstructJob()
4919 CmdArgs.push_back("-ftemplate-backtrace-limit"); in ConstructJob()
4920 CmdArgs.push_back(A->getValue()); in ConstructJob()
4924 CmdArgs.push_back("-fconstexpr-backtrace-limit"); in ConstructJob()
4925 CmdArgs.push_back(A->getValue()); in ConstructJob()
4929 CmdArgs.push_back("-fspell-checking-limit"); in ConstructJob()
4930 CmdArgs.push_back(A->getValue()); in ConstructJob()
4933 // Pass -fmessage-length=. in ConstructJob()
4934 CmdArgs.push_back("-fmessage-length"); in ConstructJob()
4936 CmdArgs.push_back(A->getValue()); in ConstructJob()
4938 // If -fmessage-length=N was not specified, determine whether this is a in ConstructJob()
4939 // terminal and, if so, implicitly define -fmessage-length appropriately. in ConstructJob()
4944 // -fvisibility= and -fvisibility-ms-compat are of a piece. in ConstructJob()
4947 if (A->getOption().matches(options::OPT_fvisibility_EQ)) { in ConstructJob()
4948 CmdArgs.push_back("-fvisibility"); in ConstructJob()
4949 CmdArgs.push_back(A->getValue()); in ConstructJob()
4951 assert(A->getOption().matches(options::OPT_fvisibility_ms_compat)); in ConstructJob()
4952 CmdArgs.push_back("-fvisibility"); in ConstructJob()
4954 CmdArgs.push_back("-ftype-visibility"); in ConstructJob()
4963 // -fhosted is default. in ConstructJob()
4966 CmdArgs.push_back("-ffreestanding"); in ConstructJob()
4968 // Forward -f (flag) options which we can pass directly. in ConstructJob()
4973 // with -femulated-tls. in ConstructJob()
4977 CmdArgs.push_back("-femulated-tls"); in ConstructJob()
4978 // AltiVec-like language extensions aren't relevant for assembling. in ConstructJob()
4993 CmdArgs.push_back("-fopenmp"); in ConstructJob()
5000 CmdArgs.push_back("-fnoopenmp-use-tls"); in ConstructJob()
5005 // for a specific runtime library, we just don't pass the '-fopenmp' flag in ConstructJob()
5017 // Report an error for -faltivec on anything other than PowerPC. in ConstructJob()
5022 D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args) in ConstructJob()
5026 // -fzvector is incompatible with -faltivec. in ConstructJob()
5029 D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args) in ConstructJob()
5030 << "-faltivec"; in ConstructJob()
5035 // -flax-vector-conversions is default. in ConstructJob()
5038 CmdArgs.push_back("-fno-lax-vector-conversions"); in ConstructJob()
5042 CmdArgs.push_back("-fapple-kext"); in ConstructJob()
5051 CmdArgs.push_back("-ftrapv-handler"); in ConstructJob()
5052 CmdArgs.push_back(A->getValue()); in ConstructJob()
5057 // -fno-strict-overflow implies -fwrapv if it isn't disabled, but in ConstructJob()
5058 // -fstrict-overflow won't turn off an explicitly enabled -fwrapv. in ConstructJob()
5060 if (A->getOption().matches(options::OPT_fwrapv)) in ConstructJob()
5061 CmdArgs.push_back("-fwrapv"); in ConstructJob()
5064 if (A->getOption().matches(options::OPT_fno_strict_overflow)) in ConstructJob()
5065 CmdArgs.push_back("-fwrapv"); in ConstructJob()
5070 if (A->getOption().matches(options::OPT_freroll_loops)) in ConstructJob()
5071 CmdArgs.push_back("-freroll-loops"); in ConstructJob()
5079 // -stack-protector=0 is default. in ConstructJob()
5085 if (A->getOption().matches(options::OPT_fstack_protector)) { in ConstructJob()
5089 } else if (A->getOption().matches(options::OPT_fstack_protector_strong)) in ConstructJob()
5091 else if (A->getOption().matches(options::OPT_fstack_protector_all)) in ConstructJob()
5098 CmdArgs.push_back("-stack-protector"); in ConstructJob()
5102 // --param ssp-buffer-size= in ConstructJob()
5104 StringRef Str(A->getValue()); in ConstructJob()
5105 if (Str.startswith("ssp-buffer-size=")) { in ConstructJob()
5107 CmdArgs.push_back("-stack-protector-buffer-size"); in ConstructJob()
5111 A->claim(); in ConstructJob()
5115 // Translate -mstackrealign in ConstructJob()
5118 CmdArgs.push_back(Args.MakeArgString("-mstackrealign")); in ConstructJob()
5122 CmdArgs.push_back(Args.MakeArgString("-mstack-alignment=" + alignment)); in ConstructJob()
5129 CmdArgs.push_back(Args.MakeArgString("-mstack-probe-size=" + Size)); in ConstructJob()
5131 CmdArgs.push_back("-mstack-probe-size=0"); in ConstructJob()
5141 CmdArgs.push_back("-fallow-half-arguments-and-returns"); in ConstructJob()
5150 if (A->getOption().matches(options::OPT_mrestrict_it)) { in ConstructJob()
5151 CmdArgs.push_back("-backend-option"); in ConstructJob()
5152 CmdArgs.push_back("-arm-restrict-it"); in ConstructJob()
5154 CmdArgs.push_back("-backend-option"); in ConstructJob()
5155 CmdArgs.push_back("-arm-no-restrict-it"); in ConstructJob()
5161 CmdArgs.push_back("-backend-option"); in ConstructJob()
5162 CmdArgs.push_back("-arm-restrict-it"); in ConstructJob()
5165 // Forward -cl options to -cc1 in ConstructJob()
5167 CmdArgs.push_back("-cl-opt-disable"); in ConstructJob()
5170 CmdArgs.push_back("-cl-strict-aliasing"); in ConstructJob()
5173 CmdArgs.push_back("-cl-single-precision-constant"); in ConstructJob()
5176 CmdArgs.push_back("-cl-finite-math-only"); in ConstructJob()
5179 CmdArgs.push_back("-cl-kernel-arg-info"); in ConstructJob()
5182 CmdArgs.push_back("-cl-unsafe-math-optimizations"); in ConstructJob()
5185 CmdArgs.push_back("-cl-fast-relaxed-math"); in ConstructJob()
5188 CmdArgs.push_back("-cl-mad-enable"); in ConstructJob()
5191 CmdArgs.push_back("-cl-no-signed-zeros"); in ConstructJob()
5194 std::string CLStdStr = "-cl-std="; in ConstructJob()
5195 CLStdStr += A->getValue(); in ConstructJob()
5199 CmdArgs.push_back("-cl-denorms-are-zero"); in ConstructJob()
5202 // Forward -f options with positive and negative forms; we translate in ConstructJob()
5205 StringRef fname = A->getValue(); in ConstructJob()
5209 A->render(Args, CmdArgs); in ConstructJob()
5212 // -fbuiltin is default unless -mkernel is used. in ConstructJob()
5217 CmdArgs.push_back("-fno-builtin"); in ConstructJob()
5219 // -ffreestanding implies -fno-builtin. in ConstructJob()
5223 // Process the -fno-builtin-* options. in ConstructJob()
5225 const Option &O = Arg->getOption(); in ConstructJob()
5229 Arg->claim(); in ConstructJob()
5230 // If -fno-builtin is specified, then there's no need to pass the option to in ConstructJob()
5235 StringRef FuncName = Arg->getValue(); in ConstructJob()
5236 CmdArgs.push_back(Args.MakeArgString("-fno-builtin-" + FuncName)); in ConstructJob()
5241 CmdArgs.push_back("-fno-assume-sane-operator-new"); in ConstructJob()
5243 // -fblocks=0 is default. in ConstructJob()
5249 CmdArgs.push_back("-fblocks"); in ConstructJob()
5253 CmdArgs.push_back("-fblocks-runtime-optional"); in ConstructJob()
5256 // -fmodules enables the use of precompiled modules (off by default). in ConstructJob()
5257 // Users can pass -fno-cxx-modules to turn off modules support for in ConstructJob()
5258 // C++/Objective-C++ programs. in ConstructJob()
5264 CmdArgs.push_back("-fmodules"); in ConstructJob()
5269 // -fmodule-maps enables implicit reading of module map files. By default, in ConstructJob()
5273 CmdArgs.push_back("-fimplicit-module-maps"); in ConstructJob()
5276 // -fmodules-decluse checks that modules used are declared so (off by in ConstructJob()
5280 CmdArgs.push_back("-fmodules-decluse"); in ConstructJob()
5283 // -fmodules-strict-decluse is like -fmodule-decluse, but also checks that in ConstructJob()
5287 CmdArgs.push_back("-fmodules-strict-decluse"); in ConstructJob()
5290 // -fno-implicit-modules turns off implicitly compiling modules on demand. in ConstructJob()
5293 CmdArgs.push_back("-fno-implicit-modules"); in ConstructJob()
5295 // -fmodule-cache-path specifies where our implicitly-built module files in ConstructJob()
5299 Path = A->getValue(); in ConstructJob()
5313 const char Arg[] = "-fmodules-cache-path="; in ConstructJob()
5318 // -fmodule-name specifies the module that is currently being built (or in ConstructJob()
5319 // used for header checking by -fmodule-maps). in ConstructJob()
5322 // -fmodule-map-file can be used to specify files containing module in ConstructJob()
5326 // -fmodule-file can be used to specify files containing precompiled modules. in ConstructJob()
5341 CmdArgs.push_back("-module-dependency-dir"); in ConstructJob()
5348 // Pass through all -fmodules-ignore-macro arguments. in ConstructJob()
5358 << A->getAsString(Args) << "-fbuild-session-timestamp"; in ConstructJob()
5361 if (llvm::sys::fs::status(A->getValue(), Status)) in ConstructJob()
5362 D.Diag(diag::err_drv_no_such_file) << A->getValue(); in ConstructJob()
5364 "-fbuild-session-timestamp=" + in ConstructJob()
5379 // -faccess-control is default. in ConstructJob()
5382 CmdArgs.push_back("-fno-access-control"); in ConstructJob()
5384 // -felide-constructors is the default. in ConstructJob()
5387 CmdArgs.push_back("-fno-elide-constructors"); in ConstructJob()
5394 CmdArgs.push_back("-fno-rtti"); in ConstructJob()
5396 // -fshort-enums=0 is default for all architectures except Hexagon. in ConstructJob()
5399 CmdArgs.push_back("-fshort-enums"); in ConstructJob()
5401 // -fsigned-char is default. in ConstructJob()
5405 if (A->getOption().matches(options::OPT_funsigned_char) || in ConstructJob()
5406 A->getOption().matches(options::OPT_fno_signed_char)) { in ConstructJob()
5407 CmdArgs.push_back("-fno-signed-char"); in ConstructJob()
5410 CmdArgs.push_back("-fno-signed-char"); in ConstructJob()
5413 // -fuse-cxa-atexit is default. in ConstructJob()
5424 CmdArgs.push_back("-fno-use-cxa-atexit"); in ConstructJob()
5426 // -fms-extensions=0 is default. in ConstructJob()
5429 CmdArgs.push_back("-fms-extensions"); in ConstructJob()
5431 // -fno-use-line-directives is default. in ConstructJob()
5434 CmdArgs.push_back("-fuse-line-directives"); in ConstructJob()
5436 // -fms-compatibility=0 is default. in ConstructJob()
5442 CmdArgs.push_back("-fms-compatibility"); in ConstructJob()
5444 // -fms-compatibility-version=18.00 is default. in ConstructJob()
5449 Args.MakeArgString("-fms-compatibility-version=" + MSVT.getAsString())); in ConstructJob()
5455 LanguageStandard = llvm::StringSwitch<StringRef>(StdArg->getValue()) in ConstructJob()
5456 .Case("c++14", "-std=c++14") in ConstructJob()
5457 .Case("c++latest", "-std=c++1z") in ConstructJob()
5461 << StdArg->getAsString(Args); in ConstructJob()
5466 LanguageStandard = "-std=c++14"; in ConstructJob()
5468 LanguageStandard = "-std=c++11"; in ConstructJob()
5474 // -fno-borland-extensions is default. in ConstructJob()
5477 CmdArgs.push_back("-fborland-extensions"); in ConstructJob()
5479 // -fno-declspec is default, except for PS4. in ConstructJob()
5482 CmdArgs.push_back("-fdeclspec"); in ConstructJob()
5484 CmdArgs.push_back("-fno-declspec"); // Explicitly disabling __declspec. in ConstructJob()
5486 // -fthreadsafe-static is default, except for MSVC compatibility versions less in ConstructJob()
5491 CmdArgs.push_back("-fno-threadsafe-statics"); in ConstructJob()
5493 // -fno-delayed-template-parsing is default, except for Windows where MSVC STL in ConstructJob()
5497 CmdArgs.push_back("-fdelayed-template-parsing"); in ConstructJob()
5499 // -fgnu-keywords default varies depending on language; only pass if in ConstructJob()
5503 A->render(Args, CmdArgs); in ConstructJob()
5507 CmdArgs.push_back("-fgnu89-inline"); in ConstructJob()
5510 CmdArgs.push_back("-fno-inline"); in ConstructJob()
5515 InlineArg->render(Args, CmdArgs); in ConstructJob()
5519 // -fobjc-dispatch-method is only relevant with the nonfragile-abi, and in ConstructJob()
5521 // next runtime is always legacy dispatch and -fno-objc-legacy-dispatch in ConstructJob()
5529 CmdArgs.push_back("-fobjc-dispatch-method=mixed"); in ConstructJob()
5531 CmdArgs.push_back("-fobjc-dispatch-method=non-legacy"); in ConstructJob()
5543 CmdArgs.push_back("-fobjc-subscripting-legacy-runtime"); in ConstructJob()
5545 // -fencode-extended-block-signature=1 is default. in ConstructJob()
5547 CmdArgs.push_back("-fencode-extended-block-signature"); in ConstructJob()
5550 // Allow -fno-objc-arr to trump -fobjc-arr/-fobjc-arc. in ConstructJob()
5556 CmdArgs.push_back("-fobjc-arc"); in ConstructJob()
5563 CmdArgs.push_back("-fobjc-arc-cxxlib=libc++"); in ConstructJob()
5565 CmdArgs.push_back("-fobjc-arc-cxxlib=libstdc++"); in ConstructJob()
5569 // We define off for Objective-CC, on for Objective-C++. in ConstructJob()
5573 CmdArgs.push_back("-fobjc-arc-exceptions"); in ConstructJob()
5577 // -fobjc-infer-related-result-type is the default, except in the Objective-C in ConstructJob()
5580 CmdArgs.push_back("-fno-objc-infer-related-result-type"); in ConstructJob()
5582 // Handle -fobjc-gc and -fobjc-gc-only. They are exclusive, and -fobjc-gc-only in ConstructJob()
5589 D.Diag(diag::err_drv_objc_gc_arr) << GCArg->getAsString(Args); in ConstructJob()
5591 GCArg->render(Args, CmdArgs); in ConstructJob()
5594 D.Diag(diag::warn_drv_objc_gc_unsupported) << GCArg->getAsString(Args); in ConstructJob()
5598 // Pass down -fobjc-weak or -fno-objc-weak if present. in ConstructJob()
5605 if (WeakArg->getOption().matches(options::OPT_fobjc_weak)) in ConstructJob()
5608 if (WeakArg->getOption().matches(options::OPT_fobjc_weak)) in ConstructJob()
5611 WeakArg->render(Args, CmdArgs); in ConstructJob()
5617 CmdArgs.push_back("-fapplication-extension"); in ConstructJob()
5619 // Handle GCC-style exception args. in ConstructJob()
5626 CmdArgs.push_back("-fsjlj-exceptions"); in ConstructJob()
5631 CmdArgs.push_back("-fno-assume-sane-operator-new"); in ConstructJob()
5633 // -fsized-deallocation is off by default, as it is an ABI-breaking change for in ConstructJob()
5637 CmdArgs.push_back("-fsized-deallocation"); in ConstructJob()
5639 // -fconstant-cfstrings is default, and may be subject to argument translation in ConstructJob()
5645 CmdArgs.push_back("-fno-constant-cfstrings"); in ConstructJob()
5647 // -fshort-wchar default varies depending on platform; only in ConstructJob()
5651 A->render(Args, CmdArgs); in ConstructJob()
5653 // -fno-pascal-strings is default, only pass non-default. in ConstructJob()
5656 CmdArgs.push_back("-fpascal-strings"); in ConstructJob()
5658 // Honor -fpack-struct= and -fpack-struct, if given. Note that in ConstructJob()
5659 // -fno-pack-struct doesn't apply to -fpack-struct=. in ConstructJob()
5661 std::string PackStructStr = "-fpack-struct="; in ConstructJob()
5662 PackStructStr += A->getValue(); in ConstructJob()
5666 CmdArgs.push_back("-fpack-struct=1"); in ConstructJob()
5669 // Handle -fmax-type-align=N and -fno-type-align in ConstructJob()
5673 std::string MaxTypeAlignStr = "-fmax-type-align="; in ConstructJob()
5674 MaxTypeAlignStr += A->getValue(); in ConstructJob()
5679 std::string MaxTypeAlignStr = "-fmax-type-align=16"; in ConstructJob()
5684 // -fcommon is the default unless compiling kernel code or the target says so in ConstructJob()
5689 CmdArgs.push_back("-fno-common"); in ConstructJob()
5691 // -fsigned-bitfields is default, and clang doesn't yet support in ConstructJob()
5692 // -funsigned-bitfields. in ConstructJob()
5696 << Args.getLastArg(options::OPT_funsigned_bitfields)->getAsString(Args); in ConstructJob()
5698 // -fsigned-bitfields is default, and clang doesn't support -fno-for-scope. in ConstructJob()
5701 << Args.getLastArg(options::OPT_fno_for_scope)->getAsString(Args); in ConstructJob()
5703 // -finput_charset=UTF-8 is default. Reject others in ConstructJob()
5705 StringRef value = inputCharset->getValue(); in ConstructJob()
5706 if (value != "UTF-8") in ConstructJob()
5707 D.Diag(diag::err_drv_invalid_value) << inputCharset->getAsString(Args) in ConstructJob()
5711 // -fexec_charset=UTF-8 is default. Reject others in ConstructJob()
5713 StringRef value = execCharset->getValue(); in ConstructJob()
5714 if (value != "UTF-8") in ConstructJob()
5715 D.Diag(diag::err_drv_invalid_value) << execCharset->getAsString(Args) in ConstructJob()
5719 // -fcaret-diagnostics is default. in ConstructJob()
5722 CmdArgs.push_back("-fno-caret-diagnostics"); in ConstructJob()
5724 // -fdiagnostics-fixit-info is default, only pass non-default. in ConstructJob()
5727 CmdArgs.push_back("-fno-diagnostics-fixit-info"); in ConstructJob()
5729 // Enable -fdiagnostics-show-option by default. in ConstructJob()
5732 CmdArgs.push_back("-fdiagnostics-show-option"); in ConstructJob()
5736 CmdArgs.push_back("-fdiagnostics-show-category"); in ConstructJob()
5737 CmdArgs.push_back(A->getValue()); in ConstructJob()
5741 CmdArgs.push_back("-fdiagnostics-format"); in ConstructJob()
5742 CmdArgs.push_back(A->getValue()); in ConstructJob()
5748 if (A->getOption().matches( in ConstructJob()
5750 CmdArgs.push_back("-fdiagnostics-show-note-include-stack"); in ConstructJob()
5752 CmdArgs.push_back("-fno-diagnostics-show-note-include-stack"); in ConstructJob()
5756 // and later re-parsed to construct this job; claim any possible in ConstructJob()
5760 const Option &O = A->getOption(); in ConstructJob()
5768 StringRef Value(A->getValue()); in ConstructJob()
5771 << ("-fdiagnostics-color=" + Value).str(); in ConstructJob()
5773 A->claim(); in ConstructJob()
5776 CmdArgs.push_back("-fcolor-diagnostics"); in ConstructJob()
5779 CmdArgs.push_back("-fansi-escape-codes"); in ConstructJob()
5783 CmdArgs.push_back("-fno-show-source-location"); in ConstructJob()
5787 CmdArgs.push_back("-fno-show-column"); in ConstructJob()
5791 CmdArgs.push_back("-fno-spell-checking"); in ConstructJob()
5793 // -fno-asm-blocks is default. in ConstructJob()
5796 CmdArgs.push_back("-fasm-blocks"); in ConstructJob()
5798 // -fgnu-inline-asm is default. in ConstructJob()
5801 CmdArgs.push_back("-fno-gnu-inline-asm"); in ConstructJob()
5811 CmdArgs.push_back("-vectorize-loops"); in ConstructJob()
5813 // -fslp-vectorize is enabled based on the optimization level selected. in ConstructJob()
5819 CmdArgs.push_back("-vectorize-slp"); in ConstructJob()
5821 // -fno-slp-vectorize-aggressive is default. in ConstructJob()
5824 CmdArgs.push_back("-vectorize-slp-aggressive"); in ConstructJob()
5827 A->render(Args, CmdArgs); in ConstructJob()
5831 A->render(Args, CmdArgs); in ConstructJob()
5833 // -fdollars-in-identifiers default varies depending on platform and in ConstructJob()
5837 if (A->getOption().matches(options::OPT_fdollars_in_identifiers)) in ConstructJob()
5838 CmdArgs.push_back("-fdollars-in-identifiers"); in ConstructJob()
5840 CmdArgs.push_back("-fno-dollars-in-identifiers"); in ConstructJob()
5843 // -funit-at-a-time is default, and we don't support -fno-unit-at-a-time for in ConstructJob()
5847 if (A->getOption().matches(options::OPT_fno_unit_at_a_time)) in ConstructJob()
5848 D.Diag(diag::warn_drv_clang_unsupported) << A->getAsString(Args); in ConstructJob()
5853 CmdArgs.push_back("-fapple-pragma-pack"); in ConstructJob()
5855 // le32-specific flags: in ConstructJob()
5856 // -fno-math-builtin: clang should not convert math builtins to intrinsics in ConstructJob()
5859 CmdArgs.push_back("-fno-math-builtin"); in ConstructJob()
5862 // Default to -fno-builtin-str{cat,cpy} on Darwin for ARM. in ConstructJob()
5870 CmdArgs.push_back("-fno-builtin-strcat"); in ConstructJob()
5872 CmdArgs.push_back("-fno-builtin-strcpy"); in ConstructJob()
5878 // TODO: Once -module-dependency-dir works with -frewrite-includes it'd be in ConstructJob()
5883 CmdArgs.push_back("-frewrite-includes"); in ConstructJob()
5885 // Only allow -traditional or -traditional-cpp outside in preprocessing modes. in ConstructJob()
5889 CmdArgs.push_back("-traditional-cpp"); in ConstructJob()
5891 D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); in ConstructJob()
5899 CmdArgs.push_back("-serialize-diagnostic-file"); in ConstructJob()
5900 CmdArgs.push_back(Args.MakeArgString(A->getValue())); in ConstructJob()
5904 CmdArgs.push_back("-fretain-comments-from-system-headers"); in ConstructJob()
5906 // Forward -fcomment-block-commands to -cc1. in ConstructJob()
5908 // Forward -fparse-all-comments to -cc1. in ConstructJob()
5911 // Turn -fplugin=name.so into -load name.so in ConstructJob()
5913 CmdArgs.push_back("-load"); in ConstructJob()
5914 CmdArgs.push_back(A->getValue()); in ConstructJob()
5915 A->claim(); in ConstructJob()
5918 // Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option in ConstructJob()
5922 A->claim(); in ConstructJob()
5924 // We translate this by hand to the -cc1 argument, since nightly test uses in ConstructJob()
5925 // it and developers have been trained to spell it with -mllvm. in ConstructJob()
5926 if (StringRef(A->getValue(0)) == "-disable-llvm-optzns") { in ConstructJob()
5927 CmdArgs.push_back("-disable-llvm-optzns"); in ConstructJob()
5929 A->render(Args, CmdArgs); in ConstructJob()
5932 // With -save-temps, we want to save the unoptimized bitcode output from the in ConstructJob()
5933 // CompileJobAction, use -disable-llvm-passes to get pristine IR generated in ConstructJob()
5935 // When -fembed-bitcode is enabled, optimized bitcode is emitted because it in ConstructJob()
5937 // FIXME: -fembed-bitcode -save-temps will save optimized bitcode instead of in ConstructJob()
5942 CmdArgs.push_back("-disable-llvm-passes"); in ConstructJob()
5947 CmdArgs.push_back("-o"); in ConstructJob()
5964 // Optionally embed the -cc1 level arguments into the debug info, for build in ConstructJob()
5969 Arg->render(Args, OriginalArgs); in ConstructJob()
5979 CmdArgs.push_back("-dwarf-debug-flags"); in ConstructJob()
5990 CmdArgs.push_back("-split-dwarf-file"); in ConstructJob()
5995 // Host-side cuda compilation receives device-side outputs as Inputs[1...]. in ConstructJob()
5996 // Include them with -fcuda-include-gpubinary. in ConstructJob()
5999 CmdArgs.push_back("-fcuda-include-gpubinary"); in ConstructJob()
6000 CmdArgs.push_back(I->getFilename()); in ConstructJob()
6009 << "-fwhole-program-vtables" in ConstructJob()
6010 << "-flto"; in ConstructJob()
6011 CmdArgs.push_back("-fwhole-program-vtables"); in ConstructJob()
6019 getCLFallback()->GetCommand(C, JA, Output, Inputs, Args, LinkingOutput); in ConstructJob()
6040 D.Diag(diag::err_drv_argument_not_allowed_with) << "-fomit-frame-pointer" in ConstructJob()
6041 << A->getAsString(Args); in ConstructJob()
6045 // -fpch-preprocess is used with gcc to add a special marker in the output to in ConstructJob()
6055 // Disable warnings for clang -E -emit-llvm foo.c in ConstructJob()
6059 /// Add options related to the Objective-C runtime/ABI.
6061 /// Returns true if the runtime is non-fragile.
6070 // Just forward -fobjc-runtime= to the frontend. This supercedes in AddObjCRuntimeArgs()
6073 runtimeArg->getOption().matches(options::OPT_fobjc_runtime_EQ)) { in AddObjCRuntimeArgs()
6075 StringRef value = runtimeArg->getValue(); in AddObjCRuntimeArgs()
6081 runtimeArg->render(args, cmdArgs); in AddObjCRuntimeArgs()
6087 // 1 - Traditional "fragile" ABI in AddObjCRuntimeArgs()
6088 // 2 - Non-fragile ABI, version 1 in AddObjCRuntimeArgs()
6089 // 3 - Non-fragile ABI, version 2 in AddObjCRuntimeArgs()
6091 // If -fobjc-abi-version= is present, use that to set the version. in AddObjCRuntimeArgs()
6093 StringRef value = abiArg->getValue(); in AddObjCRuntimeArgs()
6103 // Otherwise, determine if we are using the non-fragile ABI. in AddObjCRuntimeArgs()
6111 // Determine the non-fragile ABI version to use. in AddObjCRuntimeArgs()
6120 StringRef value = abiArg->getValue(); in AddObjCRuntimeArgs()
6137 // it's non-fragile. in AddObjCRuntimeArgs()
6156 // -fnext-runtime in AddObjCRuntimeArgs()
6157 } else if (runtimeArg->getOption().matches(options::OPT_fnext_runtime)) { in AddObjCRuntimeArgs()
6167 // -fgnu-runtime in AddObjCRuntimeArgs()
6169 assert(runtimeArg->getOption().matches(options::OPT_fgnu_runtime)); in AddObjCRuntimeArgs()
6171 // non-fragile mode or the GCC runtime in fragile mode. in AddObjCRuntimeArgs()
6179 args.MakeArgString("-fobjc-runtime=" + runtime.getAsString())); in AddObjCRuntimeArgs()
6184 bool HaveDash = (I + 1 < EH.size() && EH[I + 1] == '-'); in maybeConsumeDash()
6199 /// - s: Cleanup after "synchronous" exceptions, aka C++ exceptions.
6200 /// - a: Cleanup after "asynchronous" exceptions, aka structured exceptions.
6202 /// - c: Assume that extern "C" functions are implicitly nounwind.
6203 /// The default is /EHs-c-, meaning cleanups are disabled.
6232 // The /GX, /GX- flags are only processed if there are not /EH flags. in parseClangCLEHFlags()
6256 RTOptionID = A->getOption().getID(); in AddClangCLArgs()
6262 CmdArgs.push_back("-D_DEBUG"); in AddClangCLArgs()
6263 CmdArgs.push_back("-D_MT"); in AddClangCLArgs()
6264 CmdArgs.push_back("-D_DLL"); in AddClangCLArgs()
6265 FlagForCRT = "--dependent-lib=msvcrt"; in AddClangCLArgs()
6268 CmdArgs.push_back("-D_DEBUG"); in AddClangCLArgs()
6269 CmdArgs.push_back("-D_MT"); in AddClangCLArgs()
6270 CmdArgs.push_back("-D_DLL"); in AddClangCLArgs()
6271 FlagForCRT = "--dependent-lib=msvcrtd"; in AddClangCLArgs()
6275 CmdArgs.push_back("-D_DEBUG"); in AddClangCLArgs()
6276 CmdArgs.push_back("-D_MT"); in AddClangCLArgs()
6277 CmdArgs.push_back("-flto-visibility-public-std"); in AddClangCLArgs()
6278 FlagForCRT = "--dependent-lib=libcmt"; in AddClangCLArgs()
6281 CmdArgs.push_back("-D_DEBUG"); in AddClangCLArgs()
6282 CmdArgs.push_back("-D_MT"); in AddClangCLArgs()
6283 CmdArgs.push_back("-flto-visibility-public-std"); in AddClangCLArgs()
6284 FlagForCRT = "--dependent-lib=libcmtd"; in AddClangCLArgs()
6291 CmdArgs.push_back("-D_VC_NODEFAULTLIB"); in AddClangCLArgs()
6298 CmdArgs.push_back("--dependent-lib=oldnames"); in AddClangCLArgs()
6305 A->render(Args, CmdArgs); in AddClangCLArgs()
6310 CmdArgs.push_back("-fno-rtti-data"); in AddClangCLArgs()
6312 // This controls whether or not we emit stack-protector instrumentation. in AddClangCLArgs()
6316 CmdArgs.push_back("-stack-protector"); in AddClangCLArgs()
6320 // Emit CodeView if -Z7 or -Zd are present. in AddClangCLArgs()
6324 if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7)) in AddClangCLArgs()
6328 CmdArgs.push_back("-gcodeview"); in AddClangCLArgs()
6337 CmdArgs.push_back("-fcxx-exceptions"); in AddClangCLArgs()
6338 CmdArgs.push_back("-fexceptions"); in AddClangCLArgs()
6341 CmdArgs.push_back("-fexternc-nounwind"); in AddClangCLArgs()
6343 // /EP should expand to -E -P. in AddClangCLArgs()
6345 CmdArgs.push_back("-E"); in AddClangCLArgs()
6346 CmdArgs.push_back("-P"); in AddClangCLArgs()
6357 VolatileOptionID = A->getOption().getID(); in AddClangCLArgs()
6360 CmdArgs.push_back("-fms-volatile"); in AddClangCLArgs()
6366 << MostGeneralArg->getAsString(Args) << BestCaseArg->getAsString(Args); in AddClangCLArgs()
6377 << FirstConflict->getAsString(Args) in AddClangCLArgs()
6378 << SecondConflict->getAsString(Args); in AddClangCLArgs()
6381 CmdArgs.push_back("-fms-memptr-rep=single"); in AddClangCLArgs()
6383 CmdArgs.push_back("-fms-memptr-rep=multiple"); in AddClangCLArgs()
6385 CmdArgs.push_back("-fms-memptr-rep=virtual"); in AddClangCLArgs()
6389 CmdArgs.push_back("-fdefault-calling-conv=cdecl"); in AddClangCLArgs()
6391 CmdArgs.push_back("-fdefault-calling-conv=fastcall"); in AddClangCLArgs()
6393 CmdArgs.push_back("-fdefault-calling-conv=stdcall"); in AddClangCLArgs()
6395 CmdArgs.push_back("-fdefault-calling-conv=vectorcall"); in AddClangCLArgs()
6398 A->render(Args, CmdArgs); in AddClangCLArgs()
6401 CmdArgs.push_back("-fdiagnostics-format"); in AddClangCLArgs()
6403 CmdArgs.push_back("msvc-fallback"); in AddClangCLArgs()
6422 CmdArgs.push_back("-target-abi"); in AddMIPSTargetArgs()
6439 // Don't warn about "clang -w -c foo.s" in ConstructJob()
6441 // and "clang -emit-llvm -c foo.s" in ConstructJob()
6446 // Invoke ourselves in -cc1as mode. in ConstructJob()
6449 CmdArgs.push_back("-cc1as"); in ConstructJob()
6452 CmdArgs.push_back("-triple"); in ConstructJob()
6457 CmdArgs.push_back("-filetype"); in ConstructJob()
6461 // -save-temps or preprocessed assembly. in ConstructJob()
6462 CmdArgs.push_back("-main-file-name"); in ConstructJob()
6468 CmdArgs.push_back("-target-cpu"); in ConstructJob()
6475 // Ignore explicit -force_cpusubtype_ALL option. in ConstructJob()
6478 // Pass along any -I options so we get proper .include search paths. in ConstructJob()
6483 while (SourceAction->getKind() != Action::InputClass) { in ConstructJob()
6484 assert(!SourceAction->getInputs().empty() && "unexpected root action!"); in ConstructJob()
6485 SourceAction = SourceAction->getInputs()[0]; in ConstructJob()
6488 // Forward -g and handle debug info related flags, assuming we are dealing in ConstructJob()
6494 WantDebug = !A->getOption().matches(options::OPT_g0) && in ConstructJob()
6495 !A->getOption().matches(options::OPT_ggdb0); in ConstructJob()
6497 DwarfVersion = DwarfVersionNum(A->getSpelling()); in ConstructJob()
6504 if (SourceAction->getType() == types::TY_Asm || in ConstructJob()
6505 SourceAction->getType() == types::TY_PP_Asm) { in ConstructJob()
6508 // that some assembler invocation receives no -debug-info-kind, in ConstructJob()
6512 // Add the -fdebug-compilation-dir flag if needed. in ConstructJob()
6517 CmdArgs.push_back("-dwarf-debug-producer"); in ConstructJob()
6520 // And pass along -I options in ConstructJob()
6526 // Handle -fPIC et al -- the relocation-model affects the assembler in ConstructJob()
6536 CmdArgs.push_back("-mrelocation-model"); in ConstructJob()
6540 // Optionally embed the -cc1as level arguments into the debug info, for build in ConstructJob()
6545 Arg->render(Args, OriginalArgs); in ConstructJob()
6556 CmdArgs.push_back("-dwarf-debug-flags"); in ConstructJob()
6560 // FIXME: Add -static support, once we have it. in ConstructJob()
6576 // gracefully by -cc1 (warning about unknown warning flags, etc) but -cc1as in ConstructJob()
6588 CmdArgs.push_back("-o"); in ConstructJob()
6616 if (forwardToGCC(A->getOption())) { in ConstructJob()
6621 A->claim(); in ConstructJob()
6623 // Don't forward any -g arguments to assembly steps. in ConstructJob()
6625 A->getOption().matches(options::OPT_g_Group)) in ConstructJob()
6628 // Don't forward any -W arguments to assembly and link steps. in ConstructJob()
6630 A->getOption().matches(options::OPT_W_Group)) in ConstructJob()
6633 A->render(Args, CmdArgs); in ConstructJob()
6641 CmdArgs.push_back("-arch"); in ConstructJob()
6656 CmdArgs.push_back("-m32"); in ConstructJob()
6661 CmdArgs.push_back("-m64"); in ConstructJob()
6664 CmdArgs.push_back("-EL"); in ConstructJob()
6669 CmdArgs.push_back("-o"); in ConstructJob()
6673 CmdArgs.push_back("-fsyntax-only"); in ConstructJob()
6678 // Only pass -x if gcc will understand it; otherwise hope gcc in ConstructJob()
6682 // like '-x foobar a.c' which will treat a.c like a linker input. in ConstructJob()
6685 // inputs into '-Wl,' options? in ConstructJob()
6698 CmdArgs.push_back("-x"); in ConstructJob()
6709 CmdArgs.push_back("-lstdc++"); in ConstructJob()
6733 CmdArgs.push_back("-E"); in RenderExtraToolArgs()
6741 // If -flto, etc. are present then make sure not to force assembly output. in RenderExtraToolArgs()
6746 CmdArgs.push_back("-c"); in RenderExtraToolArgs()
6751 CmdArgs.push_back("-c"); in RenderExtraToolArgs()
6754 CmdArgs.push_back("-S"); in RenderExtraToolArgs()
6757 CmdArgs.push_back("-fsyntax-only"); in RenderExtraToolArgs()
6785 std::string MArchString = "-march=hexagon"; in ConstructJob()
6790 std::string AsName = "hexagon-llvm-mc"; in ConstructJob()
6791 std::string MCpuString = "-mcpu=hexagon" + in ConstructJob()
6793 CmdArgs.push_back("-filetype=obj"); in ConstructJob()
6797 CmdArgs.push_back("-o"); in ConstructJob()
6801 CmdArgs.push_back("-fsyntax-only"); in ConstructJob()
6806 CmdArgs.push_back(Args.MakeArgString(std::string("-gpsize=") + N)); in ConstructJob()
6811 // Only pass -x if gcc will understand it; otherwise hope gcc in ConstructJob()
6815 // like '-x foobar a.c' which will treat a.c like a linker input. in ConstructJob()
6818 // inputs into '-Wl,' options? in ConstructJob()
6856 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6858 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6868 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6870 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6877 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6879 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6881 CmdArgs.push_back("-s"); in constructHexagonLinkArgs()
6884 CmdArgs.push_back("-r"); in constructHexagonLinkArgs()
6889 CmdArgs.push_back("-march=hexagon"); in constructHexagonLinkArgs()
6892 std::string MCpuString = "-mcpu=hexagon" + CpuVer; in constructHexagonLinkArgs()
6896 CmdArgs.push_back("-shared"); in constructHexagonLinkArgs()
6897 // The following should be the default, but doing as hexagon-gcc does. in constructHexagonLinkArgs()
6898 CmdArgs.push_back("-call_shared"); in constructHexagonLinkArgs()
6902 CmdArgs.push_back("-static"); in constructHexagonLinkArgs()
6905 CmdArgs.push_back("-pie"); in constructHexagonLinkArgs()
6909 CmdArgs.push_back(Args.MakeArgString(std::string("-G") + N)); in constructHexagonLinkArgs()
6913 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6915 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6916 CmdArgs.push_back("-o"); in constructHexagonLinkArgs()
6919 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6921 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6926 A->claim(); in constructHexagonLinkArgs()
6927 OsLibs.emplace_back(A->getValue()); in constructHexagonLinkArgs()
6935 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6937 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6946 const char *Name) -> std::string { in constructHexagonLinkArgs()
6969 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6971 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6974 CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); in constructHexagonLinkArgs()
6976 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6978 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6985 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6987 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
6991 CmdArgs.push_back("-lm"); in constructHexagonLinkArgs()
6994 CmdArgs.push_back("--start-group"); in constructHexagonLinkArgs()
6998 CmdArgs.push_back(Args.MakeArgString("-l" + Lib)); in constructHexagonLinkArgs()
6999 CmdArgs.push_back("-lc"); in constructHexagonLinkArgs()
7001 CmdArgs.push_back("-lgcc"); in constructHexagonLinkArgs()
7003 CmdArgs.push_back("--end-group"); in constructHexagonLinkArgs()
7006 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
7008 //---------------------------------------------------------------------------- in constructHexagonLinkArgs()
7028 std::string Linker = HTC.GetProgramPath("hexagon-link"); in ConstructJob()
7043 CmdArgs.push_back("-shared"); in ConstructJob()
7044 CmdArgs.push_back("-o"); in ConstructJob()
7072 CmdArgs.push_back("-flavor"); in ConstructJob()
7077 // the enabling of -ffunction-sections and -fdata-sections in in ConstructJob()
7080 CmdArgs.push_back("--gc-sections"); in ConstructJob()
7083 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
7085 CmdArgs.push_back("--strip-all"); in ConstructJob()
7087 CmdArgs.push_back("-shared"); in ConstructJob()
7089 CmdArgs.push_back("-Bstatic"); in ConstructJob()
7112 CmdArgs.push_back("-lpthread"); in ConstructJob()
7114 CmdArgs.push_back("-lc"); in ConstructJob()
7115 CmdArgs.push_back("-lcompiler_rt"); in ConstructJob()
7121 CmdArgs.push_back("-o"); in ConstructJob()
7135 // Handle -march=native. in getARMArch()
7157 // here means an -march=native that we can't handle, so instead return no CPU. in getARMCPUForMArch()
7166 /// getARMTargetCPU - Get the (LLVM) name of the ARM cpu we are targeting.
7169 // FIXME: Warn on inconsistent use of -mcpu and -march. in getARMTargetCPU()
7170 // If we have -mcpu=, use that. in getARMTargetCPU()
7173 // Handle -mcpu=native. in getARMTargetCPU()
7183 /// getLLVMArchSuffixForARM - Get the LLVM arch name to use for a particular
7185 // FIXME: This is redundant with -mcpu, why does LLVM use this.
7197 // FIXME: horrible hack to get around the fact that Cortex-A7 is only an in getLLVMArchSuffixForARM()
7198 // armv7k triple if it's actually been specified via "-arch armv7k". in getLLVMArchSuffixForARM()
7213 // ARMv7 (and later) and ARMv6-M do not support BE-32, so instruct the linker in appendEBLinkFlags()
7214 // to generate BE-8 executables. in appendEBLinkFlags()
7216 CmdArgs.push_back("--be8"); in appendEBLinkFlags()
7220 // Strictly speaking, mips32r2 and mips64r2 are NanLegacy-only since Nan2008 in getSupportedNanEncoding()
7252 return A && (A->getValue() == StringRef(Value)); in hasMipsAbiArg()
7257 return A && A->getOption().matches(options::OPT_muclibc); in isUCLibc()
7262 return llvm::StringSwitch<bool>(NaNArg->getValue()) in isNaN2008()
7295 // FPXX shouldn't be used if either -msoft-float or -mfloat-abi=soft is in isFPXXDefault()
7312 // FPXX shouldn't be used if -msingle-float is present. in shouldUseFPXX()
7315 if (A->getOption().matches(options::OPT_msingle_float)) in shouldUseFPXX()
7322 // See arch(3) and llvm-gcc's driver-driver.c. We don't implement support for in getArchTypeForMachOArchName()
7327 // historically the driver driver accepts this and also ties its -march= in getArchTypeForMachOArchName()
7389 std::string Str(OutputOpt->getValue()); in getDependencyFileName()
7406 // Silence warning for "clang -g foo.o -o foo" in ConstructJob()
7408 // and "clang -emit-llvm foo.o -o foo" in ConstructJob()
7410 // and for "clang -w foo.o -o foo". Other warning options are already in ConstructJob()
7415 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructJob()
7418 CmdArgs.push_back("-Bstatic"); in ConstructJob()
7421 CmdArgs.push_back("-pie"); in ConstructJob()
7422 CmdArgs.push_back("--no-dynamic-linker"); in ConstructJob()
7423 CmdArgs.push_back("-zrelro"); in ConstructJob()
7425 CmdArgs.push_back("--eh-frame-hdr"); in ConstructJob()
7426 CmdArgs.push_back("--gc-sections"); in ConstructJob()
7429 CmdArgs.push_back("-o"); in ConstructJob()
7454 CmdArgs.push_back("-lc"); in ConstructJob()
7455 CmdArgs.push_back("-lcompiler_rt"); in ConstructJob()
7477 while (SourceAction->getKind() != Action::InputClass) { in ConstructJob()
7478 assert(!SourceAction->getInputs().empty() && "unexpected root action!"); in ConstructJob()
7479 SourceAction = SourceAction->getInputs()[0]; in ConstructJob()
7482 // If -fno-integrated-as is used add -Q to the darwin assember driver to make in ConstructJob()
7484 // Applicable to darwin11+ and Xcode 4+. darwin<10 lacked integrated-as. in ConstructJob()
7485 // FIXME: at run-time detect assembler capabilities or rely on version in ConstructJob()
7486 // information forwarded by -target-assembler-version. in ConstructJob()
7490 CmdArgs.push_back("-Q"); in ConstructJob()
7493 // Forward -g, assuming we are dealing with an actual assembly file. in ConstructJob()
7494 if (SourceAction->getType() == types::TY_Asm || in ConstructJob()
7495 SourceAction->getType() == types::TY_PP_Asm) { in ConstructJob()
7497 CmdArgs.push_back("--gstabs"); in ConstructJob()
7499 CmdArgs.push_back("-g"); in ConstructJob()
7505 // Use -force_cpusubtype_ALL on x86 by default. in ConstructJob()
7509 CmdArgs.push_back("-force_cpusubtype_ALL"); in ConstructJob()
7516 CmdArgs.push_back("-static"); in ConstructJob()
7521 CmdArgs.push_back("-o"); in ConstructJob()
7540 CmdArgs.push_back("-arch"); in AddMachOArch()
7545 CmdArgs.push_back("-force_cpusubtype_ALL"); in AddMachOArch()
7567 if (!Driver::GetReleaseVersion(A->getValue(), Version)) in AddLinkArgs()
7568 D.Diag(diag::err_drv_invalid_version_number) << A->getAsString(Args); in AddLinkArgs()
7571 // Newer linkers support -demangle. Pass it if supported and not disabled by in AddLinkArgs()
7574 CmdArgs.push_back("-demangle"); in AddLinkArgs()
7577 CmdArgs.push_back("-export_dynamic"); in AddLinkArgs()
7583 CmdArgs.push_back("-application_extension"); in AddLinkArgs()
7593 CmdArgs.push_back("-object_path_lto"); in AddLinkArgs()
7597 // Use -lto_library option to specify the libLTO.dylib path. Try to find in AddLinkArgs()
7607 CmdArgs.push_back("-lto_library"); in AddLinkArgs()
7618 CmdArgs.push_back("-dynamic"); in AddLinkArgs()
7620 // FIXME: gcc replaces -lobjc in forward args with -lobjc-gnu in AddLinkArgs()
7637 D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args) in AddLinkArgs()
7638 << "-dynamiclib"; in AddLinkArgs()
7644 CmdArgs.push_back("-dylib"); in AddLinkArgs()
7653 D.Diag(diag::err_drv_argument_not_allowed_with) << A->getAsString(Args) in AddLinkArgs()
7654 << "-dynamiclib"; in AddLinkArgs()
7657 "-dylib_compatibility_version"); in AddLinkArgs()
7659 "-dylib_current_version"); in AddLinkArgs()
7664 "-dylib_install_name"); in AddLinkArgs()
7695 if (A->getOption().matches(options::OPT_fpie) || in AddLinkArgs()
7696 A->getOption().matches(options::OPT_fPIE)) in AddLinkArgs()
7697 CmdArgs.push_back("-pie"); in AddLinkArgs()
7699 CmdArgs.push_back("-no_pie"); in AddLinkArgs()
7701 // for embed-bitcode, use -bitcode_bundle in linker command in AddLinkArgs()
7706 CmdArgs.push_back("-bitcode_bundle"); in AddLinkArgs()
7728 // Give --sysroot= preference, over the Apple specific behavior to also use in AddLinkArgs()
7729 // --isysroot as the syslibroot. in AddLinkArgs()
7732 CmdArgs.push_back("-syslibroot"); in AddLinkArgs()
7735 CmdArgs.push_back("-syslibroot"); in AddLinkArgs()
7736 CmdArgs.push_back(A->getValue()); in AddLinkArgs()
7772 // -filelist linker option. in ConstructJob()
7784 Arg->claim(); in ConstructJob()
7802 // Forward -ObjC when either -ObjC or -ObjC++ is used, to force loading in ConstructJob()
7803 // members of static archive libraries which implement Objective-C classes or in ConstructJob()
7806 CmdArgs.push_back("-ObjC"); in ConstructJob()
7808 CmdArgs.push_back("-o"); in ConstructJob()
7826 // Build the input file for -filelist (list of linker input files) in case we in ConstructJob()
7831 // We cannot mix input arguments and file names in a -filelist input, thus in ConstructJob()
7851 CmdArgs.push_back("-framework"); in ConstructJob()
7854 CmdArgs.push_back("-lobjc"); in ConstructJob()
7858 CmdArgs.push_back("-arch_multiple"); in ConstructJob()
7859 CmdArgs.push_back("-final_output"); in ConstructJob()
7864 CmdArgs.push_back("-allow_stack_execute"); in ConstructJob()
7885 // -iframework should be forwarded as -F. in ConstructJob()
7887 CmdArgs.push_back(Args.MakeArgString(std::string("-F") + A->getValue())); in ConstructJob()
7891 if (A->getValue() == StringRef("Accelerate")) { in ConstructJob()
7892 CmdArgs.push_back("-framework"); in ConstructJob()
7901 Cmd->setInputFileList(std::move(InputFileList)); in ConstructJob()
7912 CmdArgs.push_back("-create"); in ConstructJob()
7915 CmdArgs.push_back("-output"); in ConstructJob()
7934 CmdArgs.push_back("-o"); in ConstructJob()
7953 CmdArgs.push_back("--verify"); in ConstructJob()
7954 CmdArgs.push_back("--debug-info"); in ConstructJob()
7955 CmdArgs.push_back("--eh-frame"); in ConstructJob()
7956 CmdArgs.push_back("--quiet"); in ConstructJob()
7980 CmdArgs.push_back("-o"); in ConstructJob()
7998 CmdArgs.push_back("-C"); in ConstructJob()
8001 CmdArgs.push_back("-e"); in ConstructJob()
8006 CmdArgs.push_back("-Bstatic"); in ConstructJob()
8007 CmdArgs.push_back("-dn"); in ConstructJob()
8009 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
8011 CmdArgs.push_back("-shared"); in ConstructJob()
8013 CmdArgs.push_back("--dynamic-linker"); in ConstructJob()
8020 CmdArgs.push_back("-o"); in ConstructJob()
8033 Args.MakeArgString(getToolChain().GetFilePath("values-Xa.o"))); in ConstructJob()
8048 CmdArgs.push_back("-lgcc_s"); in ConstructJob()
8049 CmdArgs.push_back("-lc"); in ConstructJob()
8051 CmdArgs.push_back("-lgcc"); in ConstructJob()
8052 CmdArgs.push_back("-lm"); in ConstructJob()
8078 // When building 32-bit code on OpenBSD/amd64, we have to explicitly in ConstructJob()
8079 // instruct as in the base system to assemble 32-bit code. in ConstructJob()
8080 CmdArgs.push_back("--32"); in ConstructJob()
8084 CmdArgs.push_back("-mppc"); in ConstructJob()
8085 CmdArgs.push_back("-many"); in ConstructJob()
8090 CmdArgs.push_back("-32"); in ConstructJob()
8098 CmdArgs.push_back("-64"); in ConstructJob()
8111 CmdArgs.push_back("-mabi"); in ConstructJob()
8115 CmdArgs.push_back("-EB"); in ConstructJob()
8117 CmdArgs.push_back("-EL"); in ConstructJob()
8129 CmdArgs.push_back("-o"); in ConstructJob()
8147 // Silence warning for "clang -g foo.o -o foo" in ConstructJob()
8149 // and "clang -emit-llvm foo.o -o foo" in ConstructJob()
8151 // and for "clang -w foo.o -o foo". Other warning options are already in ConstructJob()
8156 CmdArgs.push_back("-EB"); in ConstructJob()
8158 CmdArgs.push_back("-EL"); in ConstructJob()
8161 CmdArgs.push_back("-e"); in ConstructJob()
8166 CmdArgs.push_back("-Bstatic"); in ConstructJob()
8169 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
8170 CmdArgs.push_back("--eh-frame-hdr"); in ConstructJob()
8171 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
8173 CmdArgs.push_back("-shared"); in ConstructJob()
8175 CmdArgs.push_back("-dynamic-linker"); in ConstructJob()
8181 CmdArgs.push_back("-nopie"); in ConstructJob()
8184 CmdArgs.push_back("-o"); in ConstructJob()
8210 Args.MakeArgString("-L/usr/lib/gcc-lib/" + Triple + "/4.2.1")); in ConstructJob()
8222 CmdArgs.push_back("-lm_p"); in ConstructJob()
8224 CmdArgs.push_back("-lm"); in ConstructJob()
8227 // FIXME: For some reason GCC passes -lgcc before adding in ConstructJob()
8229 CmdArgs.push_back("-lgcc"); in ConstructJob()
8233 CmdArgs.push_back("-lpthread_p"); in ConstructJob()
8235 CmdArgs.push_back("-lpthread"); in ConstructJob()
8240 CmdArgs.push_back("-lc_p"); in ConstructJob()
8242 CmdArgs.push_back("-lc"); in ConstructJob()
8245 CmdArgs.push_back("-lgcc"); in ConstructJob()
8271 CmdArgs.push_back("-o"); in ConstructJob()
8290 CmdArgs.push_back("-e"); in ConstructJob()
8295 CmdArgs.push_back("-Bstatic"); in ConstructJob()
8298 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
8299 CmdArgs.push_back("--eh-frame-hdr"); in ConstructJob()
8300 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
8302 CmdArgs.push_back("-shared"); in ConstructJob()
8304 CmdArgs.push_back("-dynamic-linker"); in ConstructJob()
8310 CmdArgs.push_back("-o"); in ConstructJob()
8341 CmdArgs.push_back("-lm_p"); in ConstructJob()
8343 CmdArgs.push_back("-lm"); in ConstructJob()
8348 CmdArgs.push_back("-lpthread_p"); in ConstructJob()
8350 CmdArgs.push_back("-lpthread"); in ConstructJob()
8355 CmdArgs.push_back("-lc_p"); in ConstructJob()
8357 CmdArgs.push_back("-lc"); in ConstructJob()
8374 CmdArgs.push_back(Args.MakeArgString("-lclang_rt." + MyArch)); in ConstructJob()
8398 // When building 32-bit code on FreeBSD/amd64, we have to explicitly in ConstructJob()
8399 // instruct as in the base system to assemble 32-bit code. in ConstructJob()
8404 CmdArgs.push_back("--32"); in ConstructJob()
8407 CmdArgs.push_back("-a32"); in ConstructJob()
8417 CmdArgs.push_back("-march"); in ConstructJob()
8420 CmdArgs.push_back("-mabi"); in ConstructJob()
8425 CmdArgs.push_back("-EB"); in ConstructJob()
8427 CmdArgs.push_back("-EL"); in ConstructJob()
8430 StringRef v = A->getValue(); in ConstructJob()
8431 CmdArgs.push_back(Args.MakeArgString("-G" + v)); in ConstructJob()
8432 A->claim(); in ConstructJob()
8445 CmdArgs.push_back("-mfpu=vfp"); in ConstructJob()
8447 CmdArgs.push_back("-mfpu=softvfp"); in ConstructJob()
8453 CmdArgs.push_back("-meabi=5"); in ConstructJob()
8457 CmdArgs.push_back("-matpcs"); in ConstructJob()
8473 CmdArgs.push_back("-o"); in ConstructJob()
8497 // Silence warning for "clang -g foo.o -o foo" in ConstructJob()
8499 // and "clang -emit-llvm foo.o -o foo" in ConstructJob()
8501 // and for "clang -w foo.o -o foo". Other warning options are already in ConstructJob()
8506 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructJob()
8509 CmdArgs.push_back("-pie"); in ConstructJob()
8511 CmdArgs.push_back("--eh-frame-hdr"); in ConstructJob()
8513 CmdArgs.push_back("-Bstatic"); in ConstructJob()
8516 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
8518 CmdArgs.push_back("-Bshareable"); in ConstructJob()
8520 CmdArgs.push_back("-dynamic-linker"); in ConstructJob()
8521 CmdArgs.push_back("/libexec/ld-elf.so.1"); in ConstructJob()
8526 CmdArgs.push_back("--hash-style=both"); in ConstructJob()
8529 CmdArgs.push_back("--enable-new-dtags"); in ConstructJob()
8532 // When building 32-bit code on FreeBSD/amd64, we have to explicitly in ConstructJob()
8533 // instruct ld in the base system to link 32-bit code. in ConstructJob()
8535 CmdArgs.push_back("-m"); in ConstructJob()
8540 CmdArgs.push_back("-m"); in ConstructJob()
8549 StringRef v = A->getValue(); in ConstructJob()
8550 CmdArgs.push_back(Args.MakeArgString("-G" + v)); in ConstructJob()
8551 A->claim(); in ConstructJob()
8556 CmdArgs.push_back("-o"); in ConstructJob()
8608 CmdArgs.push_back("-lm_p"); in ConstructJob()
8610 CmdArgs.push_back("-lm"); in ConstructJob()
8614 // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding in ConstructJob()
8617 CmdArgs.push_back("-lgcc_p"); in ConstructJob()
8619 CmdArgs.push_back("-lgcc"); in ConstructJob()
8621 CmdArgs.push_back("-lgcc_eh"); in ConstructJob()
8623 CmdArgs.push_back("-lgcc_eh_p"); in ConstructJob()
8625 CmdArgs.push_back("--as-needed"); in ConstructJob()
8626 CmdArgs.push_back("-lgcc_s"); in ConstructJob()
8627 CmdArgs.push_back("--no-as-needed"); in ConstructJob()
8632 CmdArgs.push_back("-lpthread_p"); in ConstructJob()
8634 CmdArgs.push_back("-lpthread"); in ConstructJob()
8639 CmdArgs.push_back("-lc"); in ConstructJob()
8641 CmdArgs.push_back("-lc_p"); in ConstructJob()
8642 CmdArgs.push_back("-lgcc_p"); in ConstructJob()
8644 CmdArgs.push_back("-lc"); in ConstructJob()
8645 CmdArgs.push_back("-lgcc"); in ConstructJob()
8649 CmdArgs.push_back("-lgcc_eh"); in ConstructJob()
8651 CmdArgs.push_back("-lgcc_eh_p"); in ConstructJob()
8653 CmdArgs.push_back("--as-needed"); in ConstructJob()
8654 CmdArgs.push_back("-lgcc_s"); in ConstructJob()
8655 CmdArgs.push_back("--no-as-needed"); in ConstructJob()
8685 CmdArgs.push_back("--32"); in ConstructJob()
8695 CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch)); in ConstructJob()
8707 CmdArgs.push_back("-march"); in ConstructJob()
8710 CmdArgs.push_back("-mabi"); in ConstructJob()
8715 CmdArgs.push_back("-EB"); in ConstructJob()
8717 CmdArgs.push_back("-EL"); in ConstructJob()
8725 CmdArgs.push_back("-32"); in ConstructJob()
8733 CmdArgs.push_back("-64"); in ConstructJob()
8746 CmdArgs.push_back("-o"); in ConstructJob()
8765 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructJob()
8767 CmdArgs.push_back("--eh-frame-hdr"); in ConstructJob()
8769 CmdArgs.push_back("-Bstatic"); in ConstructJob()
8772 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
8774 CmdArgs.push_back("-Bshareable"); in ConstructJob()
8777 CmdArgs.push_back("-dynamic-linker"); in ConstructJob()
8786 CmdArgs.push_back("-m"); in ConstructJob()
8791 CmdArgs.push_back("-m"); in ConstructJob()
8811 CmdArgs.push_back("-m"); in ConstructJob()
8829 CmdArgs.push_back("-m"); in ConstructJob()
8835 CmdArgs.push_back("-m"); in ConstructJob()
8843 CmdArgs.push_back("-m"); in ConstructJob()
8849 CmdArgs.push_back("-m"); in ConstructJob()
8854 CmdArgs.push_back("-m"); in ConstructJob()
8859 CmdArgs.push_back("-m"); in ConstructJob()
8868 CmdArgs.push_back("-o"); in ConstructJob()
8928 CmdArgs.push_back("-lm"); in ConstructJob()
8931 CmdArgs.push_back("-lpthread"); in ConstructJob()
8932 CmdArgs.push_back("-lc"); in ConstructJob()
8939 CmdArgs.push_back("-lgcc_eh"); in ConstructJob()
8940 CmdArgs.push_back("-lc"); in ConstructJob()
8941 CmdArgs.push_back("-lgcc"); in ConstructJob()
8943 CmdArgs.push_back("-lgcc"); in ConstructJob()
8944 CmdArgs.push_back("--as-needed"); in ConstructJob()
8945 CmdArgs.push_back("-lgcc_s"); in ConstructJob()
8946 CmdArgs.push_back("--no-as-needed"); in ConstructJob()
8988 // Add --32/--64 to make sure we get the format we want. in ConstructJob()
8991 CmdArgs.push_back("--32"); in ConstructJob()
8995 CmdArgs.push_back("--x32"); in ConstructJob()
8997 CmdArgs.push_back("--64"); in ConstructJob()
9000 CmdArgs.push_back("-a32"); in ConstructJob()
9001 CmdArgs.push_back("-mppc"); in ConstructJob()
9002 CmdArgs.push_back("-many"); in ConstructJob()
9005 CmdArgs.push_back("-a64"); in ConstructJob()
9006 CmdArgs.push_back("-mppc64"); in ConstructJob()
9007 CmdArgs.push_back("-many"); in ConstructJob()
9010 CmdArgs.push_back("-a64"); in ConstructJob()
9011 CmdArgs.push_back("-mppc64"); in ConstructJob()
9012 CmdArgs.push_back("-many"); in ConstructJob()
9013 CmdArgs.push_back("-mlittle-endian"); in ConstructJob()
9017 CmdArgs.push_back("-32"); in ConstructJob()
9024 CmdArgs.push_back("-64"); in ConstructJob()
9037 CmdArgs.push_back("-mfpu=neon"); in ConstructJob()
9040 CmdArgs.push_back("-mfpu=crypto-neon-fp-armv8"); in ConstructJob()
9049 CmdArgs.push_back(Args.MakeArgString("-mfloat-abi=soft")); in ConstructJob()
9052 CmdArgs.push_back(Args.MakeArgString("-mfloat-abi=softfp")); in ConstructJob()
9055 CmdArgs.push_back(Args.MakeArgString("-mfloat-abi=hard")); in ConstructJob()
9062 // for now replace it with -mcpu=cortex-a15 to avoid a lower in ConstructJob()
9066 StringRef(A->getValue()).lower() == "krait") in ConstructJob()
9067 CmdArgs.push_back("-mcpu=cortex-a15"); in ConstructJob()
9082 CmdArgs.push_back("-march"); in ConstructJob()
9085 CmdArgs.push_back("-mabi"); in ConstructJob()
9088 // -mno-shared should be emitted unless -fpic, -fpie, -fPIC, -fPIE, in ConstructJob()
9089 // or -mshared (not implemented) is in effect. in ConstructJob()
9091 CmdArgs.push_back("-mno-shared"); in ConstructJob()
9093 // LLVM doesn't support -mplt yet and acts as if it is always given. in ConstructJob()
9094 // However, -mplt has no effect with the N64 ABI. in ConstructJob()
9095 CmdArgs.push_back(ABIName == "64" ? "-KPIC" : "-call_nonpic"); in ConstructJob()
9099 CmdArgs.push_back("-EB"); in ConstructJob()
9101 CmdArgs.push_back("-EL"); in ConstructJob()
9104 if (StringRef(A->getValue()) == "2008") in ConstructJob()
9105 CmdArgs.push_back(Args.MakeArgString("-mnan=2008")); in ConstructJob()
9108 // Add the last -mfp32/-mfpxx/-mfp64 or -mfpxx if it is enabled by default. in ConstructJob()
9111 A->claim(); in ConstructJob()
9112 A->render(Args, CmdArgs); in ConstructJob()
9116 CmdArgs.push_back("-mfpxx"); in ConstructJob()
9118 // Pass on -mmips16 or -mno-mips16. However, the assembler equivalent of in ConstructJob()
9119 // -mno-mips16 is actually -no-mips16. in ConstructJob()
9122 if (A->getOption().matches(options::OPT_mips16)) { in ConstructJob()
9123 A->claim(); in ConstructJob()
9124 A->render(Args, CmdArgs); in ConstructJob()
9126 A->claim(); in ConstructJob()
9127 CmdArgs.push_back("-no-mips16"); in ConstructJob()
9138 // support -mmsa / -mno-msa options. in ConstructJob()
9139 if (A->getOption().matches(options::OPT_mmsa)) in ConstructJob()
9140 CmdArgs.push_back(Args.MakeArgString("-mmsa")); in ConstructJob()
9156 // Always pass an -march option, since our default of z10 is later in ConstructJob()
9159 CmdArgs.push_back(Args.MakeArgString("-march=" + CPUName)); in ConstructJob()
9167 CmdArgs.push_back("-o"); in ConstructJob()
9193 CmdArgs.push_back("-lgcc"); in AddLibgcc()
9197 CmdArgs.push_back("-lgcc"); in AddLibgcc()
9200 CmdArgs.push_back("--as-needed"); in AddLibgcc()
9201 CmdArgs.push_back("-lgcc_s"); in AddLibgcc()
9203 CmdArgs.push_back("--no-as-needed"); in AddLibgcc()
9207 CmdArgs.push_back("-lgcc_eh"); in AddLibgcc()
9209 CmdArgs.push_back("-lgcc"); in AddLibgcc()
9212 // linking with non-static libgcc. in AddLibgcc()
9214 // NOTE: This fixes a link error on Android MIPS as well. The non-static in AddLibgcc()
9217 CmdArgs.push_back("-ldl"); in AddLibgcc()
9222 // Make use of compiler-rt if --rtlib option is used in AddRunTimeLibs()
9240 // through command line as --rtlib option argument. in AddRunTimeLibs()
9243 << Args.getLastArg(options::OPT_rtlib_EQ)->getValue() << "MSVC"; in AddRunTimeLibs()
9325 // Silence warning for "clang -g foo.o -o foo" in ConstructJob()
9327 // and "clang -emit-llvm foo.o -o foo" in ConstructJob()
9329 // and for "clang -w foo.o -o foo". Other warning options are already in ConstructJob()
9335 CmdArgs.push_back("-flavor"); in ConstructJob()
9336 CmdArgs.push_back("old-gnu"); in ConstructJob()
9337 CmdArgs.push_back("-target"); in ConstructJob()
9342 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructJob()
9345 CmdArgs.push_back("-pie"); in ConstructJob()
9348 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
9351 CmdArgs.push_back("-s"); in ConstructJob()
9360 CmdArgs.push_back("--eh-frame-hdr"); in ConstructJob()
9363 CmdArgs.push_back("-m"); in ConstructJob()
9369 CmdArgs.push_back("-Bstatic"); in ConstructJob()
9371 CmdArgs.push_back("-static"); in ConstructJob()
9373 CmdArgs.push_back("-shared"); in ConstructJob()
9378 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
9383 CmdArgs.push_back("-dynamic-linker"); in ConstructJob()
9388 CmdArgs.push_back("-o"); in ConstructJob()
9438 CmdArgs.push_back("--no-demangle"); in ConstructJob()
9451 CmdArgs.push_back("-Bstatic"); in ConstructJob()
9454 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
9455 CmdArgs.push_back("-lm"); in ConstructJob()
9457 // Silence warnings when linking C code with a C++ '-stdlib' argument. in ConstructJob()
9463 CmdArgs.push_back("--start-group"); in ConstructJob()
9483 CmdArgs.push_back("-lomp"); in ConstructJob()
9486 CmdArgs.push_back("-lgomp"); in ConstructJob()
9490 CmdArgs.push_back("-lrt"); in ConstructJob()
9493 CmdArgs.push_back("-liomp5"); in ConstructJob()
9504 CmdArgs.push_back("-lpthread"); in ConstructJob()
9507 CmdArgs.push_back("--wrap=pthread_create"); in ConstructJob()
9509 CmdArgs.push_back("-lc"); in ConstructJob()
9513 CmdArgs.push_back("-lgloss"); in ConstructJob()
9516 CmdArgs.push_back("--end-group"); in ConstructJob()
9522 CmdArgs.push_back("--as-needed"); in ConstructJob()
9523 CmdArgs.push_back("-lsoftfp"); in ConstructJob()
9524 CmdArgs.push_back("--no-as-needed"); in ConstructJob()
9559 "nacl-arm-macros.s"); in ConstructJob()
9586 // Silence warning for "clang -g foo.o -o foo" in ConstructJob()
9588 // and "clang -emit-llvm foo.o -o foo" in ConstructJob()
9590 // and for "clang -w foo.o -o foo". Other warning options are already in ConstructJob()
9595 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructJob()
9598 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
9601 CmdArgs.push_back("-s"); in ConstructJob()
9604 // from there is --build-id, which we do want. in ConstructJob()
9605 CmdArgs.push_back("--build-id"); in ConstructJob()
9608 CmdArgs.push_back("--eh-frame-hdr"); in ConstructJob()
9610 CmdArgs.push_back("-m"); in ConstructJob()
9624 CmdArgs.push_back("-static"); in ConstructJob()
9626 CmdArgs.push_back("-shared"); in ConstructJob()
9628 CmdArgs.push_back("-o"); in ConstructJob()
9651 CmdArgs.push_back("--no-demangle"); in ConstructJob()
9660 CmdArgs.push_back("-Bstatic"); in ConstructJob()
9663 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
9664 CmdArgs.push_back("-lm"); in ConstructJob()
9670 CmdArgs.push_back("--start-group"); in ConstructJob()
9671 CmdArgs.push_back("-lc"); in ConstructJob()
9677 // without '-lnacl' it prefers symbols from libpthread.a over libnacl.a, in ConstructJob()
9679 // See https://sourceware.org/ml/binutils/2015-03/msg00034.html in ConstructJob()
9681 CmdArgs.push_back("-lnacl"); in ConstructJob()
9683 CmdArgs.push_back("-lpthread"); in ConstructJob()
9686 CmdArgs.push_back("-lgcc"); in ConstructJob()
9687 CmdArgs.push_back("--as-needed"); in ConstructJob()
9689 CmdArgs.push_back("-lgcc_eh"); in ConstructJob()
9691 CmdArgs.push_back("-lgcc_s"); in ConstructJob()
9692 CmdArgs.push_back("--no-as-needed"); in ConstructJob()
9698 CmdArgs.push_back("-lpnacl_legacy"); in ConstructJob()
9700 CmdArgs.push_back("--end-group"); in ConstructJob()
9729 CmdArgs.push_back("-o"); in ConstructJob()
9748 CmdArgs.push_back("-o"); in ConstructJob()
9772 CmdArgs.push_back("-lm"); in ConstructJob()
9778 CmdArgs.push_back("-lpthread"); in ConstructJob()
9779 CmdArgs.push_back("-lc"); in ConstructJob()
9780 CmdArgs.push_back("-lCompilerRT-Generic"); in ConstructJob()
9781 CmdArgs.push_back("-L/usr/pkg/compiler-rt/lib"); in ConstructJob()
9802 // When building 32-bit code on DragonFly/pc64, we have to explicitly in ConstructJob()
9803 // instruct as in the base system to assemble 32-bit code. in ConstructJob()
9805 CmdArgs.push_back("--32"); in ConstructJob()
9809 CmdArgs.push_back("-o"); in ConstructJob()
9828 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructJob()
9830 CmdArgs.push_back("--eh-frame-hdr"); in ConstructJob()
9832 CmdArgs.push_back("-Bstatic"); in ConstructJob()
9835 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
9837 CmdArgs.push_back("-Bshareable"); in ConstructJob()
9839 CmdArgs.push_back("-dynamic-linker"); in ConstructJob()
9840 CmdArgs.push_back("/usr/libexec/ld-elf.so.2"); in ConstructJob()
9842 CmdArgs.push_back("--hash-style=gnu"); in ConstructJob()
9843 CmdArgs.push_back("--enable-new-dtags"); in ConstructJob()
9846 // When building 32-bit code on DragonFly/pc64, we have to explicitly in ConstructJob()
9847 // instruct ld in the base system to link 32-bit code. in ConstructJob()
9849 CmdArgs.push_back("-m"); in ConstructJob()
9854 CmdArgs.push_back("-o"); in ConstructJob()
9889 CmdArgs.push_back("-L/usr/lib/gcc50"); in ConstructJob()
9892 CmdArgs.push_back("-rpath"); in ConstructJob()
9898 CmdArgs.push_back("-lm"); in ConstructJob()
9902 CmdArgs.push_back("-lpthread"); in ConstructJob()
9905 CmdArgs.push_back("-lc"); in ConstructJob()
9910 CmdArgs.push_back("-lgcc"); in ConstructJob()
9911 CmdArgs.push_back("-lgcc_eh"); in ConstructJob()
9914 CmdArgs.push_back("-lgcc_pic"); in ConstructJob()
9916 CmdArgs.push_back("-lgcc"); in ConstructJob()
9918 CmdArgs.push_back("-lgcc"); in ConstructJob()
9919 CmdArgs.push_back("--as-needed"); in ConstructJob()
9920 CmdArgs.push_back("-lgcc_pic"); in ConstructJob()
9921 CmdArgs.push_back("--no-as-needed"); in ConstructJob()
9944 // making sure that whatever executable that's found is not a same-named exe
9973 Args.MakeArgString(std::string("-out:") + Output.getFilename())); in ConstructJob()
9977 CmdArgs.push_back("-defaultlib:libcmt"); in ConstructJob()
10003 Args.MakeArgString(std::string("-libpath:") + LibDir.c_str())); in ConstructJob()
10008 CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") + in ConstructJob()
10015 CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") + in ConstructJob()
10021 CmdArgs.push_back(Args.MakeArgString("-libpath:" + LibPath)); in ConstructJob()
10023 CmdArgs.push_back("-nologo"); in ConstructJob()
10027 CmdArgs.push_back("-debug"); in ConstructJob()
10032 CmdArgs.push_back(Args.MakeArgString("-dll")); in ConstructJob()
10036 CmdArgs.push_back(Args.MakeArgString(std::string("-implib:") + ImplibName)); in ConstructJob()
10040 CmdArgs.push_back(Args.MakeArgString("-debug")); in ConstructJob()
10041 CmdArgs.push_back(Args.MakeArgString("-incremental:no")); in ConstructJob()
10047 CmdArgs.push_back(Args.MakeArgString("-include:___asan_seh_interceptor")); in ConstructJob()
10060 CmdArgs.push_back("-nodefaultlib:vcomp.lib"); in ConstructJob()
10061 CmdArgs.push_back("-nodefaultlib:vcompd.lib"); in ConstructJob()
10062 CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") + in ConstructJob()
10066 CmdArgs.push_back("-defaultlib:libomp.lib"); in ConstructJob()
10069 CmdArgs.push_back("-defaultlib:libiomp5md.lib"); in ConstructJob()
10079 // Add compiler-rt lib in case if it was explicitly in ConstructJob()
10080 // specified as an argument for --rtlib option. in ConstructJob()
10094 // Render -l options differently for the MSVC linker. in ConstructJob()
10106 // Otherwise, this is some other kind of linker input option like -Wl, -z, in ConstructJob()
10107 // or -L. Render it, even if MSVC doesn't understand it. in ConstructJob()
10114 // translate 'lld' into 'lld-link', and in the case of the regular msvc in ConstructJob()
10119 Linker = "lld-link"; in ConstructJob()
10155 // any flag accepted by clang-cl. in GetCommand()
10162 CmdArgs.push_back(A->getOption().getID() == options::OPT_fbuiltin ? "/Oi" in GetCommand()
10163 : "/Oi-"); in GetCommand()
10165 if (A->getOption().getID() == options::OPT_O0) { in GetCommand()
10170 StringRef OptLevel = A->getValue(); in GetCommand()
10181 CmdArgs.push_back(A->getOption().getID() == options::OPT_fomit_frame_pointer in GetCommand()
10183 : "/Oy-"); in GetCommand()
10187 // Flags for which clang-cl has an alias. in GetCommand()
10188 // FIXME: How can we ensure this stays in sync with relevant clang-cl options? in GetCommand()
10192 CmdArgs.push_back("/GR-"); in GetCommand()
10196 CmdArgs.push_back("/GS-"); in GetCommand()
10200 CmdArgs.push_back(A->getOption().getID() == options::OPT_ffunction_sections in GetCommand()
10202 : "/Gy-"); in GetCommand()
10206 A->getOption().getID() == options::OPT_fdata_sections ? "/Gw" : "/Gw-"); in GetCommand()
10229 A->render(Args, CmdArgs); in GetCommand()
10268 CmdArgs.push_back("--32"); in ConstructJob()
10270 CmdArgs.push_back("--64"); in ConstructJob()
10275 CmdArgs.push_back("-o"); in ConstructJob()
10292 CmdArgs.push_back("-lmingwthrd"); in AddLibGCC()
10293 CmdArgs.push_back("-lmingw32"); in AddLibGCC()
10295 // Make use of compiler-rt if --rtlib option is used in AddLibGCC()
10304 CmdArgs.push_back("-lgcc"); in AddLibGCC()
10305 CmdArgs.push_back("-lgcc_eh"); in AddLibGCC()
10307 CmdArgs.push_back("-lgcc_s"); in AddLibGCC()
10308 CmdArgs.push_back("-lgcc"); in AddLibGCC()
10314 CmdArgs.push_back("-lmoldname"); in AddLibGCC()
10315 CmdArgs.push_back("-lmingwex"); in AddLibGCC()
10316 CmdArgs.push_back("-lmsvcrt"); in AddLibGCC()
10330 // Silence warning for "clang -g foo.o -o foo" in ConstructJob()
10332 // and "clang -emit-llvm foo.o -o foo" in ConstructJob()
10334 // and for "clang -w foo.o -o foo". Other warning options are already in ConstructJob()
10340 CmdArgs.push_back("-flavor"); in ConstructJob()
10347 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructJob()
10350 CmdArgs.push_back("-s"); in ConstructJob()
10352 CmdArgs.push_back("-m"); in ConstructJob()
10361 CmdArgs.push_back("--subsystem"); in ConstructJob()
10364 CmdArgs.push_back("--subsystem"); in ConstructJob()
10369 CmdArgs.push_back("-Bstatic"); in ConstructJob()
10372 CmdArgs.push_back("--dll"); in ConstructJob()
10374 CmdArgs.push_back("--shared"); in ConstructJob()
10375 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
10377 CmdArgs.push_back("-e"); in ConstructJob()
10382 CmdArgs.push_back("--enable-auto-image-base"); in ConstructJob()
10386 CmdArgs.push_back("-o"); in ConstructJob()
10390 // FIXME: add -N, -n flags in ConstructJob()
10424 CmdArgs.push_back("-Bstatic"); in ConstructJob()
10427 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
10433 CmdArgs.push_back("--start-group"); in ConstructJob()
10438 CmdArgs.push_back("-lssp_nonshared"); in ConstructJob()
10439 CmdArgs.push_back("-lssp"); in ConstructJob()
10442 CmdArgs.push_back("-lgomp"); in ConstructJob()
10447 CmdArgs.push_back("-lgmon"); in ConstructJob()
10450 CmdArgs.push_back("-lpthread"); in ConstructJob()
10454 CmdArgs.push_back("-lgdi32"); in ConstructJob()
10455 CmdArgs.push_back("-lcomdlg32"); in ConstructJob()
10457 CmdArgs.push_back("-ladvapi32"); in ConstructJob()
10458 CmdArgs.push_back("-lshell32"); in ConstructJob()
10459 CmdArgs.push_back("-luser32"); in ConstructJob()
10460 CmdArgs.push_back("-lkernel32"); in ConstructJob()
10463 CmdArgs.push_back("--end-group"); in ConstructJob()
10490 CmdArgs.push_back("-o"); in ConstructJob()
10493 CmdArgs.push_back("-c"); in ConstructJob()
10496 CmdArgs.push_back("-v"); in ConstructJob()
10499 if (!A->getOption().matches(options::OPT_g0)) in ConstructJob()
10500 CmdArgs.push_back("-g"); in ConstructJob()
10504 CmdArgs.push_back("-fverbose-asm"); in ConstructJob()
10523 CmdArgs.push_back("-o"); in ConstructJob()
10530 CmdArgs.push_back("-v"); in ConstructJob()
10532 // Pass -fexceptions through to the linker if it was present. in ConstructJob()
10535 CmdArgs.push_back("-fexceptions"); in ConstructJob()
10561 CmdArgs.push_back("--32"); in ConstructJob()
10564 CmdArgs.push_back("--64"); in ConstructJob()
10570 CmdArgs.push_back("-o"); in ConstructJob()
10595 // Silence warning for "clang -g foo.o -o foo" in ConstructJob()
10597 // and "clang -emit-llvm foo.o -o foo" in ConstructJob()
10599 // and for "clang -w foo.o -o foo" in ConstructJob()
10604 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructJob()
10607 CmdArgs.push_back("-pie"); in ConstructJob()
10609 CmdArgs.push_back("-export-dynamic"); in ConstructJob()
10611 CmdArgs.push_back("--strip-all"); in ConstructJob()
10613 CmdArgs.push_back("-m"); in ConstructJob()
10645 CmdArgs.push_back("-shared"); in ConstructJob()
10646 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
10648 CmdArgs.push_back("--enable-auto-image-base"); in ConstructJob()
10650 CmdArgs.push_back("--entry"); in ConstructJob()
10655 CmdArgs.push_back(Args.hasArg(options::OPT_static) ? "-Bstatic" in ConstructJob()
10656 : "-Bdynamic"); in ConstructJob()
10659 CmdArgs.push_back("--entry"); in ConstructJob()
10667 CmdArgs.push_back("--allow-multiple-definition"); in ConstructJob()
10669 CmdArgs.push_back("-o"); in ConstructJob()
10676 CmdArgs.push_back("--out-implib"); in ConstructJob()
10698 CmdArgs.push_back("-Bstatic"); in ConstructJob()
10701 CmdArgs.push_back("-Bdynamic"); in ConstructJob()
10707 CmdArgs.push_back("-lmsvcrt"); in ConstructJob()
10721 CmdArgs.push_back(Args.MakeArgString("--undefined")); in ConstructJob()
10746 CmdArgs.push_back("-E"); in ConstructJob()
10749 CmdArgs.push_back("-S"); in ConstructJob()
10750 CmdArgs.push_back("-fno-exceptions"); // Always do this even if unspecified. in ConstructJob()
10752 CmdArgs.push_back("-DMYRIAD2"); in ConstructJob()
10754 // Append all -I, -iquote, -isystem paths, defines/undefines, in ConstructJob()
10771 C.getActions()[0]->getKind() == Action::AssembleJobClass) { in ConstructJob()
10774 CmdArgs.push_back("-MT"); in ConstructJob()
10775 CmdArgs.push_back(Args.MakeArgString(A->getValue())); in ConstructJob()
10780 CmdArgs.push_back("-o"); in ConstructJob()
10801 CmdArgs.push_back("-no6thSlotCompression"); in ConstructJob()
10805 Args.MakeArgString("-cv:" + StringRef(CPUArg->getValue()))); in ConstructJob()
10806 CmdArgs.push_back("-noSPrefixing"); in ConstructJob()
10807 CmdArgs.push_back("-a"); // Mystery option. in ConstructJob()
10810 A->claim(); in ConstructJob()
10812 Args.MakeArgString(std::string("-i:") + A->getValue(0))); in ConstructJob()
10814 CmdArgs.push_back("-elf"); // Output format. in ConstructJob()
10817 Args.MakeArgString(std::string("-o:") + Output.getFilename())); in ConstructJob()
10840 CmdArgs.push_back("-EB"); in ConstructJob()
10841 else // SHAVE assumes little-endian, and sparcel is expressly so. in ConstructJob()
10842 CmdArgs.push_back("-EL"); in ConstructJob()
10845 // but we never pass through a --sysroot option and various other bits. in ConstructJob()
10854 CmdArgs.push_back("-s"); in ConstructJob()
10856 CmdArgs.push_back("-o"); in ConstructJob()
10876 CmdArgs.push_back("-lstdc++"); in ConstructJob()
10878 CmdArgs.push_back("--start-group"); in ConstructJob()
10879 CmdArgs.push_back("-lc"); in ConstructJob()
10880 // You must provide your own "-L" option to enable finding these. in ConstructJob()
10881 CmdArgs.push_back("-lrtemscpu"); in ConstructJob()
10882 CmdArgs.push_back("-lrtemsbsp"); in ConstructJob()
10883 CmdArgs.push_back("--end-group"); in ConstructJob()
10885 CmdArgs.push_back("-lc"); in ConstructJob()
10887 CmdArgs.push_back("-lgcc"); in ConstructJob()
10895 Args.MakeArgString(TC.GetProgramPath("sparc-myriad-elf-ld")); in ConstructJob()
10910 CmdArgs.push_back("-o"); in ConstructJob()
10919 Args.MakeArgString(getToolChain().GetProgramPath("orbis-as")); in ConstructJob()
10926 CmdArgs.push_back("-lSceDbgUBSanitizer_stub_weak"); in AddPS4SanitizerArgs()
10929 CmdArgs.push_back("-lSceDbgAddressSanitizer_stub_weak"); in AddPS4SanitizerArgs()
10943 // Silence warning for "clang -g foo.o -o foo" in ConstructPS4LinkJob()
10945 // and "clang -emit-llvm foo.o -o foo" in ConstructPS4LinkJob()
10947 // and for "clang -w foo.o -o foo". Other warning options are already in ConstructPS4LinkJob()
10952 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructPS4LinkJob()
10955 CmdArgs.push_back("-pie"); in ConstructPS4LinkJob()
10958 CmdArgs.push_back("-export-dynamic"); in ConstructPS4LinkJob()
10960 CmdArgs.push_back("--oformat=so"); in ConstructPS4LinkJob()
10963 CmdArgs.push_back("-o"); in ConstructPS4LinkJob()
10979 CmdArgs.push_back("--no-demangle"); in ConstructPS4LinkJob()
10984 CmdArgs.push_back("-lpthread"); in ConstructPS4LinkJob()
10987 const char *Exec = Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld")); in ConstructPS4LinkJob()
11002 // Silence warning for "clang -g foo.o -o foo" in ConstructGoldLinkJob()
11004 // and "clang -emit-llvm foo.o -o foo" in ConstructGoldLinkJob()
11006 // and for "clang -w foo.o -o foo". Other warning options are already in ConstructGoldLinkJob()
11011 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); in ConstructGoldLinkJob()
11014 CmdArgs.push_back("-pie"); in ConstructGoldLinkJob()
11017 CmdArgs.push_back("-Bstatic"); in ConstructGoldLinkJob()
11020 CmdArgs.push_back("-export-dynamic"); in ConstructGoldLinkJob()
11021 CmdArgs.push_back("--eh-frame-hdr"); in ConstructGoldLinkJob()
11023 CmdArgs.push_back("-Bshareable"); in ConstructGoldLinkJob()
11025 CmdArgs.push_back("-dynamic-linker"); in ConstructGoldLinkJob()
11026 CmdArgs.push_back("/libexec/ld-elf.so.1"); in ConstructGoldLinkJob()
11028 CmdArgs.push_back("--enable-new-dtags"); in ConstructGoldLinkJob()
11032 CmdArgs.push_back("-o"); in ConstructGoldLinkJob()
11075 CmdArgs.push_back("--no-demangle"); in ConstructGoldLinkJob()
11082 CmdArgs.push_back("-lkernel"); in ConstructGoldLinkJob()
11086 CmdArgs.push_back("-lm_p"); in ConstructGoldLinkJob()
11088 CmdArgs.push_back("-lm"); in ConstructGoldLinkJob()
11090 // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding in ConstructGoldLinkJob()
11093 CmdArgs.push_back("-lgcc_p"); in ConstructGoldLinkJob()
11095 CmdArgs.push_back("-lcompiler_rt"); in ConstructGoldLinkJob()
11097 CmdArgs.push_back("-lstdc++"); in ConstructGoldLinkJob()
11099 CmdArgs.push_back("-lgcc_eh_p"); in ConstructGoldLinkJob()
11101 CmdArgs.push_back("--as-needed"); in ConstructGoldLinkJob()
11102 CmdArgs.push_back("-lstdc++"); in ConstructGoldLinkJob()
11103 CmdArgs.push_back("--no-as-needed"); in ConstructGoldLinkJob()
11108 CmdArgs.push_back("-lpthread_p"); in ConstructGoldLinkJob()
11110 CmdArgs.push_back("-lpthread"); in ConstructGoldLinkJob()
11115 CmdArgs.push_back("-lc"); in ConstructGoldLinkJob()
11118 CmdArgs.push_back("--start-group"); in ConstructGoldLinkJob()
11119 CmdArgs.push_back("-lc_p"); in ConstructGoldLinkJob()
11120 CmdArgs.push_back("-lpthread_p"); in ConstructGoldLinkJob()
11121 CmdArgs.push_back("--end-group"); in ConstructGoldLinkJob()
11123 CmdArgs.push_back("-lc_p"); in ConstructGoldLinkJob()
11126 CmdArgs.push_back("-lgcc_p"); in ConstructGoldLinkJob()
11129 CmdArgs.push_back("--start-group"); in ConstructGoldLinkJob()
11130 CmdArgs.push_back("-lc"); in ConstructGoldLinkJob()
11131 CmdArgs.push_back("-lpthread"); in ConstructGoldLinkJob()
11132 CmdArgs.push_back("--end-group"); in ConstructGoldLinkJob()
11134 CmdArgs.push_back("-lc"); in ConstructGoldLinkJob()
11136 CmdArgs.push_back("-lcompiler_rt"); in ConstructGoldLinkJob()
11140 CmdArgs.push_back("-lstdc++"); in ConstructGoldLinkJob()
11142 CmdArgs.push_back("-lgcc_eh_p"); in ConstructGoldLinkJob()
11144 CmdArgs.push_back("--as-needed"); in ConstructGoldLinkJob()
11145 CmdArgs.push_back("-lstdc++"); in ConstructGoldLinkJob()
11146 CmdArgs.push_back("--no-as-needed"); in ConstructGoldLinkJob()
11160 Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld.gold")); in ConstructGoldLinkJob()
11162 Args.MakeArgString(ToolChain.GetProgramPath("orbis-ld")); in ConstructGoldLinkJob()
11179 LinkerOptName = A->getValue(); in ConstructJob()
11218 CmdArgs.push_back(TC.getTriple().isArch64Bit() ? "-m64" : "-m32"); in ConstructJob()
11221 // ptxas does not accept -g option if optimization is enabled, so in ConstructJob()
11222 // we ignore the compiler's -O* options if we want debug info. in ConstructJob()
11223 CmdArgs.push_back("-g"); in ConstructJob()
11224 CmdArgs.push_back("--dont-merge-basicblocks"); in ConstructJob()
11225 CmdArgs.push_back("--return-at-end"); in ConstructJob()
11227 // Map the -O we received to -O{0,1,2,3}. in ConstructJob()
11229 // TODO: Perhaps we should map host -O2 to ptxas -O3. -O3 is ptxas's in ConstructJob()
11230 // default, so it may correspond more closely to the spirit of clang -O2. in ConstructJob()
11232 // -O3 seems like the least-bad option when -Osomething is specified to in ConstructJob()
11235 if (A->getOption().matches(options::OPT_O4) || in ConstructJob()
11236 A->getOption().matches(options::OPT_Ofast)) in ConstructJob()
11238 else if (A->getOption().matches(options::OPT_O0)) in ConstructJob()
11240 else if (A->getOption().matches(options::OPT_O)) { in ConstructJob()
11241 // -Os, -Oz, and -O(anything else) map to -O2, for lack of better options. in ConstructJob()
11242 OOpt = llvm::StringSwitch<const char *>(A->getValue()) in ConstructJob()
11250 CmdArgs.push_back(Args.MakeArgString(llvm::Twine("-O") + OOpt)); in ConstructJob()
11252 // If no -O was passed, pass -O0 to ptxas -- no opt flag should correspond in ConstructJob()
11253 // to no optimizations, but ptxas's default is -O3. in ConstructJob()
11254 CmdArgs.push_back("-O0"); in ConstructJob()
11257 CmdArgs.push_back("--gpu-name"); in ConstructJob()
11259 CmdArgs.push_back("--output-file"); in ConstructJob()
11284 CmdArgs.push_back("--cuda"); in ConstructJob()
11285 CmdArgs.push_back(TC.getTriple().isArch64Bit() ? "-64" : "-32"); in ConstructJob()
11286 CmdArgs.push_back(Args.MakeArgString("--create")); in ConstructJob()
11295 ? CudaVirtualArchToString(VirtualArchForCudaArch(A->getGpuArch())) in ConstructJob()
11296 : CudaArchToString(A->getGpuArch()); in ConstructJob()
11297 CmdArgs.push_back(Args.MakeArgString(llvm::Twine("--image=profile=") + in ConstructJob()