clang 23.0.0git
MinGW.cpp
Go to the documentation of this file.
1//===--- MinGW.cpp - MinGWToolChain Implementation ------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "MinGW.h"
10#include "clang/Config/config.h"
13#include "clang/Driver/Driver.h"
17#include "llvm/Config/llvm-config.h" // for LLVM_HOST_TRIPLE
18#include "llvm/Option/ArgList.h"
19#include "llvm/Support/FileSystem.h"
20#include "llvm/Support/Path.h"
21#include "llvm/Support/VirtualFileSystem.h"
22#include <system_error>
23
24using namespace clang::diag;
25using namespace clang::driver;
26using namespace clang;
27using namespace llvm::opt;
28
29/// MinGW Tools
31 const InputInfo &Output,
32 const InputInfoList &Inputs,
33 const ArgList &Args,
34 const char *LinkingOutput) const {
35 claimNoWarnArgs(Args);
36 ArgStringList CmdArgs;
37
38 if (getToolChain().getArch() == llvm::Triple::x86) {
39 CmdArgs.push_back("--32");
40 } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
41 CmdArgs.push_back("--64");
42 }
43
44 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
45
46 CmdArgs.push_back("-o");
47 CmdArgs.push_back(Output.getFilename());
48
49 for (const auto &II : Inputs)
50 CmdArgs.push_back(II.getFilename());
51
52 const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
53 C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(),
54 Exec, CmdArgs, Inputs, Output));
55
56 if (Args.hasArg(options::OPT_gsplit_dwarf))
57 SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
58 SplitDebugName(JA, Args, Inputs[0], Output));
59}
60
61void tools::MinGW::Linker::AddLibGCC(const ArgList &Args,
62 ArgStringList &CmdArgs) const {
63 bool NoLibc = Args.hasArg(options::OPT_nolibc);
64 if (Args.hasArg(options::OPT_mthreads))
65 CmdArgs.push_back("-lmingwthrd");
66 if (!NoLibc)
67 CmdArgs.push_back("-lmingw32");
68
69 // Make use of compiler-rt if --rtlib option is used
70 ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
71 if (RLT == ToolChain::RLT_Libgcc) {
72 bool Static = Args.hasArg(options::OPT_static_libgcc) ||
73 Args.hasArg(options::OPT_static);
74 bool Shared = Args.hasArg(options::OPT_shared);
75 bool CXX = getToolChain().getDriver().CCCIsCXX();
76
77 if (Static || (!CXX && !Shared)) {
78 CmdArgs.push_back("-lgcc");
79 CmdArgs.push_back("-lgcc_eh");
80 } else {
81 CmdArgs.push_back("-lgcc_s");
82 CmdArgs.push_back("-lgcc");
83 }
84 } else {
85 AddRunTimeLibs(getToolChain(), getToolChain().getDriver(), CmdArgs, Args);
86 }
87
88 if (!NoLibc) {
89 CmdArgs.push_back("-lmoldname");
90 CmdArgs.push_back("-lmingwex");
91 for (auto Lib : Args.getAllArgValues(options::OPT_l)) {
92 if (StringRef(Lib).starts_with("msvcr") ||
93 StringRef(Lib).starts_with("ucrt") ||
94 StringRef(Lib).starts_with("crtdll")) {
95 std::string CRTLib = (llvm::Twine("-l") + Lib).str();
96 // Respect the user's chosen crt variant, but still provide it
97 // again as the last linker argument, because some of the libraries
98 // we added above may depend on it.
99 CmdArgs.push_back(Args.MakeArgStringRef(CRTLib));
100 return;
101 }
102 }
103 CmdArgs.push_back("-lmsvcrt");
104 }
105}
106
108 const InputInfo &Output,
109 const InputInfoList &Inputs,
110 const ArgList &Args,
111 const char *LinkingOutput) const {
112 const ToolChain &TC = getToolChain();
113 const Driver &D = TC.getDriver();
114 const SanitizerArgs &Sanitize = TC.getSanitizerArgs(Args);
115
116 ArgStringList CmdArgs;
117
118 // Silence warning for "clang -g foo.o -o foo"
119 Args.ClaimAllArgs(options::OPT_g_Group);
120 // and "clang -emit-llvm foo.o -o foo"
121 Args.ClaimAllArgs(options::OPT_emit_llvm);
122 // and for "clang -w foo.o -o foo". Other warning options are already
123 // handled somewhere else.
124 Args.ClaimAllArgs(options::OPT_w);
125
126 if (!D.SysRoot.empty())
127 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
128
129 if (Args.hasArg(options::OPT_s))
130 CmdArgs.push_back("-s");
131
132 CmdArgs.push_back("-m");
133 switch (TC.getArch()) {
134 case llvm::Triple::x86:
135 CmdArgs.push_back("i386pe");
136 break;
137 case llvm::Triple::x86_64:
138 CmdArgs.push_back("i386pep");
139 break;
140 case llvm::Triple::arm:
141 case llvm::Triple::thumb:
142 // FIXME: this is incorrect for WinCE
143 CmdArgs.push_back("thumb2pe");
144 break;
145 case llvm::Triple::aarch64:
146 if (Args.hasArg(options::OPT_marm64x))
147 CmdArgs.push_back("arm64xpe");
148 else if (TC.getEffectiveTriple().isWindowsArm64EC())
149 CmdArgs.push_back("arm64ecpe");
150 else
151 CmdArgs.push_back("arm64pe");
152 break;
153 case llvm::Triple::mipsel:
154 CmdArgs.push_back("mipspe");
155 break;
156 default:
157 D.Diag(diag::err_target_unknown_triple) << TC.getEffectiveTriple().str();
158 }
159
160 Arg *SubsysArg =
161 Args.getLastArg(options::OPT_mwindows, options::OPT_mconsole);
162 if (SubsysArg && SubsysArg->getOption().matches(options::OPT_mwindows)) {
163 CmdArgs.push_back("--subsystem");
164 CmdArgs.push_back("windows");
165 } else if (SubsysArg &&
166 SubsysArg->getOption().matches(options::OPT_mconsole)) {
167 CmdArgs.push_back("--subsystem");
168 CmdArgs.push_back("console");
169 }
170
171 if (Args.hasArg(options::OPT_mdll))
172 CmdArgs.push_back("--dll");
173 else if (Args.hasArg(options::OPT_shared))
174 CmdArgs.push_back("--shared");
175 if (Args.hasArg(options::OPT_static))
176 CmdArgs.push_back("-Bstatic");
177 else
178 CmdArgs.push_back("-Bdynamic");
179 if (Args.hasArg(options::OPT_mdll) || Args.hasArg(options::OPT_shared)) {
180 CmdArgs.push_back("-e");
181 if (TC.getArch() == llvm::Triple::x86)
182 CmdArgs.push_back("_DllMainCRTStartup@12");
183 else
184 CmdArgs.push_back("DllMainCRTStartup");
185 CmdArgs.push_back("--enable-auto-image-base");
186 }
187
188 if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
189 CmdArgs.push_back("--no-demangle");
190
191 if (!Args.hasFlag(options::OPT_fauto_import, options::OPT_fno_auto_import,
192 true))
193 CmdArgs.push_back("--disable-auto-import");
194
195 if (Arg *A = Args.getLastArg(options::OPT_mguard_EQ)) {
196 StringRef GuardArgs = A->getValue();
197 if (GuardArgs == "none")
198 CmdArgs.push_back("--no-guard-cf");
199 else if (GuardArgs == "cf" || GuardArgs == "cf-nochecks")
200 CmdArgs.push_back("--guard-cf");
201 else
202 D.Diag(diag::err_drv_unsupported_option_argument)
203 << A->getSpelling() << GuardArgs;
204 }
205
206 if (Args.hasArg(options::OPT_fms_hotpatch))
207 CmdArgs.push_back("--functionpadmin");
208
209 CmdArgs.push_back("-o");
210 const char *OutputFile = Output.getFilename();
211 // GCC implicitly adds an .exe extension if it is given an output file name
212 // that lacks an extension.
213 // GCC used to do this only when the compiler itself runs on windows, but
214 // since GCC 8 it does the same when cross compiling as well.
215 if (!llvm::sys::path::has_extension(OutputFile)) {
216 CmdArgs.push_back(Args.MakeArgString(Twine(OutputFile) + ".exe"));
217 OutputFile = CmdArgs.back();
218 } else
219 CmdArgs.push_back(OutputFile);
220
221 // FIXME: add -N, -n flags
222 Args.AddLastArg(CmdArgs, options::OPT_r);
223 Args.AddLastArg(CmdArgs, options::OPT_s);
224 Args.AddLastArg(CmdArgs, options::OPT_t);
225 Args.AddAllArgs(CmdArgs, options::OPT_u_Group);
226
227 // Add asan_dynamic as the first import lib before other libs. This allows
228 // asan to be initialized as early as possible to increase its instrumentation
229 // coverage to include other user DLLs which has not been built with asan.
230 if (Sanitize.needsAsanRt() && !Args.hasArg(options::OPT_nostdlib) &&
231 !Args.hasArg(options::OPT_nodefaultlibs)) {
232 // MinGW always links against a shared MSVCRT.
233 CmdArgs.push_back(
234 TC.getCompilerRTArgString(Args, "asan_dynamic", ToolChain::FT_Shared));
235 }
236
237 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
238 if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_mdll)) {
239 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("dllcrt2.o")));
240 } else {
241 if (Args.hasArg(options::OPT_municode))
242 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crt2u.o")));
243 else
244 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crt2.o")));
245 }
246 if (Args.hasArg(options::OPT_pg))
247 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("gcrt2.o")));
248 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtbegin.o")));
249 }
250
251 Args.AddAllArgs(CmdArgs, options::OPT_L);
252 TC.AddFilePathLibArgs(Args, CmdArgs);
253
254 // Add the compiler-rt library directories if they exist to help
255 // the linker find the various sanitizer, builtin, and profiling runtimes.
256 for (const auto &LibPath : TC.getLibraryPaths()) {
257 if (TC.getVFS().exists(LibPath))
258 CmdArgs.push_back(Args.MakeArgString("-L" + LibPath));
259 }
260 auto CRTPath = TC.getCompilerRTPath();
261 if (TC.getVFS().exists(CRTPath))
262 CmdArgs.push_back(Args.MakeArgString("-L" + CRTPath));
263
264 AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA);
265
266 if (auto LTO = TC.getLTOMode(Args); LTO != LTOK_None)
267 addLTOOptions(TC, Args, CmdArgs, Output, Inputs, LTO == LTOK_Thin);
268
269 if (C.getDriver().IsFlangMode() &&
270 !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
271 TC.addFortranRuntimeLibraryPath(Args, CmdArgs);
272 TC.addFortranRuntimeLibs(Args, CmdArgs);
273 }
274
275 // TODO: Add profile stuff here
276
277 if (TC.ShouldLinkCXXStdlib(Args)) {
278 bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
279 !Args.hasArg(options::OPT_static);
280 if (OnlyLibstdcxxStatic)
281 CmdArgs.push_back("-Bstatic");
282 TC.AddCXXStdlibLibArgs(Args, CmdArgs);
283 if (OnlyLibstdcxxStatic)
284 CmdArgs.push_back("-Bdynamic");
285 }
286
287 bool HasWindowsApp = false;
288 for (auto Lib : Args.getAllArgValues(options::OPT_l)) {
289 if (Lib == "windowsapp") {
290 HasWindowsApp = true;
291 break;
292 }
293 }
294
295 bool NoLibc = Args.hasArg(options::OPT_nolibc);
296 if (!Args.hasArg(options::OPT_nostdlib)) {
297 if (!Args.hasArg(options::OPT_nodefaultlibs)) {
298 if (Args.hasArg(options::OPT_static))
299 CmdArgs.push_back("--start-group");
300
301 if (Args.hasArg(options::OPT_fstack_protector) ||
302 Args.hasArg(options::OPT_fstack_protector_strong) ||
303 Args.hasArg(options::OPT_fstack_protector_all)) {
304 CmdArgs.push_back("-lssp_nonshared");
305 CmdArgs.push_back("-lssp");
306 }
307
308 if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
309 options::OPT_fno_openmp, false)) {
310 switch (TC.getDriver().getOpenMPRuntime(Args)) {
312 CmdArgs.push_back("-lomp");
313 break;
315 CmdArgs.push_back("-liomp5md");
316 break;
318 CmdArgs.push_back("-lgomp");
319 break;
321 // Already diagnosed.
322 break;
323 }
324 }
325
326 AddLibGCC(Args, CmdArgs);
327
328 if (Args.hasArg(options::OPT_pg))
329 CmdArgs.push_back("-lgmon");
330
331 if (Args.hasArg(options::OPT_pthread))
332 CmdArgs.push_back("-lpthread");
333
334 if (Sanitize.needsAsanRt()) {
335 // MinGW always links against a shared MSVCRT.
336 CmdArgs.push_back(TC.getCompilerRTArgString(Args, "asan_dynamic",
338 CmdArgs.push_back(
339 TC.getCompilerRTArgString(Args, "asan_dynamic_runtime_thunk"));
340 CmdArgs.push_back("--require-defined");
341 CmdArgs.push_back(TC.getArch() == llvm::Triple::x86
342 ? "___asan_seh_interceptor"
343 : "__asan_seh_interceptor");
344 // Make sure the linker consider all object files from the dynamic
345 // runtime thunk.
346 CmdArgs.push_back("--whole-archive");
347 CmdArgs.push_back(
348 TC.getCompilerRTArgString(Args, "asan_dynamic_runtime_thunk"));
349 CmdArgs.push_back("--no-whole-archive");
350 }
351
352 TC.addProfileRTLibs(Args, CmdArgs);
353
354 if (!HasWindowsApp && !NoLibc) {
355 // Add system libraries. If linking to libwindowsapp.a, that import
356 // library replaces all these and we shouldn't accidentally try to
357 // link to the normal desktop mode dlls.
358 if (Args.hasArg(options::OPT_mwindows)) {
359 CmdArgs.push_back("-lgdi32");
360 CmdArgs.push_back("-lcomdlg32");
361 }
362 CmdArgs.push_back("-ladvapi32");
363 CmdArgs.push_back("-lshell32");
364 CmdArgs.push_back("-luser32");
365 CmdArgs.push_back("-lkernel32");
366 }
367
368 if (Args.hasArg(options::OPT_static)) {
369 CmdArgs.push_back("--end-group");
370 } else {
371 AddLibGCC(Args, CmdArgs);
372 if (!HasWindowsApp && !NoLibc)
373 CmdArgs.push_back("-lkernel32");
374 }
375 }
376
377 if (!Args.hasArg(options::OPT_nostartfiles)) {
378 // Add crtfastmath.o if available and fast math is enabled.
379 TC.addFastMathRuntimeIfAvailable(Args, CmdArgs);
380
381 CmdArgs.push_back(Args.MakeArgString(TC.GetFilePath("crtend.o")));
382 }
383 }
384 const char *Exec = Args.MakeArgString(TC.GetLinkerPath());
385 C.addCommand(std::make_unique<Command>(JA, *this,
387 Exec, CmdArgs, Inputs, Output));
388}
389
390static bool isCrossCompiling(const llvm::Triple &T, bool RequireArchMatch) {
391 llvm::Triple HostTriple(llvm::Triple::normalize(LLVM_HOST_TRIPLE));
392 if (HostTriple.getOS() != llvm::Triple::Win32)
393 return true;
394 if (RequireArchMatch && HostTriple.getArch() != T.getArch())
395 return true;
396 return false;
397}
398
399// Simplified from Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple.
400static bool findGccVersion(StringRef LibDir, std::string &GccLibDir,
401 std::string &Ver,
404 std::error_code EC;
405 for (llvm::sys::fs::directory_iterator LI(LibDir, EC), LE; !EC && LI != LE;
406 LI = LI.increment(EC)) {
407 StringRef VersionText = llvm::sys::path::filename(LI->path());
408 auto CandidateVersion =
410 if (CandidateVersion.Major == -1)
411 continue;
412 if (CandidateVersion <= Version)
413 continue;
414 Version = CandidateVersion;
415 Ver = std::string(VersionText);
416 GccLibDir = LI->path();
417 }
418 return Ver.size();
419}
420
421static llvm::Triple getLiteralTriple(const Driver &D, const llvm::Triple &T) {
422 llvm::Triple LiteralTriple(D.getTargetTriple());
423 // The arch portion of the triple may be overridden by -m32/-m64.
424 LiteralTriple.setArchName(T.getArchName());
425 return LiteralTriple;
426}
427
428void toolchains::MinGW::findGccLibDir(const llvm::Triple &LiteralTriple) {
429 llvm::SmallVector<llvm::SmallString<32>, 5> SubdirNames;
430 SubdirNames.emplace_back(LiteralTriple.str());
431 SubdirNames.emplace_back(getTriple().str());
432 SubdirNames.emplace_back(getTriple().getArchName());
433 SubdirNames.back() += "-w64-mingw32";
434 SubdirNames.emplace_back(getTriple().getArchName());
435 SubdirNames.back() += "-w64-mingw32ucrt";
436 SubdirNames.emplace_back("mingw32");
437 if (SubdirName.empty()) {
438 SubdirName = getTriple().getArchName();
439 SubdirName += "-w64-mingw32";
440 }
441 // lib: Arch Linux, Ubuntu, Windows
442 // lib64: openSUSE Linux
443 for (StringRef CandidateLib : {"lib", "lib64"}) {
444 for (StringRef CandidateSysroot : SubdirNames) {
445 llvm::SmallString<1024> LibDir(Base);
446 llvm::sys::path::append(LibDir, CandidateLib, "gcc", CandidateSysroot);
447 if (findGccVersion(LibDir, GccLibDir, Ver, GccVer)) {
448 SubdirName = std::string(CandidateSysroot);
449 return;
450 }
451 }
452 }
453}
454
455static llvm::ErrorOr<std::string> findGcc(const llvm::Triple &LiteralTriple,
456 const llvm::Triple &T) {
458 Gccs.emplace_back(LiteralTriple.str());
459 Gccs.back() += "-gcc";
460 Gccs.emplace_back(T.str());
461 Gccs.back() += "-gcc";
462 Gccs.emplace_back(T.getArchName());
463 Gccs.back() += "-w64-mingw32-gcc";
464 Gccs.emplace_back(T.getArchName());
465 Gccs.back() += "-w64-mingw32ucrt-gcc";
466 Gccs.emplace_back("mingw32-gcc");
467 // Please do not add "gcc" here
468 for (StringRef CandidateGcc : Gccs)
469 if (llvm::ErrorOr<std::string> GPPName = llvm::sys::findProgramByName(CandidateGcc))
470 return GPPName;
471 return make_error_code(std::errc::no_such_file_or_directory);
472}
473
474static llvm::ErrorOr<std::string>
475findClangRelativeSysroot(const Driver &D, const llvm::Triple &LiteralTriple,
476 const llvm::Triple &T, std::string &SubdirName) {
478 Subdirs.emplace_back(LiteralTriple.str());
479 Subdirs.emplace_back(T.str());
480 Subdirs.emplace_back(T.getArchName());
481 Subdirs.back() += "-w64-mingw32";
482 Subdirs.emplace_back(T.getArchName());
483 Subdirs.back() += "-w64-mingw32ucrt";
484 StringRef ClangRoot = llvm::sys::path::parent_path(D.Dir);
485 StringRef Sep = llvm::sys::path::get_separator();
486 for (StringRef CandidateSubdir : Subdirs) {
487 if (llvm::sys::fs::is_directory(ClangRoot + Sep + CandidateSubdir)) {
488 SubdirName = std::string(CandidateSubdir);
489 return (ClangRoot + Sep + CandidateSubdir).str();
490 }
491 }
492 return make_error_code(std::errc::no_such_file_or_directory);
493}
494
495static bool looksLikeMinGWSysroot(const std::string &Directory) {
496 StringRef Sep = llvm::sys::path::get_separator();
497 if (!llvm::sys::fs::exists(Directory + Sep + "include" + Sep + "_mingw.h"))
498 return false;
499 if (!llvm::sys::fs::exists(Directory + Sep + "lib" + Sep + "libkernel32.a"))
500 return false;
501 return true;
502}
503
504toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple,
505 const ArgList &Args)
506 : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args),
507 RocmInstallation(D, Triple, Args) {
508 getProgramPaths().push_back(getDriver().Dir);
509
510 std::string InstallBase =
511 std::string(llvm::sys::path::parent_path(getDriver().Dir));
512 // The sequence for detecting a sysroot here should be kept in sync with
513 // the testTriple function below.
514 llvm::Triple LiteralTriple = getLiteralTriple(D, getTriple());
515 if (getDriver().SysRoot.size())
516 Base = getDriver().SysRoot;
517 // Look for <clang-bin>/../<triplet>; if found, use <clang-bin>/.. as the
518 // base as it could still be a base for a gcc setup with libgcc.
519 else if (llvm::ErrorOr<std::string> TargetSubdir = findClangRelativeSysroot(
520 getDriver(), LiteralTriple, getTriple(), SubdirName))
521 Base = std::string(llvm::sys::path::parent_path(TargetSubdir.get()));
522 // If the install base of Clang seems to have mingw sysroot files directly
523 // in the toplevel include and lib directories, use this as base instead of
524 // looking for a triple prefixed GCC in the path.
525 else if (looksLikeMinGWSysroot(InstallBase))
526 Base = InstallBase;
527 else if (llvm::ErrorOr<std::string> GPPName =
528 findGcc(LiteralTriple, getTriple()))
529 Base = std::string(llvm::sys::path::parent_path(
530 llvm::sys::path::parent_path(GPPName.get())));
531 else
532 Base = InstallBase;
533
534 Base += llvm::sys::path::get_separator();
535 findGccLibDir(LiteralTriple);
536 TripleDirName = SubdirName;
537 // GccLibDir must precede Base/lib so that the
538 // correct crtbegin.o ,cetend.o would be found.
539 getFilePaths().push_back(GccLibDir);
540
541 // openSUSE/Fedora
542 std::string CandidateSubdir = SubdirName + "/sys-root/mingw";
543 if (getDriver().getVFS().exists(Base + CandidateSubdir))
544 SubdirName = CandidateSubdir;
545
546 getFilePaths().push_back(
547 (Base + SubdirName + llvm::sys::path::get_separator() + "lib").str());
548
549 // Gentoo
550 getFilePaths().push_back(
551 (Base + SubdirName + llvm::sys::path::get_separator() + "mingw/lib").str());
552
553 // Only include <base>/lib if we're not cross compiling (not even for
554 // windows->windows to a different arch), or if the sysroot has been set
555 // (where we presume the user has pointed it at an arch specific
556 // subdirectory).
557 if (!::isCrossCompiling(getTriple(), /*RequireArchMatch=*/true) ||
558 getDriver().SysRoot.size())
559 getFilePaths().push_back(Base + "lib");
560
561 loadMultilibsFromYAML(Args, D);
562
563 NativeLLVMSupport =
564 Args.getLastArgValue(options::OPT_fuse_ld_EQ, D.getPreferredLinker())
565 .equals_insensitive("lld");
566}
567
569 switch (AC) {
571 if (!Preprocessor)
572 Preprocessor.reset(new tools::gcc::Preprocessor(*this));
573 return Preprocessor.get();
575 if (!Compiler)
576 Compiler.reset(new tools::gcc::Compiler(*this));
577 return Compiler.get();
579 if (!Objcopy)
580 Objcopy.reset(new tools::ARM64XObjcopy(*this));
581 return Objcopy.get();
582 default:
583 return ToolChain::getTool(AC);
584 }
585}
586
590
592 return new tools::MinGW::Linker(*this);
593}
594
596 return NativeLLVMSupport;
597}
598
601 Arg *ExceptionArg = Args.getLastArg(options::OPT_fsjlj_exceptions,
602 options::OPT_fseh_exceptions,
603 options::OPT_fdwarf_exceptions);
604 if (ExceptionArg &&
605 ExceptionArg->getOption().matches(options::OPT_fseh_exceptions))
607
608 if (getArch() == llvm::Triple::x86_64 || getArch() == llvm::Triple::arm ||
609 getArch() == llvm::Triple::thumb || getArch() == llvm::Triple::aarch64)
612}
613
615 return getArch() == llvm::Triple::x86_64 ||
616 getArch() == llvm::Triple::aarch64;
617}
618
619bool toolchains::MinGW::isPIEDefault(const llvm::opt::ArgList &Args) const {
620 return false;
621}
622
623bool toolchains::MinGW::isPICDefaultForced() const { return true; }
624
625llvm::ExceptionHandling
626toolchains::MinGW::GetExceptionModel(const ArgList &Args) const {
627 if (getArch() == llvm::Triple::x86_64 || getArch() == llvm::Triple::aarch64 ||
628 getArch() == llvm::Triple::arm || getArch() == llvm::Triple::thumb)
629 return llvm::ExceptionHandling::WinEH;
630 return llvm::ExceptionHandling::DwarfCFI;
631}
632
634 BoundArch BA, Action::OffloadKind DeviceOffloadKind) const {
635 SanitizerMask Res = ToolChain::getSupportedSanitizers(BA, DeviceOffloadKind);
636 Res |= SanitizerKind::Address;
637 Res |= SanitizerKind::PointerCompare;
638 Res |= SanitizerKind::PointerSubtract;
639 Res |= SanitizerKind::Vptr;
640 return Res;
641}
642
643void toolchains::MinGW::AddCudaIncludeArgs(const ArgList &DriverArgs,
644 ArgStringList &CC1Args) const {
645 CudaInstallation->AddCudaIncludeArgs(DriverArgs, CC1Args);
646}
647
648void toolchains::MinGW::AddHIPIncludeArgs(const ArgList &DriverArgs,
649 ArgStringList &CC1Args) const {
650 RocmInstallation->AddHIPIncludeArgs(DriverArgs, CC1Args);
651}
652
653void toolchains::MinGW::printVerboseInfo(raw_ostream &OS) const {
654 CudaInstallation->print(OS);
655 RocmInstallation->print(OS);
656}
657
658// Include directories for various hosts:
659
660// Windows, mingw.org
661// c:\mingw\lib\gcc\mingw32\4.8.1\include\c++
662// c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\mingw32
663// c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\backward
664// c:\mingw\include
665// c:\mingw\mingw32\include
666
667// Windows, mingw-w64 mingw-builds
668// c:\mingw32\i686-w64-mingw32\include
669// c:\mingw32\i686-w64-mingw32\include\c++
670// c:\mingw32\i686-w64-mingw32\include\c++\i686-w64-mingw32
671// c:\mingw32\i686-w64-mingw32\include\c++\backward
672
673// Windows, mingw-w64 msys2
674// c:\msys64\mingw32\include
675// c:\msys64\mingw32\i686-w64-mingw32\include
676// c:\msys64\mingw32\include\c++\4.9.2
677// c:\msys64\mingw32\include\c++\4.9.2\i686-w64-mingw32
678// c:\msys64\mingw32\include\c++\4.9.2\backward
679
680// openSUSE
681// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++
682// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++/x86_64-w64-mingw32
683// /usr/lib64/gcc/x86_64-w64-mingw32/5.1.0/include/c++/backward
684// /usr/x86_64-w64-mingw32/sys-root/mingw/include
685
686// Arch Linux
687// /usr/i686-w64-mingw32/include/c++/5.1.0
688// /usr/i686-w64-mingw32/include/c++/5.1.0/i686-w64-mingw32
689// /usr/i686-w64-mingw32/include/c++/5.1.0/backward
690// /usr/i686-w64-mingw32/include
691
692// Ubuntu
693// /usr/include/c++/4.8
694// /usr/include/c++/4.8/x86_64-w64-mingw32
695// /usr/include/c++/4.8/backward
696// /usr/x86_64-w64-mingw32/include
697
698// Fedora
699// /usr/x86_64-w64-mingw32ucrt/sys-root/mingw/include/c++/x86_64-w64-mingw32ucrt
700// /usr/x86_64-w64-mingw32ucrt/sys-root/mingw/include/c++/backward
701// /usr/x86_64-w64-mingw32ucrt/sys-root/mingw/include
702// /usr/lib/gcc/x86_64-w64-mingw32ucrt/12.2.1/include-fixed
703
704void toolchains::MinGW::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
705 ArgStringList &CC1Args) const {
706 if (DriverArgs.hasArg(options::OPT_nostdinc))
707 return;
708
709 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
710 SmallString<1024> P(getDriver().ResourceDir);
711 llvm::sys::path::append(P, "include");
712 addSystemInclude(DriverArgs, CC1Args, P.str());
713 }
714
715 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
716 return;
717
718 // Add multilib variant include paths in priority order.
719 for (const Multilib &M : getOrderedMultilibs()) {
720 if (M.isDefault())
721 continue;
722 if (std::optional<std::string> StdlibIncDir = getStdlibIncludePath()) {
723 SmallString<128> Dir(*StdlibIncDir);
724 llvm::sys::path::append(Dir, M.includeSuffix());
725 if (getDriver().getVFS().exists(Dir))
726 addSystemInclude(DriverArgs, CC1Args, Dir);
727 }
728 }
729
730 if (std::optional<std::string> Path = getStdlibIncludePath())
731 addSystemInclude(DriverArgs, CC1Args, *Path);
732
733 addSystemInclude(DriverArgs, CC1Args,
734 Base + SubdirName + llvm::sys::path::get_separator() +
735 "include");
736
737 // Gentoo
738 addSystemInclude(DriverArgs, CC1Args,
739 Base + SubdirName + llvm::sys::path::get_separator() + "usr/include");
740
741 // Only include <base>/include if we're not cross compiling (but do allow it
742 // if we're on Windows and building for Windows on another architecture),
743 // or if the sysroot has been set (where we presume the user has pointed it
744 // at an arch specific subdirectory).
745 if (!::isCrossCompiling(getTriple(), /*RequireArchMatch=*/false) ||
746 getDriver().SysRoot.size())
747 addSystemInclude(DriverArgs, CC1Args, Base + "include");
748}
749
751 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
752 BoundArch BA, Action::OffloadKind DeviceOffloadKind) const {
753 if (Arg *A = DriverArgs.getLastArg(options::OPT_mguard_EQ)) {
754 StringRef GuardArgs = A->getValue();
755 if (GuardArgs == "none") {
756 // Do nothing.
757 } else if (GuardArgs == "cf") {
758 // Emit CFG instrumentation and the table of address-taken functions.
759 CC1Args.push_back("-cfguard");
760 } else if (GuardArgs == "cf-nochecks") {
761 // Emit only the table of address-taken functions.
762 CC1Args.push_back("-cfguard-no-checks");
763 } else {
764 getDriver().Diag(diag::err_drv_unsupported_option_argument)
765 << A->getSpelling() << GuardArgs;
766 }
767 }
768
769 // Default to not enabling sized deallocation, but let user provided options
770 // override it.
771 //
772 // If using sized deallocation, user code that invokes delete will end up
773 // calling delete(void*,size_t). If the user wanted to override the
774 // operator delete(void*), there may be a fallback operator
775 // delete(void*,size_t) which calls the regular operator delete(void*).
776 //
777 // However, if the C++ standard library is linked in the form of a DLL,
778 // and the fallback operator delete(void*,size_t) is within this DLL (which is
779 // the case for libc++ at least) it will only redirect towards the library's
780 // default operator delete(void*), not towards the user's provided operator
781 // delete(void*).
782 //
783 // This issue can be avoided, if the fallback operators are linked statically
784 // into the callers, even if the C++ standard library is linked as a DLL.
785 //
786 // This is meant as a temporary workaround until libc++ implements this
787 // technique, which is tracked in
788 // https://github.com/llvm/llvm-project/issues/96899.
789 if (!DriverArgs.hasArgNoClaim(options::OPT_fsized_deallocation,
790 options::OPT_fno_sized_deallocation))
791 CC1Args.push_back("-fno-sized-deallocation");
792
793 CC1Args.push_back("-fno-use-init-array");
794
795 for (auto Opt : {options::OPT_mthreads, options::OPT_mwindows,
796 options::OPT_mconsole, options::OPT_mdll}) {
797 if (Arg *A = DriverArgs.getLastArgNoClaim(Opt))
798 A->ignoreTargetSpecific();
799 }
800}
801
803 const ArgList &DriverArgs, ArgStringList &CC1Args) const {
804 if (DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdlibinc,
805 options::OPT_nostdincxx))
806 return;
807
808 StringRef Slash = llvm::sys::path::get_separator();
809
810 switch (GetCXXStdlibType(DriverArgs)) {
812 std::string TargetDir = (Base + "include" + Slash + getTripleString() +
813 Slash + "c++" + Slash + "v1")
814 .str();
815 if (getDriver().getVFS().exists(TargetDir))
816 addSystemInclude(DriverArgs, CC1Args, TargetDir);
817 addSystemInclude(DriverArgs, CC1Args,
818 Base + SubdirName + Slash + "include" + Slash + "c++" +
819 Slash + "v1");
820 addSystemInclude(DriverArgs, CC1Args,
821 Base + "include" + Slash + "c++" + Slash + "v1");
822 break;
823 }
824
827 CppIncludeBases.emplace_back(Base);
828 llvm::sys::path::append(CppIncludeBases[0], SubdirName, "include", "c++");
829 CppIncludeBases.emplace_back(Base);
830 llvm::sys::path::append(CppIncludeBases[1], SubdirName, "include", "c++",
831 Ver);
832 CppIncludeBases.emplace_back(Base);
833 llvm::sys::path::append(CppIncludeBases[2], "include", "c++", Ver);
834 CppIncludeBases.emplace_back(GccLibDir);
835 llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
836 CppIncludeBases.emplace_back(GccLibDir);
837 llvm::sys::path::append(CppIncludeBases[4], "include",
838 "g++-v" + GccVer.Text);
839 CppIncludeBases.emplace_back(GccLibDir);
840 llvm::sys::path::append(CppIncludeBases[5], "include",
841 "g++-v" + GccVer.MajorStr + "." + GccVer.MinorStr);
842 CppIncludeBases.emplace_back(GccLibDir);
843 llvm::sys::path::append(CppIncludeBases[6], "include",
844 "g++-v" + GccVer.MajorStr);
845 for (auto &CppIncludeBase : CppIncludeBases) {
846 addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
847 CppIncludeBase += Slash;
848 addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + TripleDirName);
849 addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
850 }
851 break;
852 }
853}
854
855static bool testTriple(const Driver &D, const llvm::Triple &Triple,
856 const ArgList &Args) {
857 // If an explicit sysroot is set, that will be used and we shouldn't try to
858 // detect anything else.
859 std::string SubdirName;
860 if (D.SysRoot.size())
861 return true;
862 llvm::Triple LiteralTriple = getLiteralTriple(D, Triple);
863 std::string InstallBase = std::string(llvm::sys::path::parent_path(D.Dir));
864 if (llvm::ErrorOr<std::string> TargetSubdir =
865 findClangRelativeSysroot(D, LiteralTriple, Triple, SubdirName))
866 return true;
867 // If the install base itself looks like a mingw sysroot, we'll use that
868 // - don't use any potentially unrelated gcc to influence what triple to use.
869 if (looksLikeMinGWSysroot(InstallBase))
870 return false;
871 if (llvm::ErrorOr<std::string> GPPName = findGcc(LiteralTriple, Triple))
872 return true;
873 // If we neither found a colocated sysroot or a matching gcc executable,
874 // conclude that we can't know if this is the correct spelling of the triple.
875 return false;
876}
877
878static llvm::Triple adjustTriple(const Driver &D, const llvm::Triple &Triple,
879 const ArgList &Args) {
880 // First test if the original triple can find a sysroot with the triple
881 // name.
882 if (testTriple(D, Triple, Args))
883 return Triple;
885 // If not, test a couple other possible arch names that might be what was
886 // intended.
887 if (Triple.getArch() == llvm::Triple::x86) {
888 Archs.emplace_back("i386");
889 Archs.emplace_back("i586");
890 Archs.emplace_back("i686");
891 } else if (Triple.getArch() == llvm::Triple::arm ||
892 Triple.getArch() == llvm::Triple::thumb) {
893 Archs.emplace_back("armv7");
894 }
895 for (auto A : Archs) {
896 llvm::Triple TestTriple(Triple);
897 TestTriple.setArchName(A);
898 if (testTriple(D, TestTriple, Args))
899 return TestTriple;
900 }
901 // If none was found, just proceed with the original value.
902 return Triple;
903}
904
905void toolchains::MinGW::fixTripleArch(const Driver &D, llvm::Triple &Triple,
906 const ArgList &Args) {
907 if (Triple.getArch() == llvm::Triple::x86 ||
908 Triple.getArch() == llvm::Triple::arm ||
909 Triple.getArch() == llvm::Triple::thumb)
910 Triple = adjustTriple(D, Triple, Args);
911}
static llvm::Triple getLiteralTriple(const Driver &D, const llvm::Triple &T)
Definition MinGW.cpp:421
static bool looksLikeMinGWSysroot(const std::string &Directory)
Definition MinGW.cpp:495
static bool findGccVersion(StringRef LibDir, std::string &GccLibDir, std::string &Ver, toolchains::Generic_GCC::GCCVersion &Version)
Definition MinGW.cpp:400
static bool testTriple(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
Definition MinGW.cpp:855
static llvm::Triple adjustTriple(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
Definition MinGW.cpp:878
static llvm::ErrorOr< std::string > findGcc(const llvm::Triple &LiteralTriple, const llvm::Triple &T)
Definition MinGW.cpp:455
static llvm::ErrorOr< std::string > findClangRelativeSysroot(const Driver &D, const llvm::Triple &LiteralTriple, const llvm::Triple &T, std::string &SubdirName)
Definition MinGW.cpp:475
static bool isCrossCompiling(const llvm::Triple &T, bool RequireArchMatch)
Definition MinGW.cpp:390
static StringRef getTriple(const Command &Job)
Compilation - A set of tasks to perform for a single driver invocation.
Definition Compilation.h:46
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition Driver.h:95
std::string SysRoot
sysroot, if present
Definition Driver.h:195
OpenMPRuntimeKind getOpenMPRuntime(const llvm::opt::ArgList &Args) const
Compute the desired OpenMP runtime from the flags provided.
Definition Driver.cpp:853
DiagnosticBuilder Diag(unsigned DiagID) const
Definition Driver.h:159
std::string Dir
The path the driver executable was in, as invoked from the command line.
Definition Driver.h:170
@ OMPRT_IOMP5
The legacy name for the LLVM OpenMP runtime from when it was the Intel OpenMP runtime.
Definition Driver.h:155
@ OMPRT_OMP
The LLVM OpenMP runtime.
Definition Driver.h:145
@ OMPRT_Unknown
An unknown OpenMP runtime.
Definition Driver.h:141
@ OMPRT_GOMP
The GNU OpenMP runtime.
Definition Driver.h:150
std::string getTargetTriple() const
Definition Driver.h:428
InputInfo - Wrapper for information about an input source.
Definition InputInfo.h:22
const char * getFilename() const
Definition InputInfo.h:83
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
Definition Multilib.h:35
ToolChain - Access to tools for a single platform.
Definition ToolChain.h:96
static void addSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory to CC1 arguments.
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
virtual void addFortranRuntimeLibraryPath(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Adds the path for the Fortran runtime libraries to CmdArgs.
std::string GetFilePath(const char *Name) const
virtual void addFortranRuntimeLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
Adds Fortran runtime libraries to CmdArgs.
path_list & getFilePaths()
Definition ToolChain.h:326
virtual SanitizerMask getSupportedSanitizers(BoundArch BA, Action::OffloadKind DeviceOffloadKind) const
Return sanitizers which are available in this toolchain.
llvm::Triple::ArchType getArch() const
Definition ToolChain.h:302
const Driver & getDriver() const
Definition ToolChain.h:286
llvm::vfs::FileSystem & getVFS() const
bool loadMultilibsFromYAML(const llvm::opt::ArgList &Args, const Driver &D, StringRef Fallback={})
Discover and load a multilib.yaml configuration.
ToolChain(const Driver &D, const llvm::Triple &T, const llvm::opt::ArgList &Args)
Definition ToolChain.cpp:91
bool addFastMathRuntimeIfAvailable(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFastMathRuntimeIfAvailable - If a runtime library exists that sets global flags for unsafe floatin...
path_list & getProgramPaths()
Definition ToolChain.h:329
virtual LTOKind getLTOMode(const llvm::opt::ArgList &Args, Action::OffloadKind Kind=Action::OFK_None) const
Resolve the requested LTO mode for this toolchain.
const llvm::Triple & getEffectiveTriple() const
Get the toolchain's effective clang triple.
Definition ToolChain.h:314
virtual void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddCXXStdlibLibArgs - Add the system specific linker arguments to use for the given C++ standard libr...
const llvm::Triple & getTriple() const
Definition ToolChain.h:288
virtual void addProfileRTLibs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
addProfileRTLibs - When -fprofile-instr-profile is specified, try to pass a suitable profile runtime ...
OrderedMultilibs getOrderedMultilibs() const
Get selected multilibs in priority order with default fallback.
StringRef getTripleString() const
Definition ToolChain.h:311
virtual std::string getCompilerRTPath() const
std::string GetLinkerPath(bool *LinkerIsLLD=nullptr) const
Returns the linker path, respecting the -fuse-ld= argument to determine the linker suffix or name.
std::optional< std::string > getStdlibIncludePath() const
virtual void AddFilePathLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs, BoundArch BA={}, Action::OffloadKind DeviceOffloadKind=Action::OFK_None) const
path_list & getLibraryPaths()
Definition ToolChain.h:323
virtual Tool * getTool(Action::ActionClass AC) const
const char * getCompilerRTArgString(const llvm::opt::ArgList &Args, StringRef Component, FileType Type=ToolChain::FT_Static, bool IsFortran=false) const
virtual bool isCrossCompiling() const
Returns true if the toolchain is targeting a non-native architecture.
Tool - Information on a specific compilation tool.
Definition Tool.h:32
const ToolChain & getToolChain() const
Definition Tool.h:52
Tool * getTool(Action::ActionClass AC) const override
Definition MinGW.cpp:568
llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const override
GetExceptionModel - Return the tool chain exception model.
Definition MinGW.cpp:626
Tool * buildAssembler() const override
Definition MinGW.cpp:587
void printVerboseInfo(raw_ostream &OS) const override
Dispatch to the specific toolchain for verbose printing.
Definition MinGW.cpp:653
Tool * buildLinker() const override
Definition MinGW.cpp:591
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific HIP includes.
Definition MinGW.cpp:648
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition MinGW.cpp:619
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific CUDA includes.
Definition MinGW.cpp:643
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition MinGW.cpp:595
bool isPICDefault() const override
Test whether this toolchain defaults to PIC.
Definition MinGW.cpp:614
bool isPICDefaultForced() const override
Tests whether this toolchain forces its default for PIC, PIE or non-PIC.
Definition MinGW.cpp:623
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add the clang cc1 arguments for system include paths.
Definition MinGW.cpp:704
void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set the include paths to use for...
Definition MinGW.cpp:802
SanitizerMask getSupportedSanitizers(BoundArch BA, Action::OffloadKind DeviceOffloadKind) const override
Return sanitizers which are available in this toolchain.
Definition MinGW.cpp:633
UnwindTableLevel getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override
How detailed should the unwind tables be by default.
Definition MinGW.cpp:600
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, BoundArch BA, Action::OffloadKind DeviceOffloadKind) const override
Add options that need to be passed to cc1 for this target.
Definition MinGW.cpp:750
MinGW(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
Definition MinGW.cpp:504
static void fixTripleArch(const Driver &D, llvm::Triple &Triple, const llvm::opt::ArgList &Args)
Definition MinGW.cpp:905
void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override
MinGW Tools.
Definition MinGW.cpp:30
void ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, const llvm::opt::ArgList &TCArgs, const char *LinkingOutput) const override
ConstructJob - Construct jobs to perform the action JA, writing to Output and with Inputs,...
Definition MinGW.cpp:107
const char * SplitDebugName(const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Input, const InputInfo &Output)
void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfoList &Inputs, bool IsThinLTO)
void AddRunTimeLibs(const ToolChain &TC, const Driver &D, llvm::opt::ArgStringList &CmdArgs, const llvm::opt::ArgList &Args)
void SplitDebugInfo(const ToolChain &TC, Compilation &C, const Tool &T, const JobAction &JA, const llvm::opt::ArgList &Args, const InputInfo &Output, const char *OutFile)
void claimNoWarnArgs(const llvm::opt::ArgList &Args)
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
SmallVector< InputInfo, 4 > InputInfoList
Definition Driver.h:51
The JSON file list parser is used to communicate input to InstallAPI.
std::error_code make_error_code(BuildPreambleError Error)
Represents a bound architecture for offload / multiple architecture compilation.
static constexpr ResponseFileSupport None()
Returns a ResponseFileSupport indicating that response files are not supported.
Definition Job.h:79
static constexpr ResponseFileSupport AtFileUTF8()
Definition Job.h:86
Struct to store and manipulate GCC versions.
Definition Gnu.h:163
static GCCVersion Parse(StringRef VersionText)
Parse a GCCVersion object out of a string of text.
Definition Gnu.cpp:1991