1 | //===--- NaCl.h - Native Client 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_NACL_H |
10 | #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H |
11 | |
12 | #include "Gnu.h" |
13 | #include "clang/Driver/Tool.h" |
14 | #include "clang/Driver/ToolChain.h" |
15 | |
16 | namespace clang { |
17 | namespace driver { |
18 | namespace tools { |
19 | namespace nacltools { |
20 | class LLVM_LIBRARY_VISIBILITY AssemblerARM : public gnutools::Assembler { |
21 | public: |
22 | AssemblerARM(const ToolChain &TC) : gnutools::Assembler(TC) {} |
23 | |
24 | void ConstructJob(Compilation &C, const JobAction &JA, |
25 | const InputInfo &Output, const InputInfoList &Inputs, |
26 | const llvm::opt::ArgList &TCArgs, |
27 | const char *LinkingOutput) const override; |
28 | }; |
29 | |
30 | class LLVM_LIBRARY_VISIBILITY Linker final : public Tool { |
31 | public: |
32 | Linker(const ToolChain &TC) : Tool("NaCl::Linker" , "linker" , TC) {} |
33 | |
34 | bool hasIntegratedCPP() const override { return false; } |
35 | bool isLinkJob() const override { return true; } |
36 | |
37 | void ConstructJob(Compilation &C, const JobAction &JA, |
38 | const InputInfo &Output, const InputInfoList &Inputs, |
39 | const llvm::opt::ArgList &TCArgs, |
40 | const char *LinkingOutput) const override; |
41 | }; |
42 | } // end namespace nacltools |
43 | } // end namespace tools |
44 | |
45 | namespace toolchains { |
46 | |
47 | class LLVM_LIBRARY_VISIBILITY NaClToolChain : public Generic_ELF { |
48 | public: |
49 | NaClToolChain(const Driver &D, const llvm::Triple &Triple, |
50 | const llvm::opt::ArgList &Args); |
51 | |
52 | void |
53 | AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, |
54 | llvm::opt::ArgStringList &CC1Args) const override; |
55 | void addLibCxxIncludePaths( |
56 | const llvm::opt::ArgList &DriverArgs, |
57 | llvm::opt::ArgStringList &CC1Args) const override; |
58 | |
59 | CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; |
60 | |
61 | void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, |
62 | llvm::opt::ArgStringList &CmdArgs) const override; |
63 | |
64 | bool IsIntegratedAssemblerDefault() const override { |
65 | return getTriple().getArch() == llvm::Triple::mipsel; |
66 | } |
67 | |
68 | // Get the path to the file containing NaCl's ARM macros. |
69 | // It lives in NaClToolChain because the ARMAssembler tool needs a |
70 | // const char * that it can pass around, |
71 | const char *GetNaClArmMacrosPath() const { return NaClArmMacrosPath.c_str(); } |
72 | |
73 | std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, |
74 | types::ID InputType) const override; |
75 | |
76 | protected: |
77 | Tool *buildLinker() const override; |
78 | Tool *buildAssembler() const override; |
79 | |
80 | private: |
81 | std::string NaClArmMacrosPath; |
82 | }; |
83 | |
84 | } // end namespace toolchains |
85 | } // end namespace driver |
86 | } // end namespace clang |
87 | |
88 | #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_NACL_H |
89 | |