14#include "llvm/Option/ArgList.h"
15#include "llvm/Support/FileSystem.h"
16#include "llvm/Support/Path.h"
17#include "llvm/Support/raw_ostream.h"
27 StringRef InstallPath,
39 const llvm::opt::ArgList &Args) {
40 if (Args.getLastArg(options::OPT_gcc_toolchain))
44 llvm::sys::path::append(GCCDir,
D.Dir,
"..",
D.getTargetTriple(),
46 return llvm::sys::fs::exists(GCCDir);
90 const llvm::opt::ArgList &Args)
const {
95 const llvm::opt::ArgList &DriverArgs,
96 llvm::opt::ArgStringList &CC1Args,
98 CC1Args.push_back(
"-nostdsysteminc");
102 ArgStringList &CC1Args)
const {
103 if (DriverArgs.hasArg(options::OPT_nostdinc))
106 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
108 llvm::sys::path::append(Dir,
"include");
112 if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) {
114 llvm::sys::path::append(Dir,
"include");
120 const llvm::opt::ArgList &DriverArgs,
121 llvm::opt::ArgStringList &CC1Args)
const {
130std::string RISCVToolChain::computeSysRoot()
const {
138 llvm::sys::path::append(SysRootDir, LibDir,
"..", TripleStr);
142 llvm::sys::path::append(SysRootDir,
getDriver().Dir,
"..",
146 if (!llvm::sys::fs::exists(SysRootDir))
147 return std::string();
149 return std::string(SysRootDir);
156 const char *LinkingOutput)
const {
159 ArgStringList CmdArgs;
161 if (!
D.SysRoot.empty())
162 CmdArgs.push_back(Args.MakeArgString(
"--sysroot=" +
D.SysRoot));
164 if (Args.hasArg(options::OPT_mno_relax))
165 CmdArgs.push_back(
"--no-relax");
168 CmdArgs.push_back(
"-m");
170 CmdArgs.push_back(
"elf64lriscv");
172 CmdArgs.push_back(
"elf32lriscv");
174 CmdArgs.push_back(
"-X");
176 std::string
Linker = getToolChain().GetLinkerPath();
179 !Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles);
181 const char *crtbegin, *crtend;
184 crtbegin =
"crtbegin.o";
201 Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_u});
204 Args.addAllArgs(CmdArgs, {options::OPT_T_Group, options::OPT_s,
205 options::OPT_t, options::OPT_r});
209 if (!Args.hasArg(options::OPT_nostdlib) &&
210 !Args.hasArg(options::OPT_nodefaultlibs)) {
214 CmdArgs.push_back(
"-lm");
216 CmdArgs.push_back(
"--start-group");
217 CmdArgs.push_back(
"-lc");
218 CmdArgs.push_back(
"-lgloss");
219 CmdArgs.push_back(
"--end-group");
226 CmdArgs.push_back(
"-o");
228 C.addCommand(std::make_unique<Command>(
230 CmdArgs, Inputs, Output));
Compilation - A set of tasks to perform for a single driver invocation.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
std::string SysRoot
sysroot, if present
See also MultilibSetBuilder for combining multilibs into a set.
const IncludeDirsFunc & filePathsCallback() const
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
const std::string & includeSuffix() const
Get the include directory suffix.
The JSON file list parser is used to communicate input to InstallAPI.
static constexpr ResponseFileSupport AtFileCurCP()