1//===--- RISCVToolchain.h - RISC-V 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_RISCVTOOLCHAIN_H
10#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_RISCVTOOLCHAIN_H
11
12#include "Gnu.h"
13#include "clang/Driver/ToolChain.h"
14
15namespace clang {
16namespace driver {
17namespace toolchains {
18
19class LLVM_LIBRARY_VISIBILITY RISCVToolChain : public Generic_ELF {
20public:
21 RISCVToolChain(const Driver &D, const llvm::Triple &Triple,
22 const llvm::opt::ArgList &Args);
23
24 static bool hasGCCToolchain(const Driver &D, const llvm::opt::ArgList &Args);
25 void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
26 llvm::opt::ArgStringList &CC1Args,
27 Action::OffloadKind) const override;
28 RuntimeLibType GetDefaultRuntimeLibType() const override;
29 UnwindLibType
30 GetUnwindLibType(const llvm::opt::ArgList &Args) const override;
31 UnwindTableLevel
32 getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override;
33 void
34 AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
35 llvm::opt::ArgStringList &CC1Args) const override;
36 void
37 addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
38 llvm::opt::ArgStringList &CC1Args) const override;
39
40protected:
41 Tool *buildLinker() const override;
42
43private:
44 std::string computeSysRoot() const override;
45};
46
47} // end namespace toolchains
48
49namespace tools {
50namespace RISCV {
51class LLVM_LIBRARY_VISIBILITY Linker final : public Tool {
52public:
53 Linker(const ToolChain &TC) : Tool("RISCV::Linker", "ld", TC) {}
54 bool hasIntegratedCPP() const override { return false; }
55 bool isLinkJob() const override { return true; }
56 void ConstructJob(Compilation &C, const JobAction &JA,
57 const InputInfo &Output, const InputInfoList &Inputs,
58 const llvm::opt::ArgList &TCArgs,
59 const char *LinkingOutput) const override;
60};
61} // end namespace RISCV
62} // end namespace tools
63
64} // end namespace driver
65} // end namespace clang
66
67#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_RISCVTOOLCHAIN_H
68

source code of clang/lib/Driver/ToolChains/RISCVToolchain.h