xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/FreeBSD.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric //===--- FreeBSD.h - FreeBSD ToolChain Implementations ----------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FREEBSD_H
100b57cec5SDimitry Andric #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FREEBSD_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "Gnu.h"
130b57cec5SDimitry Andric #include "clang/Driver/Driver.h"
140b57cec5SDimitry Andric #include "clang/Driver/ToolChain.h"
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric namespace clang {
170b57cec5SDimitry Andric namespace driver {
180b57cec5SDimitry Andric namespace tools {
190b57cec5SDimitry Andric 
20*5f757f3fSDimitry Andric /// Directly call GNU Binutils assembler and linker
210b57cec5SDimitry Andric namespace freebsd {
22*5f757f3fSDimitry Andric class LLVM_LIBRARY_VISIBILITY Assembler final : public Tool {
230b57cec5SDimitry Andric public:
240b57cec5SDimitry Andric   Assembler(const ToolChain &TC)
255ffd83dbSDimitry Andric       : Tool("freebsd::Assembler", "assembler", TC) {}
260b57cec5SDimitry Andric 
270b57cec5SDimitry Andric   bool hasIntegratedCPP() const override { return false; }
280b57cec5SDimitry Andric 
290b57cec5SDimitry Andric   void ConstructJob(Compilation &C, const JobAction &JA,
300b57cec5SDimitry Andric                     const InputInfo &Output, const InputInfoList &Inputs,
310b57cec5SDimitry Andric                     const llvm::opt::ArgList &TCArgs,
320b57cec5SDimitry Andric                     const char *LinkingOutput) const override;
330b57cec5SDimitry Andric };
340b57cec5SDimitry Andric 
35*5f757f3fSDimitry Andric class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
360b57cec5SDimitry Andric public:
375ffd83dbSDimitry Andric   Linker(const ToolChain &TC) : Tool("freebsd::Linker", "linker", TC) {}
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric   bool hasIntegratedCPP() const override { return false; }
400b57cec5SDimitry Andric   bool isLinkJob() const override { return true; }
410b57cec5SDimitry Andric 
420b57cec5SDimitry Andric   void ConstructJob(Compilation &C, const JobAction &JA,
430b57cec5SDimitry Andric                     const InputInfo &Output, const InputInfoList &Inputs,
440b57cec5SDimitry Andric                     const llvm::opt::ArgList &TCArgs,
450b57cec5SDimitry Andric                     const char *LinkingOutput) const override;
460b57cec5SDimitry Andric };
470b57cec5SDimitry Andric } // end namespace freebsd
480b57cec5SDimitry Andric } // end namespace tools
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric namespace toolchains {
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric class LLVM_LIBRARY_VISIBILITY FreeBSD : public Generic_ELF {
530b57cec5SDimitry Andric public:
540b57cec5SDimitry Andric   FreeBSD(const Driver &D, const llvm::Triple &Triple,
550b57cec5SDimitry Andric           const llvm::opt::ArgList &Args);
560b57cec5SDimitry Andric   bool HasNativeLLVMSupport() const override;
570b57cec5SDimitry Andric 
580b57cec5SDimitry Andric   bool IsMathErrnoDefault() const override { return false; }
590b57cec5SDimitry Andric   bool IsObjCNonFragileABIDefault() const override { return true; }
600b57cec5SDimitry Andric 
61bdd1243dSDimitry Andric   void
62bdd1243dSDimitry Andric   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
63bdd1243dSDimitry Andric                             llvm::opt::ArgStringList &CC1Args) const override;
641ac55f4cSDimitry Andric 
651ac55f4cSDimitry Andric   RuntimeLibType GetDefaultRuntimeLibType() const override {
661ac55f4cSDimitry Andric     return ToolChain::RLT_CompilerRT;
671ac55f4cSDimitry Andric   }
681ac55f4cSDimitry Andric   CXXStdlibType GetDefaultCXXStdlibType() const override {
691ac55f4cSDimitry Andric     return ToolChain::CST_Libcxx;
701ac55f4cSDimitry Andric   }
711ac55f4cSDimitry Andric 
7246bc58a0SDimitry Andric   void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
7346bc58a0SDimitry Andric                              llvm::opt::ArgStringList &CC1Args) const override;
740b57cec5SDimitry Andric   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
750b57cec5SDimitry Andric                            llvm::opt::ArgStringList &CmdArgs) const override;
76480093f4SDimitry Andric   void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
77480093f4SDimitry Andric                           llvm::opt::ArgStringList &CC1Args) const override;
785ffd83dbSDimitry Andric   void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs,
795ffd83dbSDimitry Andric                          llvm::opt::ArgStringList &CC1Args) const override;
800b57cec5SDimitry Andric 
81bdd1243dSDimitry Andric   UnwindTableLevel
82bdd1243dSDimitry Andric   getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override;
83349cc55cSDimitry Andric   bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
840b57cec5SDimitry Andric   SanitizerMask getSupportedSanitizers() const override;
85*5f757f3fSDimitry Andric   unsigned GetDefaultDwarfVersion() const override { return 4; }
860b57cec5SDimitry Andric   // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
870b57cec5SDimitry Andric   // FreeBSD defaults to standalone/full debug info.
880b57cec5SDimitry Andric   bool GetDefaultStandaloneDebug() const override { return true; }
890b57cec5SDimitry Andric 
900b57cec5SDimitry Andric protected:
910b57cec5SDimitry Andric   Tool *buildAssembler() const override;
920b57cec5SDimitry Andric   Tool *buildLinker() const override;
930b57cec5SDimitry Andric };
940b57cec5SDimitry Andric 
950b57cec5SDimitry Andric } // end namespace toolchains
960b57cec5SDimitry Andric } // end namespace driver
970b57cec5SDimitry Andric } // end namespace clang
980b57cec5SDimitry Andric 
990b57cec5SDimitry Andric #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FREEBSD_H
100