1 //===--- MSP430.h - MSP430-specific Tool Helpers ----------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H
13 #include "clang/Driver/Driver.h"
14 #include "clang/Driver/DriverDiagnostic.h"
15 #include "clang/Driver/InputInfo.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"
26 namespace toolchains
{
28 class LLVM_LIBRARY_VISIBILITY MSP430ToolChain
: public Generic_ELF
{
30 MSP430ToolChain(const Driver
&D
, const llvm::Triple
&Triple
,
31 const llvm::opt::ArgList
&Args
);
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
;
39 bool isPICDefault() const override
{ return false; }
40 bool isPIEDefault(const llvm::opt::ArgList
&Args
) const override
{
43 bool isPICDefaultForced() const override
{ return true; }
46 GetUnwindLibType(const llvm::opt::ArgList
&Args
) const override
{
51 Tool
*buildLinker() const override
;
54 std::string
computeSysRoot() const override
;
57 } // end namespace toolchains
62 class LLVM_LIBRARY_VISIBILITY Linker final
: public Tool
{
64 Linker(const ToolChain
&TC
) : Tool("MSP430::Linker", "msp430-elf-ld", TC
) {}
65 bool hasIntegratedCPP() const override
{ return false; }
66 bool isLinkJob() const override
{ return true; }
67 void ConstructJob(Compilation
&C
, const JobAction
&JA
,
68 const InputInfo
&Output
, const InputInfoList
&Inputs
,
69 const llvm::opt::ArgList
&TCArgs
,
70 const char *LinkingOutput
) const override
;
73 void AddStartFiles(bool UseExceptions
, const llvm::opt::ArgList
&Args
,
74 llvm::opt::ArgStringList
&CmdArgs
) const;
75 void AddDefaultLibs(const llvm::opt::ArgList
&Args
,
76 llvm::opt::ArgStringList
&CmdArgs
) const;
77 void AddEndFiles(bool UseExceptions
, const llvm::opt::ArgList
&Args
,
78 llvm::opt::ArgStringList
&CmdArgs
) const;
81 void getMSP430TargetFeatures(const Driver
&D
, const llvm::opt::ArgList
&Args
,
82 std::vector
<llvm::StringRef
> &Features
);
83 } // end namespace msp430
84 } // end namespace tools
85 } // end namespace driver
86 } // end namespace clang
88 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MSP430_H