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 case llvm::Triple::loongarch32:
217 CmdArgs.push_back("-m");
218 CmdArgs.push_back("elf32loongarch");
219 break;
220 case llvm::Triple::loongarch64:
221 CmdArgs.push_back("-m");
222 CmdArgs.push_back("elf64loongarch");
223 break;
224 default:
225 break;
226 }
227
228 if (Triple.isLoongArch64() || Triple.isRISCV64()) {
229 CmdArgs.push_back("-X");
230 if (Args.hasArg(options::OPT_mno_relax))
231 CmdArgs.push_back("--no-relax");
232 }
233
234 if (Arg *A = Args.getLastArg(options::OPT_G)) {
235 if (ToolChain.getTriple().isMIPS()) {
236 StringRef v = A->getValue();
237 CmdArgs.push_back(Args.MakeArgString("-G" + v));
238 A->claim();
239 }
240 }
241
242 assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
243 if (Output.isFilename()) {
244 CmdArgs.push_back("-o");
245 CmdArgs.push_back(Output.getFilename());
246 }
247
248 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
249 options::OPT_r)) {
250 const char *crt1 = nullptr;
251 if (!Args.hasArg(options::OPT_shared)) {
252 if (Args.hasArg(options::OPT_pg))
253 crt1 = "gcrt1.o";
254 else if (IsPIE)
255 crt1 = "Scrt1.o";
256 else
257 crt1 = "crt1.o";
258 }
259 if (crt1)
260 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
261
262 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
263
264 const char *crtbegin = nullptr;
265 if (Args.hasArg(options::OPT_static))
266 crtbegin = "crtbeginT.o";
267 else if (Args.hasArg(options::OPT_shared) || IsPIE)
268 crtbegin = "crtbeginS.o";
269 else
270 crtbegin = "crtbegin.o";
271
272 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
273 }
274
275 Args.AddAllArgs(CmdArgs, options::OPT_L);
276 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
277 Args.addAllArgs(CmdArgs,
278 {options::OPT_T_Group, options::OPT_s, options::OPT_t});
279
280 if (D.isUsingLTO()) {
281 assert(!Inputs.empty() && "Must have at least one input.");
282 // Find the first filename InputInfo object.
283 auto Input = llvm::find_if(
284 Inputs, [](const InputInfo &II) -> bool { return II.isFilename(); });
285 if (Input == Inputs.end())
286 // For a very rare case, all of the inputs to the linker are
287 // InputArg. If that happens, just use the first InputInfo.
288 Input = Inputs.begin();
289
290 addLTOOptions(ToolChain, Args, CmdArgs, Output, *Input,
291 D.getLTOMode() == LTOK_Thin);
292 }
293
294 bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
295 bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
297 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
298
299 unsigned Major = ToolChain.getTriple().getOSMajorVersion();
300 bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
301 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
302 options::OPT_r)) {
303 // Use the static OpenMP runtime with -static-openmp
304 bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
305 !Args.hasArg(options::OPT_static);
306 addOpenMPRuntime(C, CmdArgs, ToolChain, Args, StaticOpenMP);
307
308 if (D.CCCIsCXX()) {
310 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
311 if (Profiling)
312 CmdArgs.push_back("-lm_p");
313 else
314 CmdArgs.push_back("-lm");
315 }
316
317 // Silence warnings when linking C code with a C++ '-stdlib' argument.
318 Args.ClaimAllArgs(options::OPT_stdlib_EQ);
319
320 // Additional linker set-up and flags for Fortran. This is required in order
321 // to generate executables. As Fortran runtime depends on the C runtime,
322 // these dependencies need to be listed before the C runtime below (i.e.
323 // AddRunTimeLibs).
324 if (D.IsFlangMode() &&
325 !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
327 addFortranRuntimeLibs(ToolChain, Args, CmdArgs);
328 if (Profiling)
329 CmdArgs.push_back("-lm_p");
330 else
331 CmdArgs.push_back("-lm");
332 }
333
334 if (NeedsSanitizerDeps)
335 linkSanitizerRuntimeDeps(ToolChain, Args, CmdArgs);
336 if (NeedsXRayDeps)
337 linkXRayRuntimeDeps(ToolChain, Args, CmdArgs);
338 // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
339 // the default system libraries. Just mimic this for now.
340 if (Profiling)
341 CmdArgs.push_back("-lgcc_p");
342 else
343 CmdArgs.push_back("-lgcc");
344 if (Args.hasArg(options::OPT_static)) {
345 CmdArgs.push_back("-lgcc_eh");
346 } else if (Profiling) {
347 CmdArgs.push_back("-lgcc_eh_p");
348 } else {
349 CmdArgs.push_back("--as-needed");
350 CmdArgs.push_back("-lgcc_s");
351 CmdArgs.push_back("--no-as-needed");
352 }
353
354 if (Args.hasArg(options::OPT_pthread)) {
355 if (Profiling)
356 CmdArgs.push_back("-lpthread_p");
357 else
358 CmdArgs.push_back("-lpthread");
359 }
360
361 if (Profiling) {
362 if (Args.hasArg(options::OPT_shared))
363 CmdArgs.push_back("-lc");
364 else
365 CmdArgs.push_back("-lc_p");
366 CmdArgs.push_back("-lgcc_p");
367 } else {
368 CmdArgs.push_back("-lc");
369 CmdArgs.push_back("-lgcc");
370 }
371
372 if (Args.hasArg(options::OPT_static)) {
373 CmdArgs.push_back("-lgcc_eh");
374 } else if (Profiling) {
375 CmdArgs.push_back("-lgcc_eh_p");
376 } else {
377 CmdArgs.push_back("--as-needed");
378 CmdArgs.push_back("-lgcc_s");
379 CmdArgs.push_back("--no-as-needed");
380 }
381 }
382
383 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
384 options::OPT_r)) {
385 const char *crtend = nullptr;
386 if (Args.hasArg(options::OPT_shared) || IsPIE)
387 crtend = "crtendS.o";
388 else
389 crtend = "crtend.o";
390 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtend)));
391 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
392 }
393
394 ToolChain.addProfileRTLibs(Args, CmdArgs);
395
396 const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
397 C.addCommand(std::make_unique<Command>(JA, *this,
399 Exec, CmdArgs, Inputs, Output));
400}
401
402/// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
403
404FreeBSD::FreeBSD(const Driver &D, const llvm::Triple &Triple,
405 const ArgList &Args)
406 : Generic_ELF(D, Triple, Args) {
407
408 // When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall
409 // back to '/usr/lib' if it doesn't exist.
410 if (Triple.isArch32Bit() &&
411 D.getVFS().exists(concat(getDriver().SysRoot, "/usr/lib32/crt1.o")))
412 getFilePaths().push_back(concat(getDriver().SysRoot, "/usr/lib32"));
413 else
414 getFilePaths().push_back(concat(getDriver().SysRoot, "/usr/lib"));
415}
416
418 const llvm::opt::ArgList &DriverArgs,
419 llvm::opt::ArgStringList &CC1Args) const {
420 const Driver &D = getDriver();
421
422 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
423 return;
424
425 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
426 SmallString<128> Dir(D.ResourceDir);
427 llvm::sys::path::append(Dir, "include");
428 addSystemInclude(DriverArgs, CC1Args, Dir.str());
429 }
430
431 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
432 return;
433
434 // Check for configure-time C include directories.
435 StringRef CIncludeDirs(C_INCLUDE_DIRS);
436 if (CIncludeDirs != "") {
438 CIncludeDirs.split(dirs, ":");
439 for (StringRef dir : dirs) {
440 StringRef Prefix =
441 llvm::sys::path::is_absolute(dir) ? StringRef(D.SysRoot) : "";
442 addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
443 }
444 return;
445 }
446
447 addExternCSystemInclude(DriverArgs, CC1Args,
448 concat(D.SysRoot, "/usr/include"));
449}
450
451void FreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
452 llvm::opt::ArgStringList &CC1Args) const {
453 addSystemInclude(DriverArgs, CC1Args,
454 concat(getDriver().SysRoot, "/usr/include/c++/v1"));
455}
456
457void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
458 ArgStringList &CmdArgs) const {
459 unsigned Major = getTriple().getOSMajorVersion();
460 bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
461
462 CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
463 if (Args.hasArg(options::OPT_fexperimental_library))
464 CmdArgs.push_back("-lc++experimental");
465}
466
467void FreeBSD::AddCudaIncludeArgs(const ArgList &DriverArgs,
468 ArgStringList &CC1Args) const {
469 CudaInstallation->AddCudaIncludeArgs(DriverArgs, CC1Args);
470}
471
472void FreeBSD::AddHIPIncludeArgs(const ArgList &DriverArgs,
473 ArgStringList &CC1Args) const {
474 RocmInstallation->AddHIPIncludeArgs(DriverArgs, CC1Args);
475}
476
478 return new tools::freebsd::Assembler(*this);
479}
480
481Tool *FreeBSD::buildLinker() const { return new tools::freebsd::Linker(*this); }
482
483bool FreeBSD::HasNativeLLVMSupport() const { return true; }
484
486FreeBSD::getDefaultUnwindTableLevel(const ArgList &Args) const {
488}
489
490bool FreeBSD::isPIEDefault(const llvm::opt::ArgList &Args) const {
491 return getSanitizerArgs(Args).requiresPIE();
492}
493
495 const bool IsAArch64 = getTriple().getArch() == llvm::Triple::aarch64;
496 const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
497 const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
498 const bool IsMIPS64 = getTriple().isMIPS64();
500 Res |= SanitizerKind::Address;
501 Res |= SanitizerKind::PointerCompare;
502 Res |= SanitizerKind::PointerSubtract;
503 Res |= SanitizerKind::Vptr;
504 if (IsAArch64 || IsX86_64 || IsMIPS64) {
505 Res |= SanitizerKind::Leak;
506 Res |= SanitizerKind::Thread;
507 }
508 if (IsAArch64 || IsX86 || IsX86_64) {
509 Res |= SanitizerKind::SafeStack;
510 Res |= SanitizerKind::Fuzzer;
511 Res |= SanitizerKind::FuzzerNoLink;
512 }
513 if (IsAArch64 || IsX86_64) {
514 Res |= SanitizerKind::KernelAddress;
515 Res |= SanitizerKind::KernelMemory;
516 Res |= SanitizerKind::Memory;
517 }
518 return Res;
519}
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:1265
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
Definition: ToolChain.cpp:1367
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:1280
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:949
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:1304
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:1373
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:1169
std::string GetProgramPath(const char *Name) const
Definition: ToolChain.cpp:953
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:1392
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:378
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1456
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:404
void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: FreeBSD.cpp:451
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:457
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: FreeBSD.cpp:494
Tool * buildAssembler() const override
Definition: FreeBSD.cpp:477
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific CUDA includes.
Definition: FreeBSD.cpp:467
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition: FreeBSD.cpp:490
UnwindTableLevel getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override
How detailed should the unwind tables be by default.
Definition: FreeBSD.cpp:486
Tool * buildLinker() const override
Definition: FreeBSD.cpp:481
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific HIP includes.
Definition: FreeBSD.cpp:472
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:417
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: FreeBSD.cpp:483
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:532
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