clang  14.0.0git
NetBSD.cpp
Go to the documentation of this file.
1 //===--- NetBSD.cpp - NetBSD 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 "NetBSD.h"
10 #include "Arch/ARM.h"
11 #include "Arch/Mips.h"
12 #include "Arch/Sparc.h"
13 #include "CommonArgs.h"
15 #include "clang/Driver/Driver.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 {
33  static_cast<const toolchains::NetBSD &>(getToolChain());
34  const Driver &D = ToolChain.getDriver();
35  const llvm::Triple &Triple = ToolChain.getTriple();
36 
37  claimNoWarnArgs(Args);
38  ArgStringList CmdArgs;
39 
40  // GNU as needs different flags for creating the correct output format
41  // on architectures with different ABIs or optional feature sets.
42  switch (ToolChain.getArch()) {
43  case llvm::Triple::x86:
44  CmdArgs.push_back("--32");
45  break;
46  case llvm::Triple::arm:
47  case llvm::Triple::armeb:
48  case llvm::Triple::thumb:
49  case llvm::Triple::thumbeb: {
50  StringRef MArch, MCPU;
51  arm::getARMArchCPUFromArgs(Args, MArch, MCPU, /*FromAs*/ true);
52  std::string Arch = arm::getARMTargetCPU(MCPU, MArch, Triple);
53  CmdArgs.push_back(Args.MakeArgString("-mcpu=" + Arch));
54  break;
55  }
56 
57  case llvm::Triple::mips:
58  case llvm::Triple::mipsel:
59  case llvm::Triple::mips64:
60  case llvm::Triple::mips64el: {
61  StringRef CPUName;
62  StringRef ABIName;
63  mips::getMipsCPUAndABI(Args, Triple, CPUName, ABIName);
64 
65  CmdArgs.push_back("-march");
66  CmdArgs.push_back(CPUName.data());
67 
68  CmdArgs.push_back("-mabi");
69  CmdArgs.push_back(mips::getGnuCompatibleMipsABIName(ABIName).data());
70 
71  if (Triple.isLittleEndian())
72  CmdArgs.push_back("-EL");
73  else
74  CmdArgs.push_back("-EB");
75 
76  AddAssemblerKPIC(ToolChain, Args, CmdArgs);
77  break;
78  }
79 
80  case llvm::Triple::sparc:
81  case llvm::Triple::sparcel: {
82  CmdArgs.push_back("-32");
83  std::string CPU = getCPUName(D, Args, Triple);
84  CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, Triple));
85  AddAssemblerKPIC(ToolChain, Args, CmdArgs);
86  break;
87  }
88 
89  case llvm::Triple::sparcv9: {
90  CmdArgs.push_back("-64");
91  std::string CPU = getCPUName(D, Args, Triple);
92  CmdArgs.push_back(sparc::getSparcAsmModeForCPU(CPU, Triple));
93  AddAssemblerKPIC(ToolChain, Args, CmdArgs);
94  break;
95  }
96 
97  default:
98  break;
99  }
100 
101  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
102 
103  CmdArgs.push_back("-o");
104  CmdArgs.push_back(Output.getFilename());
105 
106  for (const auto &II : Inputs)
107  CmdArgs.push_back(II.getFilename());
108 
109  const char *Exec = Args.MakeArgString((ToolChain.GetProgramPath("as")));
110  C.addCommand(std::make_unique<Command>(JA, *this,
112  Exec, CmdArgs, Inputs, Output));
113 }
114 
116  const InputInfo &Output,
117  const InputInfoList &Inputs,
118  const ArgList &Args,
119  const char *LinkingOutput) const {
121  static_cast<const toolchains::NetBSD &>(getToolChain());
122  const Driver &D = ToolChain.getDriver();
123  const llvm::Triple &Triple = ToolChain.getTriple();
124 
125  ArgStringList CmdArgs;
126 
127  if (!D.SysRoot.empty())
128  CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
129 
130  CmdArgs.push_back("--eh-frame-hdr");
131  if (Args.hasArg(options::OPT_static)) {
132  CmdArgs.push_back("-Bstatic");
133  if (Args.hasArg(options::OPT_pie)) {
134  Args.AddAllArgs(CmdArgs, options::OPT_pie);
135  CmdArgs.push_back("--no-dynamic-linker");
136  }
137  } else {
138  if (Args.hasArg(options::OPT_rdynamic))
139  CmdArgs.push_back("-export-dynamic");
140  if (Args.hasArg(options::OPT_shared)) {
141  CmdArgs.push_back("-Bshareable");
142  } else {
143  Args.AddAllArgs(CmdArgs, options::OPT_pie);
144  CmdArgs.push_back("-dynamic-linker");
145  CmdArgs.push_back("/libexec/ld.elf_so");
146  }
147  }
148 
149  // Many NetBSD architectures support more than one ABI.
150  // Determine the correct emulation for ld.
151  switch (ToolChain.getArch()) {
152  case llvm::Triple::x86:
153  CmdArgs.push_back("-m");
154  CmdArgs.push_back("elf_i386");
155  break;
156  case llvm::Triple::arm:
157  case llvm::Triple::thumb:
158  CmdArgs.push_back("-m");
159  switch (Triple.getEnvironment()) {
160  case llvm::Triple::EABI:
161  case llvm::Triple::GNUEABI:
162  CmdArgs.push_back("armelf_nbsd_eabi");
163  break;
164  case llvm::Triple::EABIHF:
165  case llvm::Triple::GNUEABIHF:
166  CmdArgs.push_back("armelf_nbsd_eabihf");
167  break;
168  default:
169  CmdArgs.push_back("armelf_nbsd");
170  break;
171  }
172  break;
173  case llvm::Triple::armeb:
174  case llvm::Triple::thumbeb:
176  CmdArgs.push_back("-m");
177  switch (Triple.getEnvironment()) {
178  case llvm::Triple::EABI:
179  case llvm::Triple::GNUEABI:
180  CmdArgs.push_back("armelfb_nbsd_eabi");
181  break;
182  case llvm::Triple::EABIHF:
183  case llvm::Triple::GNUEABIHF:
184  CmdArgs.push_back("armelfb_nbsd_eabihf");
185  break;
186  default:
187  CmdArgs.push_back("armelfb_nbsd");
188  break;
189  }
190  break;
191  case llvm::Triple::mips64:
192  case llvm::Triple::mips64el:
193  if (mips::hasMipsAbiArg(Args, "32")) {
194  CmdArgs.push_back("-m");
195  if (ToolChain.getArch() == llvm::Triple::mips64)
196  CmdArgs.push_back("elf32btsmip");
197  else
198  CmdArgs.push_back("elf32ltsmip");
199  } else if (mips::hasMipsAbiArg(Args, "64")) {
200  CmdArgs.push_back("-m");
201  if (ToolChain.getArch() == llvm::Triple::mips64)
202  CmdArgs.push_back("elf64btsmip");
203  else
204  CmdArgs.push_back("elf64ltsmip");
205  }
206  break;
207  case llvm::Triple::ppc:
208  CmdArgs.push_back("-m");
209  CmdArgs.push_back("elf32ppc_nbsd");
210  break;
211 
212  case llvm::Triple::ppc64:
213  case llvm::Triple::ppc64le:
214  CmdArgs.push_back("-m");
215  CmdArgs.push_back("elf64ppc");
216  break;
217 
218  case llvm::Triple::sparc:
219  CmdArgs.push_back("-m");
220  CmdArgs.push_back("elf32_sparc");
221  break;
222 
223  case llvm::Triple::sparcv9:
224  CmdArgs.push_back("-m");
225  CmdArgs.push_back("elf64_sparc");
226  break;
227 
228  default:
229  break;
230  }
231 
232  if (Output.isFilename()) {
233  CmdArgs.push_back("-o");
234  CmdArgs.push_back(Output.getFilename());
235  } else {
236  assert(Output.isNothing() && "Invalid output.");
237  }
238 
239  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
240  if (!Args.hasArg(options::OPT_shared)) {
241  CmdArgs.push_back(
242  Args.MakeArgString(ToolChain.GetFilePath("crt0.o")));
243  }
244  CmdArgs.push_back(
245  Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
246  if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie)) {
247  CmdArgs.push_back(
248  Args.MakeArgString(ToolChain.GetFilePath("crtbeginS.o")));
249  } else {
250  CmdArgs.push_back(
251  Args.MakeArgString(ToolChain.GetFilePath("crtbegin.o")));
252  }
253  }
254 
255  Args.AddAllArgs(CmdArgs, options::OPT_L);
256  Args.AddAllArgs(CmdArgs, options::OPT_T_Group);
257  Args.AddAllArgs(CmdArgs, options::OPT_e);
258  Args.AddAllArgs(CmdArgs, options::OPT_s);
259  Args.AddAllArgs(CmdArgs, options::OPT_t);
260  Args.AddAllArgs(CmdArgs, options::OPT_Z_Flag);
261  Args.AddAllArgs(CmdArgs, options::OPT_r);
262 
263  bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
264  bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
265  AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
266 
267  const SanitizerArgs &SanArgs = ToolChain.getSanitizerArgs(Args);
268  if (SanArgs.needsSharedRt()) {
269  CmdArgs.push_back("-rpath");
270  CmdArgs.push_back(Args.MakeArgString(ToolChain.getCompilerRTPath()));
271  }
272 
273  VersionTuple OsVersion = Triple.getOSVersion();
274  bool useLibgcc = true;
275  if (OsVersion >= VersionTuple(7) || OsVersion.getMajor() == 0) {
276  switch (ToolChain.getArch()) {
277  case llvm::Triple::aarch64:
278  case llvm::Triple::aarch64_be:
279  case llvm::Triple::arm:
280  case llvm::Triple::armeb:
281  case llvm::Triple::thumb:
282  case llvm::Triple::thumbeb:
283  case llvm::Triple::ppc:
284  case llvm::Triple::ppc64:
285  case llvm::Triple::ppc64le:
286  case llvm::Triple::sparc:
287  case llvm::Triple::sparcv9:
288  case llvm::Triple::x86:
289  case llvm::Triple::x86_64:
290  useLibgcc = false;
291  break;
292  default:
293  break;
294  }
295  }
296 
297  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
298  // Use the static OpenMP runtime with -static-openmp
299  bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
300  !Args.hasArg(options::OPT_static);
301  addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP);
302 
303  if (D.CCCIsCXX()) {
304  if (ToolChain.ShouldLinkCXXStdlib(Args))
305  ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
306  CmdArgs.push_back("-lm");
307  }
308  if (NeedsSanitizerDeps)
310  if (NeedsXRayDeps)
311  linkXRayRuntimeDeps(ToolChain, CmdArgs);
312  if (Args.hasArg(options::OPT_pthread))
313  CmdArgs.push_back("-lpthread");
314  CmdArgs.push_back("-lc");
315 
316  if (useLibgcc) {
317  if (Args.hasArg(options::OPT_static)) {
318  // libgcc_eh depends on libc, so resolve as much as possible,
319  // pull in any new requirements from libc and then get the rest
320  // of libgcc.
321  CmdArgs.push_back("-lgcc_eh");
322  CmdArgs.push_back("-lc");
323  CmdArgs.push_back("-lgcc");
324  } else {
325  CmdArgs.push_back("-lgcc");
326  CmdArgs.push_back("--as-needed");
327  CmdArgs.push_back("-lgcc_s");
328  CmdArgs.push_back("--no-as-needed");
329  }
330  }
331  }
332 
333  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
334  if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie))
335  CmdArgs.push_back(
336  Args.MakeArgString(ToolChain.GetFilePath("crtendS.o")));
337  else
338  CmdArgs.push_back(
339  Args.MakeArgString(ToolChain.GetFilePath("crtend.o")));
340  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o")));
341  }
342 
343  ToolChain.addProfileRTLibs(Args, CmdArgs);
344 
345  const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
346  C.addCommand(std::make_unique<Command>(JA, *this,
348  Exec, CmdArgs, Inputs, Output));
349 }
350 
351 /// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
352 
353 NetBSD::NetBSD(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
354  : Generic_ELF(D, Triple, Args) {
355  if (!Args.hasArg(options::OPT_nostdlib)) {
356  // When targeting a 32-bit platform, try the special directory used on
357  // 64-bit hosts, and only fall back to the main library directory if that
358  // doesn't work.
359  // FIXME: It'd be nicer to test if this directory exists, but I'm not sure
360  // what all logic is needed to emulate the '=' prefix here.
361  switch (Triple.getArch()) {
362  case llvm::Triple::x86:
363  getFilePaths().push_back("=/usr/lib/i386");
364  break;
365  case llvm::Triple::arm:
366  case llvm::Triple::armeb:
367  case llvm::Triple::thumb:
368  case llvm::Triple::thumbeb:
369  switch (Triple.getEnvironment()) {
370  case llvm::Triple::EABI:
371  case llvm::Triple::GNUEABI:
372  getFilePaths().push_back("=/usr/lib/eabi");
373  break;
374  case llvm::Triple::EABIHF:
375  case llvm::Triple::GNUEABIHF:
376  getFilePaths().push_back("=/usr/lib/eabihf");
377  break;
378  default:
379  getFilePaths().push_back("=/usr/lib/oabi");
380  break;
381  }
382  break;
383  case llvm::Triple::mips64:
384  case llvm::Triple::mips64el:
385  if (tools::mips::hasMipsAbiArg(Args, "o32"))
386  getFilePaths().push_back("=/usr/lib/o32");
387  else if (tools::mips::hasMipsAbiArg(Args, "64"))
388  getFilePaths().push_back("=/usr/lib/64");
389  break;
390  case llvm::Triple::ppc:
391  getFilePaths().push_back("=/usr/lib/powerpc");
392  break;
393  case llvm::Triple::sparc:
394  getFilePaths().push_back("=/usr/lib/sparc");
395  break;
396  default:
397  break;
398  }
399 
400  getFilePaths().push_back("=/usr/lib");
401  }
402 }
403 
405  return new tools::netbsd::Assembler(*this);
406 }
407 
408 Tool *NetBSD::buildLinker() const { return new tools::netbsd::Linker(*this); }
409 
411  VersionTuple OsVersion = getTriple().getOSVersion();
412  if (OsVersion >= VersionTuple(7) || OsVersion.getMajor() == 0) {
413  switch (getArch()) {
414  case llvm::Triple::aarch64:
415  case llvm::Triple::aarch64_be:
416  case llvm::Triple::arm:
417  case llvm::Triple::armeb:
418  case llvm::Triple::thumb:
419  case llvm::Triple::thumbeb:
420  case llvm::Triple::ppc:
421  case llvm::Triple::ppc64:
422  case llvm::Triple::ppc64le:
423  case llvm::Triple::sparc:
424  case llvm::Triple::sparcv9:
425  case llvm::Triple::x86:
426  case llvm::Triple::x86_64:
427  return ToolChain::CST_Libcxx;
428  default:
429  break;
430  }
431  }
433 }
434 
435 void NetBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
436  llvm::opt::ArgStringList &CC1Args) const {
437  const std::string Candidates[] = {
438  // directory relative to build tree
439  getDriver().Dir + "/../include/c++/v1",
440  // system install with full upstream path
441  getDriver().SysRoot + "/usr/include/c++/v1",
442  // system install from src
443  getDriver().SysRoot + "/usr/include/c++",
444  };
445 
446  for (const auto &IncludePath : Candidates) {
447  if (!getVFS().exists(IncludePath + "/__config"))
448  continue;
449 
450  // Use the first candidate that looks valid.
451  addSystemInclude(DriverArgs, CC1Args, IncludePath);
452  return;
453  }
454 }
455 
456 void NetBSD::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
457  llvm::opt::ArgStringList &CC1Args) const {
458  addLibStdCXXIncludePaths(getDriver().SysRoot + "/usr/include/g++", "", "",
459  DriverArgs, CC1Args);
460 }
461 
462 llvm::ExceptionHandling NetBSD::GetExceptionModel(const ArgList &Args) const {
463  // NetBSD uses Dwarf exceptions on ARM.
464  llvm::Triple::ArchType TArch = getTriple().getArch();
465  if (TArch == llvm::Triple::arm || TArch == llvm::Triple::armeb ||
466  TArch == llvm::Triple::thumb || TArch == llvm::Triple::thumbeb)
467  return llvm::ExceptionHandling::DwarfCFI;
469 }
470 
472  const bool IsX86 = getTriple().getArch() == llvm::Triple::x86;
473  const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64;
475  if (IsX86 || IsX86_64) {
476  Res |= SanitizerKind::Address;
477  Res |= SanitizerKind::PointerCompare;
478  Res |= SanitizerKind::PointerSubtract;
479  Res |= SanitizerKind::Function;
480  Res |= SanitizerKind::Leak;
481  Res |= SanitizerKind::SafeStack;
482  Res |= SanitizerKind::Scudo;
483  Res |= SanitizerKind::Vptr;
484  }
485  if (IsX86_64) {
486  Res |= SanitizerKind::DataFlow;
487  Res |= SanitizerKind::Fuzzer;
488  Res |= SanitizerKind::FuzzerNoLink;
489  Res |= SanitizerKind::HWAddress;
490  Res |= SanitizerKind::KernelAddress;
491  Res |= SanitizerKind::KernelHWAddress;
492  Res |= SanitizerKind::KernelMemory;
493  Res |= SanitizerKind::Memory;
494  Res |= SanitizerKind::Thread;
495  }
496  return Res;
497 }
498 
499 void NetBSD::addClangTargetOptions(const ArgList &DriverArgs,
500  ArgStringList &CC1Args,
501  Action::OffloadKind) const {
502  const SanitizerArgs &SanArgs = getSanitizerArgs(DriverArgs);
503  if (SanArgs.hasAnySanitizer())
504  CC1Args.push_back("-D_REENTRANT");
505 
506  VersionTuple OsVersion = getTriple().getOSVersion();
507  bool UseInitArrayDefault =
508  OsVersion >= VersionTuple(9) || OsVersion.getMajor() == 0 ||
509  getTriple().getArch() == llvm::Triple::aarch64 ||
510  getTriple().getArch() == llvm::Triple::aarch64_be ||
511  getTriple().getArch() == llvm::Triple::arm ||
512  getTriple().getArch() == llvm::Triple::armeb;
513 
514  if (!DriverArgs.hasFlag(options::OPT_fuse_init_array,
515  options::OPT_fno_use_init_array, UseInitArrayDefault))
516  CC1Args.push_back("-fno-use-init-array");
517 }
clang::driver::tools::mips::getGnuCompatibleMipsABIName
StringRef getGnuCompatibleMipsABIName(StringRef ABI)
Definition: Mips.cpp:143
clang::driver::toolchains
Definition: AIX.h:55
clang::driver::toolchains::NetBSD::addLibStdCxxIncludePaths
void addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: NetBSD.cpp:456
Mips.h
clang::driver::tools::AddAssemblerKPIC
void AddAssemblerKPIC(const ToolChain &ToolChain, const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs)
clang::driver::ToolChain::getEffectiveTriple
const llvm::Triple & getEffectiveTriple() const
Get the toolchain's effective clang triple.
Definition: ToolChain.h:251
clang::driver::tools::netbsd::Linker
Definition: NetBSD.h:34
clang::driver::ToolChain::getVFS
llvm::vfs::FileSystem & getVFS() const
Definition: ToolChain.cpp:98
clang::driver::toolchains::NetBSD
Definition: NetBSD.h:51
clang::driver::tools::netbsd::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: NetBSD.cpp:115
Driver.h
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::driver::Driver::Dir
std::string Dir
The path the driver executable was in, as invoked from the command line.
Definition: Driver.h:123
clang::driver::toolchains::NetBSD::GetDefaultCXXStdlibType
CXXStdlibType GetDefaultCXXStdlibType() const override
Definition: NetBSD.cpp:410
llvm::SmallVector
Definition: LLVM.h:38
clang::driver::toolchains::NetBSD::addLibCxxIncludePaths
void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override
Definition: NetBSD.cpp:435
clang::driver::ToolChain::GetProgramPath
std::string GetProgramPath(const char *Name) const
Definition: ToolChain.cpp:558
clang::driver::tools
Definition: AIX.h:17
clang::driver::tools::mips::hasMipsAbiArg
bool hasMipsAbiArg(const llvm::opt::ArgList &Args, const char *Value)
clang::driver::ToolChain::getDriver
const Driver & getDriver() const
Definition: ToolChain.h:221
clang::driver::toolchains::NetBSD::buildAssembler
Tool * buildAssembler() const override
Definition: NetBSD.cpp:404
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::ToolChain::getCompilerRTPath
virtual std::string getCompilerRTPath() const
Definition: ToolChain.cpp:409
clang::driver::ToolChain::GetFilePath
std::string GetFilePath(const char *Name) const
Definition: ToolChain.cpp:554
clang::driver::ToolChain::getSanitizerArgs
SanitizerArgs getSanitizerArgs(const llvm::opt::ArgList &JobArgs) const
Definition: ToolChain.cpp:113
clang::driver::InputInfo
InputInfo - Wrapper for information about an input source.
Definition: InputInfo.h:22
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::ToolChain::getFilePaths
path_list & getFilePaths()
Definition: ToolChain.h:259
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::driver::tools::netbsd::Assembler
Definition: NetBSD.h:22
clang::XRayInstrKind::None
constexpr XRayInstrMask None
Definition: XRayInstr.h:38
clang::driver::SanitizerArgs::hasAnySanitizer
bool hasAnySanitizer() const
Definition: SanitizerArgs.h:106
clang::driver::toolchains::NetBSD::GetExceptionModel
llvm::ExceptionHandling GetExceptionModel(const llvm::opt::ArgList &Args) const override
GetExceptionModel - Return the tool chain exception model.
Definition: NetBSD.cpp:462
llvm::opt
Definition: DiagnosticOptions.h:19
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::ToolChain::CXXStdlibType
CXXStdlibType
Definition: ToolChain.h:95
clang::driver::toolchains::NetBSD::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: NetBSD.cpp:499
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)
NetBSD.h
clang::driver::SanitizerArgs
Definition: SanitizerArgs.h:24
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:237
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:942
clang::driver::ToolChain::getSupportedSanitizers
virtual SanitizerMask getSupportedSanitizers() const
Return sanitizers which are available in this toolchain.
Definition: ToolChain.cpp:1008
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:948
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:759
clang::driver::ToolChain
ToolChain - Access to tools for a single platform.
Definition: ToolChain.h:91
clang::driver::ToolChain::GetLinkerPath
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:562
clang::driver::tools::arm::getARMTargetCPU
std::string getARMTargetCPU(StringRef CPU, llvm::StringRef Arch, const llvm::Triple &Triple)
clang::driver::toolchains::NetBSD::getSupportedSanitizers
SanitizerMask getSupportedSanitizers() const override
Return sanitizers which are available in this toolchain.
Definition: NetBSD.cpp:471
clang::driver::toolchains::NetBSD::buildLinker
Tool * buildLinker() const override
Definition: NetBSD.cpp:408
clang::driver::Compilation
Compilation - A set of tasks to perform for a single driver invocation.
Definition: Compilation.h:45
clang::driver::tools::arm::getARMArchCPUFromArgs
void getARMArchCPUFromArgs(const llvm::opt::ArgList &Args, llvm::StringRef &Arch, llvm::StringRef &CPU, bool FromAs=false)
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:2927
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)
ARM.h
clang::driver::Action::OffloadKind
OffloadKind
Definition: Action.h:85
clang::driver
Definition: Action.h:31
clang::driver::tools::arm::appendBE8LinkFlag
void appendBE8LinkFlag(const llvm::opt::ArgList &Args, llvm::opt::ArgStringList &CmdArgs, const llvm::Triple &Triple)
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:855
clang::driver::SanitizerArgs::needsSharedRt
bool needsSharedRt() const
Definition: SanitizerArgs.h:72
clang::driver::JobAction
Definition: Action.h:380
clang::driver::tools::sparc::getSparcAsmModeForCPU
const char * getSparcAsmModeForCPU(llvm::StringRef Name, const llvm::Triple &Triple)
clang::SanitizerMask
Definition: Sanitizers.h:30
clang::driver::tools::netbsd::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: NetBSD.cpp:27