1 //===--- MSP430.h - MSP430-specific Tool Helpers ----------------*- 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_MSP430_H 10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H 11 12 #include "Gnu.h" 13 #include "InputInfo.h" 14 #include "clang/Driver/Driver.h" 15 #include "clang/Driver/DriverDiagnostic.h" 16 #include "clang/Driver/Tool.h" 17 #include "clang/Driver/ToolChain.h" 18 #include "llvm/ADT/StringRef.h" 19 #include "llvm/Option/Option.h" 20 21 #include <string> 22 #include <vector> 23 24 namespace clang { 25 namespace driver { 26 namespace toolchains { 27 28 class LLVM_LIBRARY_VISIBILITY MSP430ToolChain : public Generic_ELF { 29 public: 30 MSP430ToolChain(const Driver &D, const llvm::Triple &Triple, 31 const llvm::opt::ArgList &Args); 32 void 33 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 34 llvm::opt::ArgStringList &CC1Args) const override; 35 void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, 36 llvm::opt::ArgStringList &CC1Args, 37 Action::OffloadKind) const override; 38 39 bool isPICDefault() const override { return false; } 40 bool isPIEDefault() const override { return false; } 41 bool isPICDefaultForced() const override { return true; } 42 43 UnwindLibType 44 GetUnwindLibType(const llvm::opt::ArgList &Args) const override { 45 return UNW_None; 46 } 47 48 protected: 49 Tool *buildLinker() const override; 50 51 private: 52 std::string computeSysRoot() const override; 53 }; 54 55 } // end namespace toolchains 56 57 namespace tools { 58 namespace msp430 { 59 60 class LLVM_LIBRARY_VISIBILITY Linker : public Tool { 61 public: 62 Linker(const ToolChain &TC) : Tool("MSP430::Linker", "msp430-elf-ld", TC) {} 63 bool hasIntegratedCPP() const override { return false; } 64 bool isLinkJob() const override { return true; } 65 void ConstructJob(Compilation &C, const JobAction &JA, 66 const InputInfo &Output, const InputInfoList &Inputs, 67 const llvm::opt::ArgList &TCArgs, 68 const char *LinkingOutput) const override; 69 70 private: 71 void AddStartFiles(bool UseExceptions, const llvm::opt::ArgList &Args, 72 llvm::opt::ArgStringList &CmdArgs) const; 73 void AddDefaultLibs(const llvm::opt::ArgList &Args, 74 llvm::opt::ArgStringList &CmdArgs) const; 75 void AddEndFiles(bool UseExceptions, const llvm::opt::ArgList &Args, 76 llvm::opt::ArgStringList &CmdArgs) const; 77 }; 78 79 void getMSP430TargetFeatures(const Driver &D, const llvm::opt::ArgList &Args, 80 std::vector<llvm::StringRef> &Features); 81 } // end namespace msp430 82 } // end namespace tools 83 } // end namespace driver 84 } // end namespace clang 85 86 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H 87