10b57cec5SDimitry Andric //===--- OpenBSD.h - OpenBSD 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_OPENBSD_H 100b57cec5SDimitry Andric #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #include "Gnu.h" 13e8d8bef9SDimitry Andric #include "clang/Basic/LangOptions.h" 140b57cec5SDimitry Andric #include "clang/Driver/Tool.h" 150b57cec5SDimitry Andric #include "clang/Driver/ToolChain.h" 160b57cec5SDimitry Andric 170b57cec5SDimitry Andric namespace clang { 180b57cec5SDimitry Andric namespace driver { 190b57cec5SDimitry Andric namespace tools { 200b57cec5SDimitry Andric 21*5f757f3fSDimitry Andric /// Directly call GNU Binutils assembler and linker 220b57cec5SDimitry Andric namespace openbsd { 23*5f757f3fSDimitry Andric class LLVM_LIBRARY_VISIBILITY Assembler final : public Tool { 240b57cec5SDimitry Andric public: 250b57cec5SDimitry Andric Assembler(const ToolChain &TC) 265ffd83dbSDimitry Andric : Tool("openbsd::Assembler", "assembler", TC) {} 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric bool hasIntegratedCPP() const override { return false; } 290b57cec5SDimitry Andric 300b57cec5SDimitry Andric void ConstructJob(Compilation &C, const JobAction &JA, 310b57cec5SDimitry Andric const InputInfo &Output, const InputInfoList &Inputs, 320b57cec5SDimitry Andric const llvm::opt::ArgList &TCArgs, 330b57cec5SDimitry Andric const char *LinkingOutput) const override; 340b57cec5SDimitry Andric }; 350b57cec5SDimitry Andric 36*5f757f3fSDimitry Andric class LLVM_LIBRARY_VISIBILITY Linker final : public Tool { 370b57cec5SDimitry Andric public: 385ffd83dbSDimitry Andric Linker(const ToolChain &TC) : Tool("openbsd::Linker", "linker", TC) {} 390b57cec5SDimitry Andric 400b57cec5SDimitry Andric bool hasIntegratedCPP() const override { return false; } 410b57cec5SDimitry Andric bool isLinkJob() const override { return true; } 420b57cec5SDimitry Andric 430b57cec5SDimitry Andric void ConstructJob(Compilation &C, const JobAction &JA, 440b57cec5SDimitry Andric const InputInfo &Output, const InputInfoList &Inputs, 450b57cec5SDimitry Andric const llvm::opt::ArgList &TCArgs, 460b57cec5SDimitry Andric const char *LinkingOutput) const override; 470b57cec5SDimitry Andric }; 480b57cec5SDimitry Andric } // end namespace openbsd 490b57cec5SDimitry Andric } // end namespace tools 500b57cec5SDimitry Andric 510b57cec5SDimitry Andric namespace toolchains { 520b57cec5SDimitry Andric 530b57cec5SDimitry Andric class LLVM_LIBRARY_VISIBILITY OpenBSD : public Generic_ELF { 540b57cec5SDimitry Andric public: 550b57cec5SDimitry Andric OpenBSD(const Driver &D, const llvm::Triple &Triple, 560b57cec5SDimitry Andric const llvm::opt::ArgList &Args); 570b57cec5SDimitry Andric 5816d6b3b3SDimitry Andric bool HasNativeLLVMSupport() const override; 5916d6b3b3SDimitry Andric 600b57cec5SDimitry Andric bool IsMathErrnoDefault() const override { return false; } 610b57cec5SDimitry Andric bool IsObjCNonFragileABIDefault() const override { return true; } 62349cc55cSDimitry Andric bool isPIEDefault(const llvm::opt::ArgList &Args) const override { 63349cc55cSDimitry Andric return true; 64349cc55cSDimitry Andric } 650b57cec5SDimitry Andric 660b57cec5SDimitry Andric RuntimeLibType GetDefaultRuntimeLibType() const override { 670b57cec5SDimitry Andric return ToolChain::RLT_CompilerRT; 680b57cec5SDimitry Andric } 690b57cec5SDimitry Andric CXXStdlibType GetDefaultCXXStdlibType() const override { 700b57cec5SDimitry Andric return ToolChain::CST_Libcxx; 710b57cec5SDimitry Andric } 720b57cec5SDimitry Andric 7316d6b3b3SDimitry Andric void 7416d6b3b3SDimitry Andric AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 7516d6b3b3SDimitry Andric llvm::opt::ArgStringList &CC1Args) const override; 7616d6b3b3SDimitry Andric 7716d6b3b3SDimitry Andric void addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, 7816d6b3b3SDimitry Andric llvm::opt::ArgStringList &CC1Args) const override; 790b57cec5SDimitry Andric void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, 800b57cec5SDimitry Andric llvm::opt::ArgStringList &CmdArgs) const override; 810b57cec5SDimitry Andric 8216d6b3b3SDimitry Andric std::string getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component, 8316d6b3b3SDimitry Andric FileType Type = ToolChain::FT_Static) const override; 8416d6b3b3SDimitry Andric 85bdd1243dSDimitry Andric UnwindTableLevel 86bdd1243dSDimitry Andric getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override; 87d781ede6SDimitry Andric 88e8d8bef9SDimitry Andric LangOptions::StackProtectorMode 89e8d8bef9SDimitry Andric GetDefaultStackProtectorLevel(bool KernelOrKext) const override { 90e8d8bef9SDimitry Andric return LangOptions::SSPStrong; 910b57cec5SDimitry Andric } 920b57cec5SDimitry Andric unsigned GetDefaultDwarfVersion() const override { return 2; } 930b57cec5SDimitry Andric 940b57cec5SDimitry Andric SanitizerMask getSupportedSanitizers() const override; 950b57cec5SDimitry Andric 960b57cec5SDimitry Andric protected: 970b57cec5SDimitry Andric Tool *buildAssembler() const override; 980b57cec5SDimitry Andric Tool *buildLinker() const override; 990b57cec5SDimitry Andric }; 1000b57cec5SDimitry Andric 1010b57cec5SDimitry Andric } // end namespace toolchains 1020b57cec5SDimitry Andric } // end namespace driver 1030b57cec5SDimitry Andric } // end namespace clang 1040b57cec5SDimitry Andric 1050b57cec5SDimitry Andric #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OPENBSD_H 106