clang  14.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());
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  const char *crt1 = nullptr;
252  if (!Args.hasArg(options::OPT_shared)) {
253  if (Args.hasArg(options::OPT_pg))
254  crt1 = "gcrt1.o";
255  else if (IsPIE)
256  crt1 = "Scrt1.o";
257  else
258  crt1 = "crt1.o";
259  }
260  if (crt1)
261  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1)));
262 
263  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
264 
265  const char *crtbegin = nullptr;
266  if (Args.hasArg(options::OPT_static))
267  crtbegin = "crtbeginT.o";
268  else if (Args.hasArg(options::OPT_shared) || IsPIE)
269  crtbegin = "crtbeginS.o";
270  else
271  crtbegin = "crtbegin.o";
272 
273  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
274  }
275 
276  Args.AddAllArgs(CmdArgs, options::OPT_L);
277  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
278  Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
279  Args.AddAllArgs(CmdArgs, options::OPT_e);
280  Args.AddAllArgs(CmdArgs, options::OPT_s);
281  Args.AddAllArgs(CmdArgs, options::OPT_t);
282  Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
283  Args.AddAllArgs(CmdArgs, options::OPT_r);
284 
285  if (D.isUsingLTO()) {
286  assert(!Inputs.empty() && "Must have at least one input.");
287  addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0],
288  D.getLTOMode() == LTOK_Thin);
289  }
290 
291  bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
292  bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
294  AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
295 
296  bool Profiling = Args.hasArg(options::OPT_pg) &&
297  ToolChain.getTriple().getOSMajorVersion() < 14;
298  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
299  // Use the static OpenMP runtime with -static-openmp
300  bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
301  !Args.hasArg(options::OPT_static);
302  addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
303 
304  if (D.CCCIsCXX()) {
305  if (ToolChain.ShouldLinkCXXStdlib(Args))
306  ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
307  if (Profiling)
308  CmdArgs.push_back("-lm_p");
309  else
310  CmdArgs.push_back("-lm");
311  }
312  if (NeedsSanitizerDeps)
314  if (NeedsXRayDeps)
315  linkXRayRuntimeDeps(ToolChain, CmdArgs);
316  // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
317  // the default system libraries. Just mimic this for now.
318  if (Profiling)
319  CmdArgs.push_back("-lgcc_p");
320  else
321  CmdArgs.push_back("-lgcc");
322  if (Args.hasArg(options::OPT_static)) {
323  CmdArgs.push_back("-lgcc_eh");
324  } else if (Profiling) {
325  CmdArgs.push_back("-lgcc_eh_p");
326  } else {
327  CmdArgs.push_back("--as-needed");
328  CmdArgs.push_back("-lgcc_s");
329  CmdArgs.push_back("--no-as-needed");
330  }
331 
332  if (Args.hasArg(options::OPT_pthread)) {
333  if (Profiling)
334  CmdArgs.push_back("-lpthread_p");
335  else
336  CmdArgs.push_back("-lpthread");
337  }
338 
339  if (Profiling) {
340  if (Args.hasArg(options::OPT_shared))
341  CmdArgs.push_back("-lc");
342  else
343  CmdArgs.push_back("-lc_p");
344  CmdArgs.push_back("-lgcc_p");
345  } else {
346  CmdArgs.push_back("-lc");
347  CmdArgs.push_back("-lgcc");
348  }
349 
350  if (Args.hasArg(options::OPT_static)) {
351  CmdArgs.push_back("-lgcc_eh");
352  } else if (Profiling) {
353  CmdArgs.push_back("-lgcc_eh_p");
354  } else {
355  CmdArgs.push_back("--as-needed");
356  CmdArgs.push_back("-lgcc_s");
357  CmdArgs.push_back("--no-as-needed");
358  }
359  }
360 
361  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
362  if (Args.hasArg(options::OPT_shared) || IsPIE)
363  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
364  else
365  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
366  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
367  }
368 
369  ToolChain.addProfileRTLibs(Args, CmdArgs);
370 
371  const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath());
372  C.addCommand(std::make_unique<Command>(JA, *this,
374  Exec, CmdArgs, Inputs, Output));
375 }
376 
377 /// FreeBSD - FreeBSD tool chain which can call as(1) and ld(1) directly.
378 
379 FreeBSD::FreeBSD(const Driver &D, const llvm::Triple &Triple,
380  const ArgList &Args)
381  : Generic_ELF(D, Triple, Args) {
382 
383  // When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall
384  // back to '/usr/lib' if it doesn't exist.
385  if ((Triple.getArch() == llvm::Triple::x86 || Triple.isMIPS32() ||
386  Triple.isPPC32()) &&
387  D.getVFS().exists(getDriver().SysRoot + "/usr/lib32/crt1.o"))
388  getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32");
389  else
390  getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");
391 }
392 
394  if (getTriple().getOSMajorVersion() >= 10)
395  return ToolChain::CST_Libcxx;
397 }
398 
400  if (getTriple().getOSMajorVersion() < 12)
401  return 2;
402  return 4;
403 }
404 
405 void FreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
406  llvm::opt::ArgStringList &CC1Args) const {
407  addSystemInclude(DriverArgs, CC1Args,
408  getDriver().SysRoot + "/usr/include/c++/v1");
409 }
410 
412  const llvm::opt::ArgList &DriverArgs,
413  llvm::opt::ArgStringList &CC1Args) const {
414  addLibStdCXXIncludePaths(getDriver().SysRoot + "/usr/include/c++/4.2", "", "",
415  DriverArgs, CC1Args);
416 }
417 
418 void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
419  ArgStringList &CmdArgs) const {
421  bool Profiling =
422  Args.hasArg(options::OPT_pg) && getTriple().getOSMajorVersion() < 14;
423 
424  switch (Type) {
426  CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
427  break;
428 
430  CmdArgs.push_back(Profiling ? "-lstdc++_p" : "-lstdc++");
431  break;
432  }
433 }
434 
435 void FreeBSD::AddCudaIncludeArgs(const ArgList &DriverArgs,
436  ArgStringList &CC1Args) const {
437  CudaInstallation.AddCudaIncludeArgs(DriverArgs, CC1Args);
438 }
439 
440 void FreeBSD::AddHIPIncludeArgs(const ArgList &DriverArgs,
441  ArgStringList &CC1Args) const {
442  RocmInstallation.AddHIPIncludeArgs(DriverArgs, CC1Args);
443 }
444 
446  return new tools::freebsd::Assembler(*this);
447 }
448 
449 Tool *FreeBSD::buildLinker() const { return new tools::freebsd::Linker(*this); }
450 
451 llvm::ExceptionHandling FreeBSD::GetExceptionModel(const ArgList &Args) const {
452  // FreeBSD uses SjLj exceptions on ARM oabi.
453  switch (getTriple().getEnvironment()) {
454  case llvm::Triple::GNUEABIHF:
455  case llvm::Triple::GNUEABI:
456  case llvm::Triple::EABI:
458  default:
459  if (getTriple().getArch() == llvm::Triple::arm ||
460  getTriple().getArch() == llvm::Triple::thumb)
461  return llvm::ExceptionHandling::SjLj;
463  }
464 }
465 
466 bool FreeBSD::HasNativeLLVMSupport() const { return true; }
467 
468 bool FreeBSD::IsUnwindTablesDefault(const ArgList &Args) const { return true; }
469 
471 
473  const bool IsAArch64 = getTriple().getArch() == llvm::Triple::aarch64;
474  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
475  const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
476  const bool IsMIPS64 = getTriple().isMIPS64();
478  Res |= SanitizerKind::Address;
479  Res |= SanitizerKind::PointerCompare;
480  Res |= SanitizerKind::PointerSubtract;
481  Res |= SanitizerKind::Vptr;
482  if (IsX86_64 || IsMIPS64) {
483  Res |= SanitizerKind::Leak;
484  Res |= SanitizerKind::Thread;
485  }
486  if (IsX86 || IsX86_64) {
487  Res |= SanitizerKind::Function;
488  Res |= SanitizerKind::SafeStack;
489  Res |= SanitizerKind::Fuzzer;
490  Res |= SanitizerKind::FuzzerNoLink;
491  }
492  if (IsAArch64 || IsX86_64) {
493  Res |= SanitizerKind::KernelAddress;
494  Res |= SanitizerKind::KernelMemory;
495  }
496  if (IsX86_64) {
497  Res |= SanitizerKind::Memory;
498  }
499  return Res;
500 }
501 
502 void FreeBSD::addClangTargetOptions(const ArgList &DriverArgs,
503  ArgStringList &CC1Args,
504  Action::OffloadKind) const {
505  if (!DriverArgs.hasFlag(options::OPT_fuse_init_array,
506  options::OPT_fno_use_init_array,
507  getTriple().getOSMajorVersion() >= 12))
508  CC1Args.push_back("-fno-use-init-array");
509 }
clang::driver::tools::mips::getGnuCompatibleMipsABIName
StringRef getGnuCompatibleMipsABIName(StringRef ABI)
Definition: Mips.cpp:143
clang::driver::toolchains
Definition: AIX.h:55
Mips.h
clang::driver::ToolChain::getSanitizerArgs
const SanitizerArgs & getSanitizerArgs() const
Definition: ToolChain.cpp:117
clang::driver::toolchains::FreeBSD::buildLinker
Tool * buildLinker() const override
Definition: FreeBSD.cpp:449
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:479
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:451
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:445
clang::driver::toolchains::FreeBSD::getSupportedSanitizers
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: FreeBSD.cpp:472
clang::driver::ToolChain::getDriver
const Driver & getDriver() const
Definition: ToolChain.h:221
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:411
clang::driver::ToolChain::GetFilePath
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:538
clang::driver::tools::freebsd::Assembler
Definition: FreeBSD.h:22
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:418
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1490
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:435
clang::driver::ToolChain::getFilePaths
path_list & getFilePaths()
Definition: ToolChain.h:259
clang::driver::Driver::getLTOMode
LTOKind getLTOMode(bool IsOffload=false) const
Get the specific kind of LTO being performed.
Definition: Driver.h:564
clang::driver::tools::arm::FloatABI
FloatABI
Definition: ARM.h:43
clang::driver::SanitizerArgs::requiresPIE
bool requiresPIE() const
Definition: SanitizerArgs.cpp:268
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:53
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:405
clang::driver::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
clang::driver::toolchains::FreeBSD::GetDefaultCXXStdlibType
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: FreeBSD.cpp:393
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:223
clang::driver::Driver::SysRoot
std::string SysRoot
sysroot, if present
Definition: Driver.h:151
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:179
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:399
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:468
SanitizerArgs.h
clang::driver::ToolChain::CST_Libstdcxx
@ CST_Libstdcxx
Definition: ToolChain.h:97
clang::driver::ToolChain::isPIEDefault
virtual bool isPIEDefault() const =0
Test whether this toolchain defaults to PIE.
clang::driver::ToolChain::getArch
llvm::Triple::ArchType getArch() const
Definition: ToolChain.h:237
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:955
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:932
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:998
clang::driver::Driver::isUsingLTO
bool isUsingLTO(bool IsOffload=false) const
Returns true if we are performing any kind of LTO.
Definition: Driver.h:559
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:938
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:749
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:466
clang::driver::CudaInstallationDetector::AddCudaIncludeArgs
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const
Definition: Cuda.cpp:282
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:502
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:819
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:2931
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:59
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:329
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:285
ARM.h
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:85
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:845
clang::driver::JobAction
Definition: Action.h:380
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:440
clang::driver::tools::sparc::getSparcAsmModeForCPU
const char * getSparcAsmModeForCPU(llvm::StringRef Name, const llvm::Triple &Triple)
clang::driver::toolchains::FreeBSD::isPIEDefault
bool isPIEDefault() const override
Test whether this toolchain defaults to PIE.
Definition: FreeBSD.cpp:470
clang::SanitizerMask
Definition: Sanitizers.h:30