clang  15.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"
16 #include "clang/Driver/Options.h"
18 #include "llvm/Option/ArgList.h"
19 #include "llvm/Support/VirtualFileSystem.h"
20 
21 using namespace clang::driver;
22 using namespace clang::driver::tools;
23 using namespace clang::driver::toolchains;
24 using namespace clang;
25 using namespace llvm::opt;
26 
28  const InputInfo &Output,
29  const InputInfoList &Inputs,
30  const ArgList &Args,
31  const char *LinkingOutput) const {
32  claimNoWarnArgs(Args);
33  ArgStringList CmdArgs;
34  const auto &D = getToolChain().getDriver();
35 
36  // When building 32-bit code on FreeBSD/amd64, we have to explicitly
37  // instruct as in the base system to assemble 32-bit code.
38  switch (getToolChain().getArch()) {
39  default:
40  break;
41  case llvm::Triple::x86:
42  CmdArgs.push_back("--32");
43  break;
44  case llvm::Triple::ppc:
45  case llvm::Triple::ppcle:
46  CmdArgs.push_back("-a32");
47  break;
48  case llvm::Triple::mips:
49  case llvm::Triple::mipsel:
50  case llvm::Triple::mips64:
51  case llvm::Triple::mips64el: {
52  StringRef CPUName;
53  StringRef ABIName;
54  mips::getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
55 
56  CmdArgs.push_back("-march");
57  CmdArgs.push_back(CPUName.data());
58 
59  CmdArgs.push_back("-mabi");
60  CmdArgs.push_back(mips::getGnuCompatibleMipsABIName(ABIName).data());
61 
62  if (getToolChain().getTriple().isLittleEndian())
63  CmdArgs.push_back("-EL");
64  else
65  CmdArgs.push_back("-EB");
66 
67  if (Arg *A = Args.getLastArg(options::OPT_G)) {
68  StringRef v = A->getValue();
69  CmdArgs.push_back(Args.MakeArgString("-G" + v));
70  A->claim();
71  }
72 
73  AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
74  break;
75  }
76  case llvm::Triple::arm:
77  case llvm::Triple::armeb:
78  case llvm::Triple::thumb:
79  case llvm::Triple::thumbeb: {
80  arm::FloatABI ABI = arm::getARMFloatABI(getToolChain(), Args);
81 
82  if (ABI == arm::FloatABI::Hard)
83  CmdArgs.push_back("-mfpu=vfp");
84  else
85  CmdArgs.push_back("-mfpu=softvfp");
86 
87  switch (getToolChain().getTriple().getEnvironment()) {
88  case llvm::Triple::GNUEABIHF:
89  case llvm::Triple::GNUEABI:
90  case llvm::Triple::EABI:
91  CmdArgs.push_back("-meabi=5");
92  break;
93 
94  default:
95  CmdArgs.push_back("-matpcs");
96  }
97  break;
98  }
99  case llvm::Triple::sparc:
100  case llvm::Triple::sparcel:
101  case llvm::Triple::sparcv9: {
102  std::string CPU = getCPUName(D, Args, getToolChain().getTriple());
103  CmdArgs.push_back(
104  sparc::getSparcAsmModeForCPU(CPU, getToolChain().getTriple()));
105  AddAssemblerKPIC(getToolChain(), Args, CmdArgs);
106  break;
107  }
108  }
109 
110  for (const Arg *A : Args.filtered(options::OPT_ffile_prefix_map_EQ,
111  options::OPT_fdebug_prefix_map_EQ)) {
112  StringRef Map = A->getValue();
113  if (!Map.contains('='))
114  D.Diag(diag::err_drv_invalid_argument_to_option)
115  << Map << A->getOption().getName();
116  else {
117  CmdArgs.push_back(Args.MakeArgString("--debug-prefix-map"));
118  CmdArgs.push_back(Args.MakeArgString(Map));
119  }
120  A->claim();
121  }
122 
123  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
124 
125  CmdArgs.push_back("-o");
126  CmdArgs.push_back(Output.getFilename());
127 
128  for (const auto &II : Inputs)
129  CmdArgs.push_back(II.getFilename());
130 
131  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
132  C.addCommand(std::make_unique<Command>(JA, *this,
134  Exec, CmdArgs, Inputs, Output));
135 }
136 
138  const InputInfo &Output,
139  const InputInfoList &Inputs,
140  const ArgList &Args,
141  const char *LinkingOutput) const {
143  static_cast<const toolchains::FreeBSD &>(getToolChain());
144  const Driver &D = ToolChain.getDriver();
145  const llvm::Triple::ArchType Arch = ToolChain.getArch();
146  const bool IsPIE =
147  !Args.hasArg(options::OPT_shared) &&
148  (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault(Args));
149  ArgStringList CmdArgs;
150 
151  // Silence warning for "clang -g foo.o -o foo"
152  Args.ClaimAllArgs(options::OPT_g_Group);
153  // and "clang -emit-llvm foo.o -o foo"
154  Args.ClaimAllArgs(options::OPT_emit_llvm);
155  // and for "clang -w foo.o -o foo". Other warning options are already
156  // handled somewhere else.
157  Args.ClaimAllArgs(options::OPT_w);
158 
159  if (!D.SysRoot.empty())
160  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
161 
162  if (IsPIE)
163  CmdArgs.push_back("-pie");
164 
165  CmdArgs.push_back("--eh-frame-hdr");
166  if (Args.hasArg(options::OPT_static)) {
167  CmdArgs.push_back("-Bstatic");
168  } else {
169  if (Args.hasArg(options::OPT_rdynamic))
170  CmdArgs.push_back("-export-dynamic");
171  if (Args.hasArg(options::OPT_shared)) {
172  CmdArgs.push_back("-Bshareable");
173  } else {
174  CmdArgs.push_back("-dynamic-linker");
175  CmdArgs.push_back("/libexec/ld-elf.so.1");
176  }
177  const llvm::Triple &T = ToolChain.getTriple();
178  if (T.getOSMajorVersion() >= 9) {
179  if (Arch == llvm::Triple::arm || Arch == llvm::Triple::sparc || T.isX86())
180  CmdArgs.push_back("--hash-style=both");
181  }
182  CmdArgs.push_back("--enable-new-dtags");
183  }
184 
185  // Explicitly set the linker emulation for platforms that might not
186  // be the default emulation for the linker.
187  switch (Arch) {
188  case llvm::Triple::x86:
189  CmdArgs.push_back("-m");
190  CmdArgs.push_back("elf_i386_fbsd");
191  break;
192  case llvm::Triple::ppc:
193  CmdArgs.push_back("-m");
194  CmdArgs.push_back("elf32ppc_fbsd");
195  break;
196  case llvm::Triple::ppcle:
197  CmdArgs.push_back("-m");
198  // Use generic -- only usage is for freestanding.
199  CmdArgs.push_back("elf32lppc");
200  break;
201  case llvm::Triple::mips:
202  CmdArgs.push_back("-m");
203  CmdArgs.push_back("elf32btsmip_fbsd");
204  break;
205  case llvm::Triple::mipsel:
206  CmdArgs.push_back("-m");
207  CmdArgs.push_back("elf32ltsmip_fbsd");
208  break;
209  case llvm::Triple::mips64:
210  CmdArgs.push_back("-m");
211  if (tools::mips::hasMipsAbiArg(Args, "n32"))
212  CmdArgs.push_back("elf32btsmipn32_fbsd");
213  else
214  CmdArgs.push_back("elf64btsmip_fbsd");
215  break;
216  case llvm::Triple::mips64el:
217  CmdArgs.push_back("-m");
218  if (tools::mips::hasMipsAbiArg(Args, "n32"))
219  CmdArgs.push_back("elf32ltsmipn32_fbsd");
220  else
221  CmdArgs.push_back("elf64ltsmip_fbsd");
222  break;
223  case llvm::Triple::riscv32:
224  CmdArgs.push_back("-m");
225  CmdArgs.push_back("elf32lriscv");
226  break;
227  case llvm::Triple::riscv64:
228  CmdArgs.push_back("-m");
229  CmdArgs.push_back("elf64lriscv");
230  break;
231  default:
232  break;
233  }
234 
235  if (Arg *A = Args.getLastArg(options::OPT_G)) {
236  if (ToolChain.getTriple().isMIPS()) {
237  StringRef v = A->getValue();
238  CmdArgs.push_back(Args.MakeArgString("-G" + v));
239  A->claim();
240  }
241  }
242 
243  if (Output.isFilename()) {
244  CmdArgs.push_back("-o");
245  CmdArgs.push_back(Output.getFilename());
246  } else {
247  assert(Output.isNothing() && "Invalid output.");
248  }
249 
250  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
251  options::OPT_r)) {
252  const char *crt1 = nullptr;
253  if (!Args.hasArg(options::OPT_shared)) {
254  if (Args.hasArg(options::OPT_pg))
255  crt1 = "gcrt1.o";
256  else if (IsPIE)
257  crt1 = "Scrt1.o";
258  else
259  crt1 = "crt1.o";
260  }
261  if (crt1)
262  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
263 
264  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
265 
266  const char *crtbegin = nullptr;
267  if (Args.hasArg(options::OPT_static))
268  crtbegin = "crtbeginT.o";
269  else if (Args.hasArg(options::OPT_shared) || IsPIE)
270  crtbegin = "crtbeginS.o";
271  else
272  crtbegin = "crtbegin.o";
273 
274  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
275  }
276 
277  Args.AddAllArgs(CmdArgs, options::OPT_L);
278  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
279  Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
280  Args.AddAllArgs(CmdArgs, options::OPT_e);
281  Args.AddAllArgs(CmdArgs, options::OPT_s);
282  Args.AddAllArgs(CmdArgs, options::OPT_t);
283  Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
284  Args.AddAllArgs(CmdArgs, options::OPT_r);
285 
286  if (D.isUsingLTO()) {
287  assert(!Inputs.empty() && "Must have at least one input.");
288  addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
289  D.getLTOMode() == LTOK_Thin);
290  }
291 
292  bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
293  bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
295  AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
296 
297  unsigned Major = ToolChain.getTriple().getOSMajorVersion();
298  bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
299  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
300  options::OPT_r)) {
301  // Use the static OpenMP runtime with -static-openmp
302  bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
303  !Args.hasArg(options::OPT_static);
304  addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
305 
306  if (D.CCCIsCXX()) {
307  if (ToolChain.ShouldLinkCXXStdlib(Args))
308  ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
309  if (Profiling)
310  CmdArgs.push_back("-lm_p");
311  else
312  CmdArgs.push_back("-lm");
313  }
314  if (NeedsSanitizerDeps)
316  if (NeedsXRayDeps)
317  linkXRayRuntimeDeps(ToolChain, CmdArgs);
318  // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
319  // the default system libraries. Just mimic this for now.
320  if (Profiling)
321  CmdArgs.push_back("-lgcc_p");
322  else
323  CmdArgs.push_back("-lgcc");
324  if (Args.hasArg(options::OPT_static)) {
325  CmdArgs.push_back("-lgcc_eh");
326  } else if (Profiling) {
327  CmdArgs.push_back("-lgcc_eh_p");
328  } else {
329  CmdArgs.push_back("--as-needed");
330  CmdArgs.push_back("-lgcc_s");
331  CmdArgs.push_back("--no-as-needed");
332  }
333 
334  if (Args.hasArg(options::OPT_pthread)) {
335  if (Profiling)
336  CmdArgs.push_back("-lpthread_p");
337  else
338  CmdArgs.push_back("-lpthread");
339  }
340 
341  if (Profiling) {
342  if (Args.hasArg(options::OPT_shared))
343  CmdArgs.push_back("-lc");
344  else
345  CmdArgs.push_back("-lc_p");
346  CmdArgs.push_back("-lgcc_p");
347  } else {
348  CmdArgs.push_back("-lc");
349  CmdArgs.push_back("-lgcc");
350  }
351 
352  if (Args.hasArg(options::OPT_static)) {
353  CmdArgs.push_back("-lgcc_eh");
354  } else if (Profiling) {
355  CmdArgs.push_back("-lgcc_eh_p");
356  } else {
357  CmdArgs.push_back("--as-needed");
358  CmdArgs.push_back("-lgcc_s");
359  CmdArgs.push_back("--no-as-needed");
360  }
361  }
362 
363  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
364  options::OPT_r)) {
365  if (Args.hasArg(options::OPT_shared) || IsPIE)
366  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
367  else
368  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
369  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
370  }
371 
372  ToolChain.addProfileRTLibs(Args, CmdArgs);
373 
374  const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
375  C.addCommand(std::make_unique<Command>(JA, *this,
377  Exec, CmdArgs, Inputs, Output));
378 }
379 
380 /// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
381 
382 FreeBSD::FreeBSD(const Driver &D, const llvm::Triple &Triple,
383  const ArgList &Args)
384  : Generic_ELF(D, Triple, Args) {
385 
386  // When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall
387  // back to '/usr/lib' if it doesn't exist.
388  if ((Triple.getArch() == llvm::Triple::x86 || Triple.isMIPS32() ||
389  Triple.isPPC32()) &&
390  D.getVFS().exists(getDriver().SysRoot + "/usr/lib32/crt1.o"))
391  getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32");
392  else
393  getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");
394 }
395 
397  unsigned Major = getTriple().getOSMajorVersion();
398  if (Major >= 10 || Major == 0)
399  return ToolChain::CST_Libcxx;
401 }
402 
404  if (getTriple().getOSMajorVersion() < 12)
405  return 2;
406  return 4;
407 }
408 
409 void FreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
410  llvm::opt::ArgStringList &CC1Args) const {
411  addSystemInclude(DriverArgs, CC1Args,
412  getDriver().SysRoot + "/usr/include/c++/v1");
413 }
414 
416  const llvm::opt::ArgList &DriverArgs,
417  llvm::opt::ArgStringList &CC1Args) const {
418  addLibStdCXXIncludePaths(getDriver().SysRoot + "/usr/include/c++/4.2", "", "",
419  DriverArgs, CC1Args);
420 }
421 
422 void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
423  ArgStringList &CmdArgs) const {
425  unsigned Major = getTriple().getOSMajorVersion();
426  bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
427 
428  switch (Type) {
430  CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
431  break;
432 
434  CmdArgs.push_back(Profiling ? "-lstdc++_p" : "-lstdc++");
435  break;
436  }
437 }
438 
439 void FreeBSD::AddCudaIncludeArgs(const ArgList &DriverArgs,
440  ArgStringList &CC1Args) const {
441  CudaInstallation.AddCudaIncludeArgs(DriverArgs, CC1Args);
442 }
443 
444 void FreeBSD::AddHIPIncludeArgs(const ArgList &DriverArgs,
445  ArgStringList &CC1Args) const {
446  RocmInstallation.AddHIPIncludeArgs(DriverArgs, CC1Args);
447 }
448 
450  return new tools::freebsd::Assembler(*this);
451 }
452 
453 Tool *FreeBSD::buildLinker() const { return new tools::freebsd::Linker(*this); }
454 
455 llvm::ExceptionHandling FreeBSD::GetExceptionModel(const ArgList &Args) const {
456  // FreeBSD uses SjLj exceptions on ARM oabi.
457  switch (getTriple().getEnvironment()) {
458  case llvm::Triple::GNUEABIHF:
459  case llvm::Triple::GNUEABI:
460  case llvm::Triple::EABI:
462  default:
463  if (getTriple().getArch() == llvm::Triple::arm ||
464  getTriple().getArch() == llvm::Triple::thumb)
465  return llvm::ExceptionHandling::SjLj;
467  }
468 }
469 
470 bool FreeBSD::HasNativeLLVMSupport() const { return true; }
471 
472 bool FreeBSD::IsUnwindTablesDefault(const ArgList &Args) const { return true; }
473 
474 bool FreeBSD::isPIEDefault(const llvm::opt::ArgList &Args) const {
475  return getSanitizerArgs(Args).requiresPIE();
476 }
477 
479  const bool IsAArch64 = getTriple().getArch() == llvm::Triple::aarch64;
480  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
481  const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
482  const bool IsMIPS64 = getTriple().isMIPS64();
484  Res |= SanitizerKind::Address;
485  Res |= SanitizerKind::PointerCompare;
486  Res |= SanitizerKind::PointerSubtract;
487  Res |= SanitizerKind::Vptr;
488  if (IsX86_64 || IsMIPS64) {
489  Res |= SanitizerKind::Leak;
490  Res |= SanitizerKind::Thread;
491  }
492  if (IsX86 || IsX86_64) {
493  Res |= SanitizerKind::Function;
494  Res |= SanitizerKind::SafeStack;
495  Res |= SanitizerKind::Fuzzer;
496  Res |= SanitizerKind::FuzzerNoLink;
497  }
498  if (IsAArch64 || IsX86_64) {
499  Res |= SanitizerKind::KernelAddress;
500  Res |= SanitizerKind::KernelMemory;
501  }
502  if (IsX86_64) {
503  Res |= SanitizerKind::Memory;
504  }
505  return Res;
506 }
507 
508 void FreeBSD::addClangTargetOptions(const ArgList &DriverArgs,
509  ArgStringList &CC1Args,
510  Action::OffloadKind) const {
511  if (!DriverArgs.hasFlag(options::OPT_fuse_init_array,
512  options::OPT_fno_use_init_array,
513  getTriple().getOSMajorVersion() >= 12))
514  CC1Args.push_back("-fno-use-init-array");
515 }
clang::driver::tools::mips::getGnuCompatibleMipsABIName
StringRef getGnuCompatibleMipsABIName(StringRef ABI)
Definition: Mips.cpp:143
clang::driver::toolchains
Definition: AIX.h:55
Mips.h
clang::driver::toolchains::FreeBSD::buildLinker
Tool * buildLinker() const override
Definition: FreeBSD.cpp:453
clang::driver::tools::AddAssemblerKPIC
void AddAssemblerKPIC(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
clang::driver::toolchains::FreeBSD
Definition: FreeBSD.h:52
clang::driver::tools::freebsd::Assembler::ConstructJob
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:27
clang::driver::RocmInstallationDetector::AddHIPIncludeArgs
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Definition: AMDGPU.cpp:486
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::driver::toolchains::FreeBSD::GetExceptionModel
llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const override
GetExceptionModel - Return the tool chain exception model.
Definition: FreeBSD.cpp:455
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::tools::arm::getARMFloatABI
FloatABI getARMFloatABI(const ToolChain &TC, const llvm::opt::ArgList &Args)
clang::driver::toolchains::Generic_GCC::CudaInstallation
CudaInstallationDetector CudaInstallation
Definition: Gnu.h:289
clang::driver::tools
Definition: AIX.h:17
clang::driver::tools::mips::hasMipsAbiArg
bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value)
clang::driver::toolchains::FreeBSD::buildAssembler
Tool * buildAssembler() const override
Definition: FreeBSD.cpp:449
clang::driver::toolchains::FreeBSD::getSupportedSanitizers
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: FreeBSD.cpp:478
clang::driver::ToolChain::getDriver
const Driver & getDriver() const
Definition: ToolChain.h:225
clang::driver::tools::freebsd::Linker::ConstructJob
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:137
Sparc.h
clang::driver::tools::getCPUName
std::string getCPUName(const Driver &D, const llvm::opt::ArgList &Args, const llvm::Triple &T, bool FromAs=false)
clang::driver::toolchains::FreeBSD::addLibStdCxxIncludePaths
void addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: FreeBSD.cpp:415
clang::driver::toolchains::FreeBSD::isPIEDefault
bool isPIEDefault(const llvm::opt::ArgList &Args) const override
Test whether this toolchain defaults to PIE.
Definition: FreeBSD.cpp:474
clang::driver::ToolChain::GetFilePath
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:577
clang::driver::tools::freebsd::Assembler
Definition: FreeBSD.h:22
clang::driver::ToolChain::getSanitizerArgs
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:118
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
clang::driver::toolchains::FreeBSD::AddCXXStdlibLibArgs
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:422
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1500
clang::driver::tools::AddLinkerInputs
void AddLinkerInputs(const ToolChain &TC, const InputInfoList &Inputs, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const JobAction &JA)
clang::driver::toolchains::FreeBSD::AddCudaIncludeArgs
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific CUDA includes.
Definition: FreeBSD.cpp:439
clang::driver::ToolChain::getFilePaths
path_list & getFilePaths()
Definition: ToolChain.h:263
clang::driver::Driver::getLTOMode
LTOKind getLTOMode(bool IsOffload=false) const
Get the specific kind of LTO being performed.
Definition: Driver.h:624
clang::driver::tools::arm::FloatABI
FloatABI
Definition: ARM.h:44
clang::driver::ToolChain::isPIEDefault
virtual bool isPIEDefault(const llvm::opt::ArgList &Args) const =0
Test whether this toolchain defaults to PIE.
clang::driver::SanitizerArgs::requiresPIE
bool requiresPIE() const
Definition: SanitizerArgs.cpp:278
clang::driver::Tool
Tool - Information on a specific compilation tool.
Definition: Tool.h:32
clang::driver::toolchains::Generic_ELF
Definition: Gnu.h:362
clang::driver::tools::claimNoWarnArgs
void claimNoWarnArgs(const llvm::opt::ArgList &Args)
Options.h
clang::driver::InputInfo::isFilename
bool isFilename() const
Definition: InputInfo.h:75
clang::XRayInstrKind::None
constexpr XRayInstrMask None
Definition: XRayInstr.h:38
clang::driver::LTOK_Thin
@ LTOK_Thin
Definition: Driver.h:55
llvm::opt
Definition: DiagnosticOptions.h:19
DriverDiagnostic.h
clang::driver::ResponseFileSupport::AtFileCurCP
static constexpr ResponseFileSupport AtFileCurCP()
Definition: Job.h:92
clang::driver::InputInfo::isNothing
bool isNothing() const
Definition: InputInfo.h:74
clang::driver::toolchains::FreeBSD::addLibCxxIncludePaths
void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: FreeBSD.cpp:409
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
clang::driver::toolchains::FreeBSD::GetDefaultCXXStdlibType
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: FreeBSD.cpp:396
clang::driver::tools::freebsd::Linker
Definition: FreeBSD.h:35
clang::driver::tools::arm::FloatABI::Hard
@ Hard
clang::driver::ToolChain::getTriple
const llvm::Triple & getTriple() const
Definition: ToolChain.h:227
clang::driver::Driver::SysRoot
std::string SysRoot
sysroot, if present
Definition: Driver.h:171
clang::driver::ToolChain::CST_Libcxx
@ CST_Libcxx
Definition: ToolChain.h:96
clang::driver::Driver::CCCIsCXX
bool CCCIsCXX() const
Whether the driver should follow g++ like behavior.
Definition: Driver.h:201
clang::driver::tools::addXRayRuntime
bool addXRayRuntime(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
clang::driver::toolchains::FreeBSD::GetDefaultDwarfVersion
unsigned GetDefaultDwarfVersion() const override
Definition: FreeBSD.cpp:403
clang::driver::toolchains::FreeBSD::IsUnwindTablesDefault
bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override
IsUnwindTablesDefault - Does this tool chain use -funwind-tables by default.
Definition: FreeBSD.cpp:472
SanitizerArgs.h
clang::driver::ToolChain::CST_Libstdcxx
@ CST_Libstdcxx
Definition: ToolChain.h:97
clang::driver::ToolChain::getArch
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:241
clang::driver::ToolChain::AddFilePathLibArgs
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:988
clang::driver::ToolChain::ShouldLinkCXXStdlib
bool ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const
Returns if the C++ standard library should be linked in.
Definition: ToolChain.cpp:965
clang::driver::tools::addLTOOptions
void addLTOOptions(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const InputInfo &Output, const InputInfo &Input, bool IsThinLTO)
clang::driver::toolchains::Generic_GCC::RocmInstallation
RocmInstallationDetector RocmInstallation
Definition: Gnu.h:290
FreeBSD.h
clang::driver::ToolChain::getSupportedSanitizers
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1031
clang::driver::Driver::isUsingLTO
bool isUsingLTO(bool IsOffload=false) const
Returns true if we are performing any kind of LTO.
Definition: Driver.h:619
clang::driver::ToolChain::AddCXXStdlibLibArgs
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:971
Compilation.h
clang::driver::ToolChain::addProfileRTLibs
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:782
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::toolchains::FreeBSD::HasNativeLLVMSupport
bool HasNativeLLVMSupport() const override
HasNativeLTOLinker - Check whether the linker and related tools have native LLVM support.
Definition: FreeBSD.cpp:470
clang::driver::CudaInstallationDetector::AddCudaIncludeArgs
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Definition: Cuda.cpp:284
clang::driver::toolchains::FreeBSD::addClangTargetOptions
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: FreeBSD.cpp:508
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang::driver::ToolChain::GetCXXStdlibType
virtual CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const
Definition: ToolChain.cpp:852
clang::driver::toolchains::Generic_GCC::addLibStdCXXIncludePaths
bool addLibStdCXXIncludePaths(Twine IncludeDir, StringRef Triple, Twine IncludeSuffix, const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, bool DetectDebian=false) const
Definition: Gnu.cpp:3034
clang::driver::tools::addOpenMPRuntime
bool addOpenMPRuntime(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.
clang::driver::InputInfo::getFilename
const char * getFilename() const
Definition: InputInfo.h:83
clang::driver::tools::mips::getMipsCPUAndABI
void getMipsCPUAndABI(const llvm::opt::ArgList &Args, const llvm::Triple &Triple, StringRef &CPUName, StringRef &ABIName)
clang::driver::tools::linkSanitizerRuntimeDeps
void linkSanitizerRuntimeDeps(const ToolChain &TC, llvm::opt::ArgStringList &CmdArgs)
CommonArgs.h
clang
Definition: CalledOnceCheck.h:17
clang::driver::Driver
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Definition: Driver.h:71
clang::driver::tools::addSanitizerRuntimes
bool addSanitizerRuntimes(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
clang::driver::tools::linkXRayRuntimeDeps
void linkXRayRuntimeDeps(const ToolChain &TC, llvm::opt::ArgStringList &CmdArgs)
clang::driver::Driver::getVFS
llvm::vfs::FileSystem & getVFS() const
Definition: Driver.h:362
v
do v
Definition: arm_acle.h:76
clang::driver::tools::addLinkerCompressDebugSectionsOption
void addLinkerCompressDebugSectionsOption(const ToolChain &TC, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
Definition: CommonArgs.cpp:289
ARM.h
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:88
clang::driver
Definition: Action.h:31
clang::driver::ToolChain::addSystemInclude
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:878
clang::driver::JobAction
Definition: Action.h:395
clang::driver::toolchains::FreeBSD::AddHIPIncludeArgs
void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Add arguments to use system-specific HIP includes.
Definition: FreeBSD.cpp:444
clang::driver::tools::sparc::getSparcAsmModeForCPU
const char * getSparcAsmModeForCPU(llvm::StringRef Name, const llvm::Triple &Triple)
clang::SanitizerMask
Definition: Sanitizers.h:30