clang 20.0.0git
FreeBSD.cpp
Go to the documentation of this file.
1//===--- FreeBSD.cpp - FreeBSD ToolChain Implementations --------*- C++ -*-===//
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 "FreeBSD.h"
10#include "Arch/ARM.h"
11#include "Arch/Mips.h"
12#include "Arch/Sparc.h"
13#include "CommonArgs.h"
14#include "clang/Config/config.h"
19#include "llvm/Option/ArgList.h"
20#include "llvm/Support/VirtualFileSystem.h"
21
22using namespace clang::driver;
23using namespace clang::driver::tools;
24using namespace clang::driver::toolchains;
25using namespace clang;
26using namespace llvm::opt;
27
29 const InputInfo &Output,
30 const InputInfoList &Inputs,
31 const ArgList &Args,
32 const char *LinkingOutput) const {
33 const auto &ToolChain = static_cast<const FreeBSD &>(getToolChain());
34 const auto &D = getToolChain().getDriver();
35 const llvm::Triple &Triple = ToolChain.getTriple();
36 ArgStringList CmdArgs;
37
38 claimNoWarnArgs(Args);
39
40 // When building 32-bit code on FreeBSD/amd64, we have to explicitly
41 // instruct as in the base system to assemble 32-bit code.
42 switch (ToolChain.getArch()) {
43 default:
44 break;
45 case llvm::Triple::x86:
46 CmdArgs.push_back("--32");
47 break;
48 case llvm::Triple::ppc:
49 case llvm::Triple::ppcle:
50 CmdArgs.push_back("-a32");
51 break;
52 case llvm::Triple::mips:
53 case llvm::Triple::mipsel:
54 case llvm::Triple::mips64:
55 case llvm::Triple::mips64el: {
56 StringRef CPUName;
57 StringRef ABIName;
58 mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName);
59
60 CmdArgs.push_back("-march");
61 CmdArgs.push_back(CPUName.data());
62
63 CmdArgs.push_back("-mabi");
64 CmdArgs.push_back(mips::getGnuCompatibleMipsABIName(ABIName).data());
65
66 if (Triple.isLittleEndian())
67 CmdArgs.push_back("-EL");
68 else
69 CmdArgs.push_back("-EB");
70
71 if (Arg *A = Args.getLastArg(options::OPT_G)) {
72 StringRef v = A->getValue();
73 CmdArgs.push_back(Args.MakeArgString("-G" + v));
74 A->claim();
75 }
76
77 AddAssemblerKPIC(ToolChain, Args, CmdArgs);
78 break;
79 }
80 case llvm::Triple::arm:
81 case llvm::Triple::armeb:
82 case llvm::Triple::thumb:
83 case llvm::Triple::thumbeb: {
85
86 if (ABI == arm::FloatABI::Hard)
87 CmdArgs.push_back("-mfpu=vfp");
88 else
89 CmdArgs.push_back("-mfpu=softvfp");
90
91 CmdArgs.push_back("-meabi=5");
92 break;
93 }
94 case llvm::Triple::sparcv9: {
95 std::string CPU = getCPUName(D, Args, Triple);
96 CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, Triple));
97 AddAssemblerKPIC(ToolChain, Args, CmdArgs);
98 break;
99 }
100 }
101
102 for (const Arg *A : Args.filtered(options::OPT_ffile_prefix_map_EQ,
103 options::OPT_fdebug_prefix_map_EQ)) {
104 StringRef Map = A->getValue();
105 if (!Map.contains('='))
106 D.Diag(diag::err_drv_invalid_argument_to_option)
107 << Map << A->getOption().getName();
108 else {
109 CmdArgs.push_back(Args.MakeArgString("--debug-prefix-map"));
110 CmdArgs.push_back(Args.MakeArgString(Map));
111 }
112 A->claim();
113 }
114
115 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
116
117 CmdArgs.push_back("-o");
118 CmdArgs.push_back(Output.getFilename());
119
120 for (const auto &II : Inputs)
121 CmdArgs.push_back(II.getFilename());
122
123 const char *Exec = Args.MakeArgString(ToolChain.GetProgramPath("as"));
124 C.addCommand(std::make_unique<Command>(JA, *this,
126 Exec, CmdArgs, Inputs, Output));
127}
128
130 const InputInfo &Output,
131 const InputInfoList &Inputs,
132 const ArgList &Args,
133 const char *LinkingOutput) const {
134 const auto &ToolChain = static_cast<const FreeBSD &>(getToolChain());
135 const Driver &D = ToolChain.getDriver();
136 const llvm::Triple &Triple = ToolChain.getTriple();
137 const llvm::Triple::ArchType Arch = ToolChain.getArch();
138 const bool IsPIE =
139 !Args.hasArg(options::OPT_shared) &&
140 (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault(Args));
141 ArgStringList CmdArgs;
142
143 // Silence warning for "clang -g foo.o -o foo"
144 Args.ClaimAllArgs(options::OPT_g_Group);
145 // and "clang -emit-llvm foo.o -o foo"
146 Args.ClaimAllArgs(options::OPT_emit_llvm);
147 // and for "clang -w foo.o -o foo". Other warning options are already
148 // handled somewhere else.
149 Args.ClaimAllArgs(options::OPT_w);
150
151 if (!D.SysRoot.empty())
152 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
153
154 if (IsPIE)
155 CmdArgs.push_back("-pie");
156
157 CmdArgs.push_back("--eh-frame-hdr");
158 if (Args.hasArg(options::OPT_static)) {
159 CmdArgs.push_back("-Bstatic");
160 } else {
161 if (Args.hasArg(options::OPT_rdynamic))
162 CmdArgs.push_back("-export-dynamic");
163 if (Args.hasArg(options::OPT_shared)) {
164 CmdArgs.push_back("-shared");
165 } else if (!Args.hasArg(options::OPT_r)) {
166 CmdArgs.push_back("-dynamic-linker");
167 CmdArgs.push_back("/libexec/ld-elf.so.1");
168 }
169 if (Arch == llvm::Triple::arm || Triple.isX86())
170 CmdArgs.push_back("--hash-style=both");
171 CmdArgs.push_back("--enable-new-dtags");
172 }
173
174 // Explicitly set the linker emulation for platforms that might not
175 // be the default emulation for the linker.
176 switch (Arch) {
177 case llvm::Triple::x86:
178 CmdArgs.push_back("-m");
179 CmdArgs.push_back("elf_i386_fbsd");
180 break;
181 case llvm::Triple::ppc:
182 CmdArgs.push_back("-m");
183 CmdArgs.push_back("elf32ppc_fbsd");
184 break;
185 case llvm::Triple::ppcle:
186 CmdArgs.push_back("-m");
187 // Use generic -- only usage is for freestanding.
188 CmdArgs.push_back("elf32lppc");
189 break;
190 case llvm::Triple::mips:
191 CmdArgs.push_back("-m");
192 CmdArgs.push_back("elf32btsmip_fbsd");
193 break;
194 case llvm::Triple::mipsel:
195 CmdArgs.push_back("-m");
196 CmdArgs.push_back("elf32ltsmip_fbsd");
197 break;
198 case llvm::Triple::mips64:
199 CmdArgs.push_back("-m");
200 if (tools::mips::hasMipsAbiArg(Args, "n32"))
201 CmdArgs.push_back("elf32btsmipn32_fbsd");
202 else
203 CmdArgs.push_back("elf64btsmip_fbsd");
204 break;
205 case llvm::Triple::mips64el:
206 CmdArgs.push_back("-m");
207 if (tools::mips::hasMipsAbiArg(Args, "n32"))
208 CmdArgs.push_back("elf32ltsmipn32_fbsd");
209 else
210 CmdArgs.push_back("elf64ltsmip_fbsd");
211 break;
212 case llvm::Triple::riscv64:
213 CmdArgs.push_back("-m");
214 CmdArgs.push_back("elf64lriscv");
215 break;
216 default:
217 break;
218 }
219
220 if (Triple.isRISCV64()) {
221 CmdArgs.push_back("-X");
222 if (Args.hasArg(options::OPT_mno_relax))
223 CmdArgs.push_back("--no-relax");
224 }
225
226 if (Arg *A = Args.getLastArg(options::OPT_G)) {
227 if (ToolChain.getTriple().isMIPS()) {
228 StringRef v = A->getValue();
229 CmdArgs.push_back(Args.MakeArgString("-G" + v));
230 A->claim();
231 }
232 }
233
234 assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
235 if (Output.isFilename()) {
236 CmdArgs.push_back("-o");
237 CmdArgs.push_back(Output.getFilename());
238 }
239
240 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
241 options::OPT_r)) {
242 const char *crt1 = nullptr;
243 if (!Args.hasArg(options::OPT_shared)) {
244 if (Args.hasArg(options::OPT_pg))
245 crt1 = "gcrt1.o";
246 else if (IsPIE)
247 crt1 = "Scrt1.o";
248 else
249 crt1 = "crt1.o";
250 }
251 if (crt1)
252 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
253
254 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
255
256 const char *crtbegin = nullptr;
257 if (Args.hasArg(options::OPT_static))
258 crtbegin = "crtbeginT.o";
259 else if (Args.hasArg(options::OPT_shared) || IsPIE)
260 crtbegin = "crtbeginS.o";
261 else
262 crtbegin = "crtbegin.o";
263
264 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
265 }
266
267 Args.AddAllArgs(CmdArgs, options::OPT_L);
268 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
269 Args.addAllArgs(CmdArgs,
270 {options::OPT_T_Group, options::OPT_s, options::OPT_t});
271
272 if (D.isUsingLTO()) {
273 assert(!Inputs.empty() && "Must have at least one input.");
274 // Find the first filename InputInfo object.
275 auto Input = llvm::find_if(
276 Inputs, [](const InputInfo &II) -> bool { return II.isFilename(); });
277 if (Input == Inputs.end())
278 // For a very rare case, all of the inputs to the linker are
279 // InputArg. If that happens, just use the first InputInfo.
280 Input = Inputs.begin();
281
282 addLTOOptions(ToolChain, Args, CmdArgs, Output, *Input,
283 D.getLTOMode() == LTOK_Thin);
284 }
285
286 bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
287 bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
289 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
290
291 unsigned Major = ToolChain.getTriple().getOSMajorVersion();
292 bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
293 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
294 options::OPT_r)) {
295 // Use the static OpenMP runtime with -static-openmp
296 bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
297 !Args.hasArg(options::OPT_static);
298 addOpenMPRuntime(C, CmdArgs, ToolChain, Args, StaticOpenMP);
299
300 if (D.CCCIsCXX()) {
302 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
303 if (Profiling)
304 CmdArgs.push_back("-lm_p");
305 else
306 CmdArgs.push_back("-lm");
307 }
308
309 // Silence warnings when linking C code with a C++ '-stdlib' argument.
310 Args.ClaimAllArgs(options::OPT_stdlib_EQ);
311
312 // Additional linker set-up and flags for Fortran. This is required in order
313 // to generate executables. As Fortran runtime depends on the C runtime,
314 // these dependencies need to be listed before the C runtime below (i.e.
315 // AddRunTimeLibs).
316 if (D.IsFlangMode()) {
318 addFortranRuntimeLibs(ToolChain, Args, CmdArgs);
319 if (Profiling)
320 CmdArgs.push_back("-lm_p");
321 else
322 CmdArgs.push_back("-lm");
323 }
324
325 if (NeedsSanitizerDeps)
326 linkSanitizerRuntimeDeps(ToolChain, Args, CmdArgs);
327 if (NeedsXRayDeps)
328 linkXRayRuntimeDeps(ToolChain, Args, CmdArgs);
329 // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
330 // the default system libraries. Just mimic this for now.
331 if (Profiling)
332 CmdArgs.push_back("-lgcc_p");
333 else
334 CmdArgs.push_back("-lgcc");
335 if (Args.hasArg(options::OPT_static)) {
336 CmdArgs.push_back("-lgcc_eh");
337 } else if (Profiling) {
338 CmdArgs.push_back("-lgcc_eh_p");
339 } else {
340 CmdArgs.push_back("--as-needed");
341 CmdArgs.push_back("-lgcc_s");
342 CmdArgs.push_back("--no-as-needed");
343 }
344
345 if (Args.hasArg(options::OPT_pthread)) {
346 if (Profiling)
347 CmdArgs.push_back("-lpthread_p");
348 else
349 CmdArgs.push_back("-lpthread");
350 }
351
352 if (Profiling) {
353 if (Args.hasArg(options::OPT_shared))
354 CmdArgs.push_back("-lc");
355 else
356 CmdArgs.push_back("-lc_p");
357 CmdArgs.push_back("-lgcc_p");
358 } else {
359 CmdArgs.push_back("-lc");
360 CmdArgs.push_back("-lgcc");
361 }
362
363 if (Args.hasArg(options::OPT_static)) {
364 CmdArgs.push_back("-lgcc_eh");
365 } else if (Profiling) {
366 CmdArgs.push_back("-lgcc_eh_p");
367 } else {
368 CmdArgs.push_back("--as-needed");
369 CmdArgs.push_back("-lgcc_s");
370 CmdArgs.push_back("--no-as-needed");
371 }
372 }
373
374 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
375 options::OPT_r)) {
376 const char *crtend = nullptr;
377 if (Args.hasArg(options::OPT_shared) || IsPIE)
378 crtend = "crtendS.o";
379 else
380 crtend = "crtend.o";
381 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
382 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
383 }
384
385 ToolChain.addProfileRTLibs(Args, CmdArgs);
386
387 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
388 C.addCommand(std::make_unique<Command>(JA, *this,
390 Exec, CmdArgs, Inputs, Output));
391}
392
393/// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
394
395FreeBSD::FreeBSD(const Driver &D, const llvm::Triple &Triple,
396 const ArgList &Args)
397 : Generic_ELF(D, Triple, Args) {
398
399 // When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall
400 // back to '/usr/lib' if it doesn't exist.
401 if (Triple.isArch32Bit() &&
402 D.getVFS().exists(concat(getDriver().SysRoot, "/usr/lib32/crt1.o")))
403 getFilePaths().push_back(concat(getDriver().SysRoot, "/usr/lib32"));
404 else
405 getFilePaths().push_back(concat(getDriver().SysRoot, "/usr/lib"));
406}
407
409 const llvm::opt::ArgList &DriverArgs,
410 llvm::opt::ArgStringList &CC1Args) const {
411 const Driver &D = getDriver();
412
413 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
414 return;
415
416 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
417 SmallString<128> Dir(D.ResourceDir);
418 llvm::sys::path::append(Dir, "include");
419 addSystemInclude(DriverArgs, CC1Args, Dir.str());
420 }
421
422 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
423 return;
424
425 // Check for configure-time C include directories.
426 StringRef CIncludeDirs(C_INCLUDE_DIRS);
427 if (CIncludeDirs != "") {
429 CIncludeDirs.split(dirs, ":");
430 for (StringRef dir : dirs) {
431 StringRef Prefix =
432 llvm::sys::path::is_absolute(dir) ? StringRef(D.SysRoot) : "";
433 addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
434 }
435 return;
436 }
437
438 addExternCSystemInclude(DriverArgs, CC1Args,
439 concat(D.SysRoot, "/usr/include"));
440}
441
442void FreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
443 llvm::opt::ArgStringList &CC1Args) const {
444 addSystemInclude(DriverArgs, CC1Args,
445 concat(getDriver().SysRoot, "/usr/include/c++/v1"));
446}
447
448void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
449 ArgStringList &CmdArgs) const {
450 unsigned Major = getTriple().getOSMajorVersion();
451 bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
452
453 CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
454 if (Args.hasArg(options::OPT_fexperimental_library))
455 CmdArgs.push_back("-lc++experimental");
456}
457
458void FreeBSD::AddCudaIncludeArgs(const ArgList &DriverArgs,
459 ArgStringList &CC1Args) const {
460 CudaInstallation->AddCudaIncludeArgs(DriverArgs, CC1Args);
461}
462
463void FreeBSD::AddHIPIncludeArgs(const ArgList &DriverArgs,
464 ArgStringList &CC1Args) const {
465 RocmInstallation->AddHIPIncludeArgs(DriverArgs, CC1Args);
466}
467
469 return new tools::freebsd::Assembler(*this);
470}
471
472Tool *FreeBSD::buildLinker() const { return new tools::freebsd::Linker(*this); }
473
474bool FreeBSD::HasNativeLLVMSupport() const { return true; }
475
477FreeBSD::getDefaultUnwindTableLevel(const ArgList &Args) const {
479}
480
481bool FreeBSD::isPIEDefault(const llvm::opt::ArgList &Args) const {
482 return getSanitizerArgs(Args).requiresPIE();
483}
484
486 const bool IsAArch64 = getTriple().getArch() == llvm::Triple::aarch64;
487 const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
488 const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
489 const bool IsMIPS64 = getTriple().isMIPS64();
491 Res |= SanitizerKind::Address;
492 Res |= SanitizerKind::PointerCompare;
493 Res |= SanitizerKind::PointerSubtract;
494 Res |= SanitizerKind::Vptr;
495 if (IsAArch64 || IsX86_64 || IsMIPS64) {
496 Res |= SanitizerKind::Leak;
497 Res |= SanitizerKind::Thread;
498 }
499 if (IsAArch64 || IsX86 || IsX86_64) {
500 Res |= SanitizerKind::SafeStack;
501 Res |= SanitizerKind::Fuzzer;
502 Res |= SanitizerKind::FuzzerNoLink;
503 }
504 if (IsAArch64 || IsX86_64) {
505 Res |= SanitizerKind::KernelAddress;
506 Res |= SanitizerKind::KernelMemory;
507 Res |= SanitizerKind::Memory;
508 }
509 return Res;
510}
const Decl * D
do v
Definition: arm_acle.h:91
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:77
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
const char * getFilename() const
Definition: InputInfo.h:83
bool isNothing() const
Definition: InputInfo.h:74
bool isFilename() const
Definition: InputInfo.h:75
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:92
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.
Definition: ToolChain.cpp:1209
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
Definition: ToolChain.cpp:1311
static void addExternCSystemInclude(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, const Twine &Path)
Utility function to add a system include directory with extern "C" semantics to CC1 arguments.
Definition: ToolChain.cpp:1224
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:899
path_list & getFilePaths()
Definition: ToolChain.h:294
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:268
const Driver & getDriver() const
Definition: ToolChain.h:252
static std::string concat(StringRef Path, const Twine &A, const Twine &B="", const Twine &C="", const Twine &D="")
Definition: ToolChain.cpp:1248
virtual bool isPIEDefault(const llvm::opt::ArgList &Args) const =0
Test whether this toolchain defaults to PIE.
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...
Definition: ToolChain.cpp:1317
const llvm::Triple & getTriple() const
Definition: ToolChain.h:254
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 ...
Definition: ToolChain.cpp:1113
std::string GetProgramPath(const char *Name) const
Definition: ToolChain.cpp:903
void AddFilePathLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const
AddFilePathLibArgs - Add each thing in getFilePaths() as a "-L" option.
Definition: ToolChain.cpp:1336
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:333
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1400
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
const ToolChain & getToolChain() const
Definition: Tool.h:52
FreeBSD(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
Definition: FreeBSD.cpp:395
void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: FreeBSD.cpp:442
void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs) const override
AddCXXStdlibLibArgs - Add the system specific linker arguments to use for the given C++ standard libr...
Definition: FreeBSD.cpp:448
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: FreeBSD.cpp:485
Tool * buildAssembler() const override
Definition: FreeBSD.cpp:468
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific CUDA includes.
Definition: FreeBSD.cpp:458
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition: FreeBSD.cpp:481
UnwindTableLevel getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override
How detailed should the unwind tables be by default.
Definition: FreeBSD.cpp:477
Tool * buildLinker() const override
Definition: FreeBSD.cpp:472
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific HIP includes.
Definition: FreeBSD.cpp:463
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add the clang cc1 arguments for system include paths.
Definition: FreeBSD.cpp:408
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: FreeBSD.cpp:474
LazyDetector< CudaInstallationDetector > CudaInstallation
Definition: Gnu.h:289
LazyDetector< RocmInstallationDetector > RocmInstallation
Definition: Gnu.h:290
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: FreeBSD.cpp:28
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: FreeBSD.cpp:129
FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args)
StringRef getGnuCompatibleMipsABIName(StringRef ABI)
Definition: Mips.cpp:137
bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value)
void getMipsCPUAndABI(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, StringRef &CPUName, StringRef &ABIName)
const char * getSparcAsmModeForCPU(llvm::StringRef Name, const llvm::Triple &Triple)
std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &T, bool FromAs=false)
void linkXRayRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void linkSanitizerRuntimeDeps(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void AddAssemblerKPIC(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
void addFortranRuntimeLibraryPath(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Adds the path for the Fortran runtime libraries to CmdArgs.
void addLinkerCompressDebugSectionsOption(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Definition: CommonArgs.cpp:495
void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfo &Input, bool IsThinLTO)
bool addOpenMPRuntime(const Compilation &C, llvm::opt::ArgStringList &CmdArgs, const ToolChain &TC, const llvm::opt::ArgList &Args, bool ForceStaticHostRuntime=false, bool IsOffloadingHost=false, bool GompNeedsRT=false)
Returns true, if an OpenMP runtime has been added.
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)
void addFortranRuntimeLibs(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Adds Fortran runtime libraries to CmdArgs.
The JSON file list parser is used to communicate input to InstallAPI.
static constexpr ResponseFileSupport AtFileCurCP()
Definition: Job.h:92