xref: /freebsd/contrib/llvm-project/clang/lib/Driver/ToolChains/NetBSD.h (revision 5f757f3ff9144b609b3c433dfd370cc6bdc191ad)
10b57cec5SDimitry Andric //===--- NetBSD.h - NetBSD 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_NETBSD_H
100b57cec5SDimitry Andric #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NETBSD_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "Gnu.h"
130b57cec5SDimitry Andric #include "clang/Driver/Tool.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 netbsd {
22*5f757f3fSDimitry Andric class LLVM_LIBRARY_VISIBILITY Assembler final : public Tool {
230b57cec5SDimitry Andric public:
245ffd83dbSDimitry Andric   Assembler(const ToolChain &TC) : Tool("netbsd::Assembler", "assembler", TC) {}
250b57cec5SDimitry Andric 
260b57cec5SDimitry Andric   bool hasIntegratedCPP() const override { return false; }
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric   void ConstructJob(Compilation &C, const JobAction &JA,
290b57cec5SDimitry Andric                     const InputInfo &Output, const InputInfoList &Inputs,
300b57cec5SDimitry Andric                     const llvm::opt::ArgList &TCArgs,
310b57cec5SDimitry Andric                     const char *LinkingOutput) const override;
320b57cec5SDimitry Andric };
330b57cec5SDimitry Andric 
34*5f757f3fSDimitry Andric class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
350b57cec5SDimitry Andric public:
365ffd83dbSDimitry Andric   Linker(const ToolChain &TC) : Tool("netbsd::Linker", "linker", TC) {}
370b57cec5SDimitry Andric 
380b57cec5SDimitry Andric   bool hasIntegratedCPP() const override { return false; }
390b57cec5SDimitry Andric   bool isLinkJob() const override { return true; }
400b57cec5SDimitry Andric 
410b57cec5SDimitry Andric   void ConstructJob(Compilation &C, const JobAction &JA,
420b57cec5SDimitry Andric                     const InputInfo &Output, const InputInfoList &Inputs,
430b57cec5SDimitry Andric                     const llvm::opt::ArgList &TCArgs,
440b57cec5SDimitry Andric                     const char *LinkingOutput) const override;
450b57cec5SDimitry Andric };
460b57cec5SDimitry Andric } // end namespace netbsd
470b57cec5SDimitry Andric } // end namespace tools
480b57cec5SDimitry Andric 
490b57cec5SDimitry Andric namespace toolchains {
500b57cec5SDimitry Andric 
510b57cec5SDimitry Andric class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
520b57cec5SDimitry Andric public:
530b57cec5SDimitry Andric   NetBSD(const Driver &D, const llvm::Triple &Triple,
540b57cec5SDimitry Andric          const llvm::opt::ArgList &Args);
550b57cec5SDimitry Andric 
560b57cec5SDimitry Andric   bool IsMathErrnoDefault() const override { return false; }
570b57cec5SDimitry Andric   bool IsObjCNonFragileABIDefault() const override { return true; }
580b57cec5SDimitry Andric 
590b57cec5SDimitry Andric   CXXStdlibType GetDefaultCXXStdlibType() const override;
600b57cec5SDimitry Andric 
61bdd1243dSDimitry Andric   void
62bdd1243dSDimitry Andric   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
63bdd1243dSDimitry Andric                             llvm::opt::ArgStringList &CC1Args) const override;
640b57cec5SDimitry Andric   void addLibCxxIncludePaths(
650b57cec5SDimitry Andric       const llvm::opt::ArgList &DriverArgs,
660b57cec5SDimitry Andric       llvm::opt::ArgStringList &CC1Args) const override;
670b57cec5SDimitry Andric   void addLibStdCxxIncludePaths(
680b57cec5SDimitry Andric       const llvm::opt::ArgList &DriverArgs,
690b57cec5SDimitry Andric       llvm::opt::ArgStringList &CC1Args) const override;
700b57cec5SDimitry Andric 
71bdd1243dSDimitry Andric   UnwindTableLevel
72bdd1243dSDimitry Andric   getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override {
73bdd1243dSDimitry Andric     return UnwindTableLevel::Asynchronous;
740b57cec5SDimitry Andric   }
750b57cec5SDimitry Andric 
760b57cec5SDimitry Andric   llvm::ExceptionHandling GetExceptionModel(
770b57cec5SDimitry Andric       const llvm::opt::ArgList &Args) const override;
780b57cec5SDimitry Andric 
790b57cec5SDimitry Andric   SanitizerMask getSupportedSanitizers() const override;
800b57cec5SDimitry Andric 
810b57cec5SDimitry Andric   void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
820b57cec5SDimitry Andric                              llvm::opt::ArgStringList &CC1Args,
830b57cec5SDimitry Andric                              Action::OffloadKind DeviceOffloadKind) const override;
840b57cec5SDimitry Andric 
850b57cec5SDimitry Andric protected:
860b57cec5SDimitry Andric   Tool *buildAssembler() const override;
870b57cec5SDimitry Andric   Tool *buildLinker() const override;
880b57cec5SDimitry Andric };
890b57cec5SDimitry Andric 
900b57cec5SDimitry Andric } // end namespace toolchains
910b57cec5SDimitry Andric } // end namespace driver
920b57cec5SDimitry Andric } // end namespace clang
930b57cec5SDimitry Andric 
940b57cec5SDimitry Andric #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NETBSD_H
95