clang 20.0.0git
Fuchsia.cpp
Go to the documentation of this file.
1//===--- Fuchsia.cpp - Fuchsia 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 "Fuchsia.h"
10#include "CommonArgs.h"
11#include "clang/Config/config.h"
13#include "clang/Driver/Driver.h"
18#include "llvm/Option/ArgList.h"
19#include "llvm/ProfileData/InstrProf.h"
20#include "llvm/Support/FileSystem.h"
21#include "llvm/Support/Path.h"
22#include "llvm/Support/VirtualFileSystem.h"
23
24using namespace clang::driver;
25using namespace clang::driver::toolchains;
26using namespace clang::driver::tools;
27using namespace clang;
28using namespace llvm::opt;
29
31
33 const InputInfo &Output,
34 const InputInfoList &Inputs,
35 const ArgList &Args,
36 const char *LinkingOutput) const {
37 const auto &ToolChain = static_cast<const Fuchsia &>(getToolChain());
38 const Driver &D = ToolChain.getDriver();
39
40 const llvm::Triple &Triple = ToolChain.getEffectiveTriple();
41
42 ArgStringList CmdArgs;
43
44 // Silence warning for "clang -g foo.o -o foo"
45 Args.ClaimAllArgs(options::OPT_g_Group);
46 // and "clang -emit-llvm foo.o -o foo"
47 Args.ClaimAllArgs(options::OPT_emit_llvm);
48 // and for "clang -w foo.o -o foo". Other warning options are already
49 // handled somewhere else.
50 Args.ClaimAllArgs(options::OPT_w);
51
52 CmdArgs.push_back("-z");
53 CmdArgs.push_back("max-page-size=4096");
54
55 CmdArgs.push_back("-z");
56 CmdArgs.push_back("now");
57
58 CmdArgs.push_back("-z");
59 CmdArgs.push_back("start-stop-visibility=hidden");
60
61 const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
62 if (llvm::sys::path::filename(Exec).equals_insensitive("ld.lld") ||
63 llvm::sys::path::stem(Exec).equals_insensitive("ld.lld")) {
64 CmdArgs.push_back("-z");
65 CmdArgs.push_back("rodynamic");
66 CmdArgs.push_back("-z");
67 CmdArgs.push_back("separate-loadable-segments");
68 CmdArgs.push_back("-z");
69 CmdArgs.push_back("rel");
70 CmdArgs.push_back("--pack-dyn-relocs=relr");
71 }
72
73 if (!D.SysRoot.empty())
74 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
75
76 if (!Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_r))
77 CmdArgs.push_back("-pie");
78
79 if (Args.hasArg(options::OPT_rdynamic))
80 CmdArgs.push_back("-export-dynamic");
81
82 if (Args.hasArg(options::OPT_s))
83 CmdArgs.push_back("-s");
84
85 if (Args.hasArg(options::OPT_r)) {
86 CmdArgs.push_back("-r");
87 } else {
88 CmdArgs.push_back("--build-id");
89 CmdArgs.push_back("--hash-style=gnu");
90 }
91
92 if (ToolChain.getArch() == llvm::Triple::aarch64) {
93 CmdArgs.push_back("--execute-only");
94
95 std::string CPU = getCPUName(D, Args, Triple);
96 if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53")
97 CmdArgs.push_back("--fix-cortex-a53-843419");
98 }
99
100 CmdArgs.push_back("--eh-frame-hdr");
101
102 if (Args.hasArg(options::OPT_static))
103 CmdArgs.push_back("-Bstatic");
104 else if (Args.hasArg(options::OPT_shared))
105 CmdArgs.push_back("-shared");
106
107 const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs(Args);
108
109 if (!Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_r)) {
110 std::string Dyld = D.DyldPrefix;
111 if (SanArgs.needsAsanRt() && SanArgs.needsSharedRt())
112 Dyld += "asan/";
113 if (SanArgs.needsHwasanRt() && SanArgs.needsSharedRt())
114 Dyld += "hwasan/";
115 if (SanArgs.needsTsanRt() && SanArgs.needsSharedRt())
116 Dyld += "tsan/";
117 Dyld += "ld.so.1";
118 CmdArgs.push_back("-dynamic-linker");
119 CmdArgs.push_back(Args.MakeArgString(Dyld));
120 }
121
122 if (Triple.isRISCV64()) {
123 CmdArgs.push_back("-X");
124 if (Args.hasArg(options::OPT_mno_relax))
125 CmdArgs.push_back("--no-relax");
126 }
127
128 CmdArgs.push_back("-o");
129 CmdArgs.push_back(Output.getFilename());
130
131 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
132 options::OPT_r)) {
133 if (!Args.hasArg(options::OPT_shared)) {
134 CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("Scrt1.o")));
135 }
136 }
137
138 Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_u});
139
140 ToolChain.AddFilePathLibArgs(Args, CmdArgs);
141
142 if (D.isUsingLTO()) {
143 assert(!Inputs.empty() && "Must have at least one input.");
144 // Find the first filename InputInfo object.
145 auto Input = llvm::find_if(
146 Inputs, [](const InputInfo &II) -> bool { return II.isFilename(); });
147 if (Input == Inputs.end())
148 // For a very rare case, all of the inputs to the linker are
149 // InputArg. If that happens, just use the first InputInfo.
150 Input = Inputs.begin();
151
152 addLTOOptions(ToolChain, Args, CmdArgs, Output, *Input,
153 D.getLTOMode() == LTOK_Thin);
154 }
155
157 AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
158
159 // Sample these options first so they are claimed even under -nostdlib et al.
160 bool NoLibc = Args.hasArg(options::OPT_nolibc);
161 bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
162 !Args.hasArg(options::OPT_static);
163 bool Pthreads = Args.hasArg(options::OPT_pthread, options::OPT_pthreads);
164 bool SplitStack = Args.hasArg(options::OPT_fsplit_stack);
165 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
166 options::OPT_r)) {
167 if (Args.hasArg(options::OPT_static))
168 CmdArgs.push_back("-Bdynamic");
169
170 if (D.CCCIsCXX()) {
171 if (ToolChain.ShouldLinkCXXStdlib(Args)) {
172 CmdArgs.push_back("--push-state");
173 CmdArgs.push_back("--as-needed");
174 if (OnlyLibstdcxxStatic)
175 CmdArgs.push_back("-Bstatic");
176 ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
177 if (OnlyLibstdcxxStatic)
178 CmdArgs.push_back("-Bdynamic");
179 CmdArgs.push_back("-lm");
180 CmdArgs.push_back("--pop-state");
181 }
182 }
183
184 // Note that Fuchsia never needs to link in sanitizer runtime deps. Any
185 // sanitizer runtimes with system dependencies use the `.deplibs` feature
186 // instead.
187 addSanitizerRuntimes(ToolChain, Args, CmdArgs);
188
189 addXRayRuntime(ToolChain, Args, CmdArgs);
190
191 ToolChain.addProfileRTLibs(Args, CmdArgs);
192
193 AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
194
195 if (Pthreads)
196 CmdArgs.push_back("-lpthread");
197
198 if (SplitStack)
199 CmdArgs.push_back("--wrap=pthread_create");
200
201 if (!NoLibc)
202 CmdArgs.push_back("-lc");
203 }
204
205 C.addCommand(std::make_unique<Command>(JA, *this,
207 Exec, CmdArgs, Inputs, Output));
208}
209
211 const InputInfo &Output,
212 const InputInfoList &Inputs,
213 const ArgList &Args,
214 const char *LinkingOutput) const {
215 const Driver &D = getToolChain().getDriver();
216
217 // Silence warning for "clang -g foo.o -o foo"
218 Args.ClaimAllArgs(options::OPT_g_Group);
219 // and "clang -emit-llvm foo.o -o foo"
220 Args.ClaimAllArgs(options::OPT_emit_llvm);
221 // and for "clang -w foo.o -o foo". Other warning options are already
222 // handled somewhere else.
223 Args.ClaimAllArgs(options::OPT_w);
224 // Silence warnings when linking C code with a C++ '-stdlib' argument.
225 Args.ClaimAllArgs(options::OPT_stdlib_EQ);
226
227 // ar tool command "llvm-ar <options> <output_file> <input_files>".
228 ArgStringList CmdArgs;
229 // Create and insert file members with a deterministic index.
230 CmdArgs.push_back("rcsD");
231 CmdArgs.push_back(Output.getFilename());
232
233 for (const auto &II : Inputs) {
234 if (II.isFilename()) {
235 CmdArgs.push_back(II.getFilename());
236 }
237 }
238
239 // Delete old output archive file if it already exists before generating a new
240 // archive file.
241 const char *OutputFileName = Output.getFilename();
242 if (Output.isFilename() && llvm::sys::fs::exists(OutputFileName)) {
243 if (std::error_code EC = llvm::sys::fs::remove(OutputFileName)) {
244 D.Diag(diag::err_drv_unable_to_remove_file) << EC.message();
245 return;
246 }
247 }
248
249 const char *Exec = Args.MakeArgString(getToolChain().GetStaticLibToolPath());
250 C.addCommand(std::make_unique<Command>(JA, *this,
252 Exec, CmdArgs, Inputs, Output));
253}
254
255/// Fuchsia - Fuchsia tool chain which can call as(1) and ld(1) directly.
256
257Fuchsia::Fuchsia(const Driver &D, const llvm::Triple &Triple,
258 const ArgList &Args)
259 : ToolChain(D, Triple, Args) {
260 getProgramPaths().push_back(getDriver().Dir);
261
262 if (!D.SysRoot.empty()) {
263 SmallString<128> P(D.SysRoot);
264 llvm::sys::path::append(P, "lib");
265 getFilePaths().push_back(std::string(P));
266 }
267
268 auto FilePaths = [&](const Multilib &M) -> std::vector<std::string> {
269 std::vector<std::string> FP;
270 if (std::optional<std::string> Path = getStdlibPath()) {
272 llvm::sys::path::append(P, M.gccSuffix());
273 FP.push_back(std::string(P));
274 }
275 return FP;
276 };
277
279 // Use the noexcept variant with -fno-exceptions to avoid the extra overhead.
280 Multilibs.push_back(MultilibBuilder("noexcept", {}, {})
281 .flag("-fexceptions", /*Disallow=*/true)
282 .flag("-fno-exceptions")
283 .makeMultilib());
284 // ASan has higher priority because we always want the instrumentated version.
285 Multilibs.push_back(MultilibBuilder("asan", {}, {})
286 .flag("-fsanitize=address")
287 .makeMultilib());
288 // Use the asan+noexcept variant with ASan and -fno-exceptions.
289 Multilibs.push_back(MultilibBuilder("asan+noexcept", {}, {})
290 .flag("-fsanitize=address")
291 .flag("-fexceptions", /*Disallow=*/true)
292 .flag("-fno-exceptions")
293 .makeMultilib());
294 // HWASan has higher priority because we always want the instrumentated
295 // version.
296 Multilibs.push_back(MultilibBuilder("hwasan", {}, {})
297 .flag("-fsanitize=hwaddress")
298 .makeMultilib());
299 // Use the hwasan+noexcept variant with HWASan and -fno-exceptions.
300 Multilibs.push_back(MultilibBuilder("hwasan+noexcept", {}, {})
301 .flag("-fsanitize=hwaddress")
302 .flag("-fexceptions", /*Disallow=*/true)
303 .flag("-fno-exceptions")
304 .makeMultilib());
305 // Use Itanium C++ ABI for the compat multilib.
306 Multilibs.push_back(MultilibBuilder("compat", {}, {})
307 .flag("-fc++-abi=itanium")
308 .makeMultilib());
309
310 Multilibs.FilterOut([&](const Multilib &M) {
311 std::vector<std::string> RD = FilePaths(M);
312 return llvm::all_of(RD, [&](std::string P) { return !getVFS().exists(P); });
313 });
314
316 bool Exceptions =
317 Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions, true);
318 addMultilibFlag(Exceptions, "-fexceptions", Flags);
319 addMultilibFlag(!Exceptions, "-fno-exceptions", Flags);
320 addMultilibFlag(getSanitizerArgs(Args).needsAsanRt(), "-fsanitize=address",
321 Flags);
322 addMultilibFlag(getSanitizerArgs(Args).needsHwasanRt(),
323 "-fsanitize=hwaddress", Flags);
324
325 addMultilibFlag(Args.getLastArgValue(options::OPT_fcxx_abi_EQ) == "itanium",
326 "-fc++-abi=itanium", Flags);
327
329
330 if (Multilibs.select(D, Flags, SelectedMultilibs)) {
331 // Ensure that -print-multi-directory only outputs one multilib directory.
332 Multilib LastSelected = SelectedMultilibs.back();
333 SelectedMultilibs = {LastSelected};
334
335 if (!SelectedMultilibs.back().isDefault())
336 if (const auto &PathsCallback = Multilibs.filePathsCallback())
337 for (const auto &Path : PathsCallback(SelectedMultilibs.back()))
338 // Prepend the multilib path to ensure it takes the precedence.
339 getFilePaths().insert(getFilePaths().begin(), Path);
340 }
341}
342
343std::string Fuchsia::ComputeEffectiveClangTriple(const ArgList &Args,
344 types::ID InputType) const {
345 llvm::Triple Triple(ComputeLLVMTriple(Args, InputType));
346 return Triple.str();
347}
348
349Tool *Fuchsia::buildLinker() const { return new tools::fuchsia::Linker(*this); }
350
352 return new tools::fuchsia::StaticLibTool(*this);
353}
354
356Fuchsia::GetRuntimeLibType(const ArgList &Args) const {
357 if (Arg *A = Args.getLastArg(clang::driver::options::OPT_rtlib_EQ)) {
358 StringRef Value = A->getValue();
359 if (Value != "compiler-rt")
360 getDriver().Diag(clang::diag::err_drv_invalid_rtlib_name)
361 << A->getAsString(Args);
362 }
363
365}
366
368 if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
369 StringRef Value = A->getValue();
370 if (Value != "libc++")
371 getDriver().Diag(diag::err_drv_invalid_stdlib_name)
372 << A->getAsString(Args);
373 }
374
376}
377
378void Fuchsia::addClangTargetOptions(const ArgList &DriverArgs,
379 ArgStringList &CC1Args,
380 Action::OffloadKind) const {
381 if (!DriverArgs.hasFlag(options::OPT_fuse_init_array,
382 options::OPT_fno_use_init_array, true))
383 CC1Args.push_back("-fno-use-init-array");
384}
385
386void Fuchsia::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
387 ArgStringList &CC1Args) const {
388 const Driver &D = getDriver();
389
390 if (DriverArgs.hasArg(options::OPT_nostdinc))
391 return;
392
393 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
394 SmallString<128> P(D.ResourceDir);
395 llvm::sys::path::append(P, "include");
396 addSystemInclude(DriverArgs, CC1Args, P);
397 }
398
399 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
400 return;
401
402 // Check for configure-time C include directories.
403 StringRef CIncludeDirs(C_INCLUDE_DIRS);
404 if (CIncludeDirs != "") {
406 CIncludeDirs.split(dirs, ":");
407 for (StringRef dir : dirs) {
408 StringRef Prefix =
409 llvm::sys::path::is_absolute(dir) ? "" : StringRef(D.SysRoot);
410 addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir);
411 }
412 return;
413 }
414
415 if (!D.SysRoot.empty()) {
416 SmallString<128> P(D.SysRoot);
417 llvm::sys::path::append(P, "include");
418 addExternCSystemInclude(DriverArgs, CC1Args, P.str());
419 }
420}
421
422void Fuchsia::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
423 ArgStringList &CC1Args) const {
424 if (DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdlibinc,
425 options::OPT_nostdincxx))
426 return;
427
428 const Driver &D = getDriver();
429 std::string Target = getTripleString();
430
431 auto AddCXXIncludePath = [&](StringRef Path) {
432 std::string Version = detectLibcxxVersion(Path);
433 if (Version.empty())
434 return;
435
436 // First add the per-target multilib include dir.
437 if (!SelectedMultilibs.empty() && !SelectedMultilibs.back().isDefault()) {
438 const Multilib &M = SelectedMultilibs.back();
439 SmallString<128> TargetDir(Path);
440 llvm::sys::path::append(TargetDir, Target, M.gccSuffix(), "c++", Version);
441 if (getVFS().exists(TargetDir)) {
442 addSystemInclude(DriverArgs, CC1Args, TargetDir);
443 }
444 }
445
446 // Second add the per-target include dir.
447 SmallString<128> TargetDir(Path);
448 llvm::sys::path::append(TargetDir, Target, "c++", Version);
449 if (getVFS().exists(TargetDir))
450 addSystemInclude(DriverArgs, CC1Args, TargetDir);
451
452 // Third the generic one.
454 llvm::sys::path::append(Dir, "c++", Version);
455 addSystemInclude(DriverArgs, CC1Args, Dir);
456 };
457
458 switch (GetCXXStdlibType(DriverArgs)) {
460 SmallString<128> P(D.Dir);
461 llvm::sys::path::append(P, "..", "include");
462 AddCXXIncludePath(P);
463 break;
464 }
465
466 default:
467 llvm_unreachable("invalid stdlib name");
468 }
469}
470
471void Fuchsia::AddCXXStdlibLibArgs(const ArgList &Args,
472 ArgStringList &CmdArgs) const {
473 switch (GetCXXStdlibType(Args)) {
475 CmdArgs.push_back("-lc++");
476 if (Args.hasArg(options::OPT_fexperimental_library))
477 CmdArgs.push_back("-lc++experimental");
478 break;
479
481 llvm_unreachable("invalid stdlib name");
482 }
483}
484
487 Res |= SanitizerKind::Address;
488 Res |= SanitizerKind::HWAddress;
489 Res |= SanitizerKind::PointerCompare;
490 Res |= SanitizerKind::PointerSubtract;
491 Res |= SanitizerKind::Fuzzer;
492 Res |= SanitizerKind::FuzzerNoLink;
493 Res |= SanitizerKind::Leak;
494 Res |= SanitizerKind::SafeStack;
495 Res |= SanitizerKind::Scudo;
496 Res |= SanitizerKind::Thread;
497 return Res;
498}
499
501 SanitizerMask Res;
502 switch (getTriple().getArch()) {
503 case llvm::Triple::aarch64:
504 case llvm::Triple::riscv64:
505 Res |= SanitizerKind::ShadowCallStack;
506 break;
507 case llvm::Triple::x86_64:
508 Res |= SanitizerKind::SafeStack;
509 break;
510 default:
511 break;
512 }
513 return Res;
514}
StringRef P
const Decl * D
IndirectLocalPath & Path
llvm::MachO::Target Target
Definition: MachO.h:51
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
DiagnosticBuilder Diag(unsigned DiagID) const
Definition: Driver.h:144
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
const char * getFilename() const
Definition: InputInfo.h:83
bool isFilename() const
Definition: InputInfo.h:75
This corresponds to a single GCC multilib, or a segment of one controlled by a command line flag.
MultilibSet & setFilePathsCallback(IncludeDirsFunc F)
Definition: Multilib.h:165
MultilibSet & FilterOut(FilterCallback F)
Filter out some subset of the Multilibs using a user defined callback.
Definition: Multilib.cpp:87
const IncludeDirsFunc & filePathsCallback() const
Definition: Multilib.h:170
void push_back(const Multilib &M)
Add a completed Multilib to the set.
Definition: Multilib.cpp:92
bool select(const Driver &D, const Multilib::flags_list &Flags, llvm::SmallVectorImpl< Multilib > &) const
Select compatible variants,.
Definition: Multilib.cpp:94
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
Definition: Multilib.h:35
const std::string & gccSuffix() const
Get the detected GCC installation path suffix for the multi-arch target variant.
Definition: Multilib.h:70
std::vector< std::string > flags_list
Definition: Multilib.h:37
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
std::optional< std::string > getStdlibPath() const
Definition: ToolChain.cpp:889
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
virtual std::string detectLibcxxVersion(StringRef IncludePath) const
Definition: ToolChain.cpp:1312
llvm::vfs::FileSystem & getVFS() const
Definition: ToolChain.cpp:153
virtual std::string ComputeLLVMTriple(const llvm::opt::ArgList &Args, types::ID InputType=types::TY_INVALID) const
ComputeLLVMTriple - Return the LLVM target triple to use, after taking command line arguments into ac...
Definition: ToolChain.cpp:1091
path_list & getProgramPaths()
Definition: ToolChain.h:297
const llvm::Triple & getEffectiveTriple() const
Get the toolchain's effective clang triple.
Definition: ToolChain.h:282
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 GetLinkerPath(bool *LinkerIsLLD=nullptr) const
Returns the linker path, respecting the -fuse-ld= argument to determine the linker suffix or name.
Definition: ToolChain.cpp:957
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
std::string getTripleString() const
Definition: ToolChain.h:277
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:378
llvm::SmallVector< Multilib > SelectedMultilibs
Definition: ToolChain.h:201
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
Tool * buildStaticLibTool() const override
Definition: Fuchsia.cpp:351
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: Fuchsia.cpp:485
void AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add the clang cc1 arguments for system include paths.
Definition: Fuchsia.cpp:386
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: Fuchsia.cpp:471
RuntimeLibType GetRuntimeLibType(const llvm::opt::ArgList &Args) const override
Definition: Fuchsia.cpp:356
SanitizerMask getDefaultSanitizers() const override
Return sanitizers which are enabled by default.
Definition: Fuchsia.cpp:500
std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, types::ID InputType) const override
ComputeEffectiveClangTriple - Return the Clang triple to use for this target, which may take into acc...
Definition: Fuchsia.cpp:343
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: Fuchsia.cpp:422
CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override
Definition: Fuchsia.cpp:367
Tool * buildLinker() const override
Definition: Fuchsia.cpp:349
void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const override
Add options that need to be passed to cc1 for this target.
Definition: Fuchsia.cpp:378
Fuchsia(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args)
Fuchsia - Fuchsia tool chain which can call as(1) and ld(1) directly.
Definition: Fuchsia.cpp:257
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: Fuchsia.cpp:32
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: Fuchsia.cpp:210
std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &T, bool FromAs=false)
void addMultilibFlag(bool Enabled, const StringRef Flag, Multilib::flags_list &Flags)
Flag must be a flag accepted by the driver.
void AddRunTimeLibs(const ToolChain &TC, const Driver &D, llvm::opt::ArgStringList &CmdArgs, const llvm::opt::ArgList &Args)
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 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)
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
The JSON file list parser is used to communicate input to InstallAPI.
static constexpr ResponseFileSupport AtFileCurCP()
Definition: Job.h:92