1 //===--- ZOS.h - z/OS 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 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ZOS_H 10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ZOS_H 11 12 #include "clang/Driver/Tool.h" 13 #include "clang/Driver/ToolChain.h" 14 15 namespace clang { 16 namespace driver { 17 namespace tools { 18 19 /// zos -- Directly call system default assembler and linker. 20 namespace zos { 21 22 class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { 23 public: 24 Assembler(const ToolChain &TC) : Tool("zos::Assembler", "assembler", TC) {} 25 26 bool hasIntegratedCPP() const override { return false; } 27 28 void ConstructJob(Compilation &C, const JobAction &JA, 29 const InputInfo &Output, const InputInfoList &Inputs, 30 const llvm::opt::ArgList &TCArgs, 31 const char *LinkingOutput) const override; 32 }; 33 34 class LLVM_LIBRARY_VISIBILITY Linker : public Tool { 35 public: 36 Linker(const ToolChain &TC) : Tool("zos::Linker", "linker", TC) {} 37 38 bool hasIntegratedCPP() const override { return false; } 39 bool isLinkJob() const override { return true; } 40 41 void ConstructJob(Compilation &C, const JobAction &JA, 42 const InputInfo &Output, const InputInfoList &Inputs, 43 const llvm::opt::ArgList &TCArgs, 44 const char *LinkingOutput) const override; 45 }; 46 47 } // end namespace zos 48 } // end namespace tools 49 50 namespace toolchains { 51 52 class LLVM_LIBRARY_VISIBILITY ZOS : public ToolChain { 53 public: 54 ZOS(const Driver &D, const llvm::Triple &Triple, 55 const llvm::opt::ArgList &Args); 56 ~ZOS() override; 57 58 bool isPICDefault() const override { return false; } 59 bool isPIEDefault(const llvm::opt::ArgList &Args) const override { 60 return false; 61 } 62 bool isPICDefaultForced() const override { return false; } 63 64 void TryAddIncludeFromPath(llvm::SmallString<128> Path, 65 const llvm::opt::ArgList &DriverArgs, 66 llvm::opt::ArgStringList &CC1Args) const; 67 void 68 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 69 llvm::opt::ArgStringList &CC1Args) const override; 70 71 void AddClangCXXStdlibIncludeArgs( 72 const llvm::opt::ArgList &DriverArgs, 73 llvm::opt::ArgStringList &CC1Args) const override; 74 75 unsigned GetDefaultDwarfVersion() const override { return 4; } 76 CXXStdlibType GetDefaultCXXStdlibType() const override; 77 78 void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, 79 llvm::opt::ArgStringList &CmdArgs) const override; 80 81 RuntimeLibType GetDefaultRuntimeLibType() const override; 82 83 void addClangTargetOptions( 84 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, 85 Action::OffloadKind DeviceOffloadingKind) const override; 86 87 const char *getDefaultLinker() const override { return "/bin/ld"; } 88 89 protected: 90 Tool *buildAssembler() const override; 91 Tool *buildLinker() const override; 92 }; 93 94 } // end namespace toolchains 95 } // end namespace driver 96 } // end namespace clang 97 98 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ZOS_H 99