14#include "llvm/Option/ArgList.h"
15#include "llvm/Support/Path.h"
27 const char *LinkingOutput)
const {
29 ArgStringList CmdArgs;
36 CmdArgs.push_back(
"--32");
38 Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler);
40 CmdArgs.push_back(
"-o");
43 for (
const auto &II : Inputs)
44 CmdArgs.push_back(II.getFilename());
47 C.addCommand(std::make_unique<Command>(JA, *
this,
49 Exec, CmdArgs, Inputs, Output));
56 const char *LinkingOutput)
const {
60 const bool Static = Args.hasArg(options::OPT_static);
61 const bool Shared = Args.hasArg(options::OPT_shared);
62 const bool Profiling = Args.hasArg(options::OPT_pg);
63 const bool Pie = Args.hasArg(options::OPT_pie);
64 ArgStringList CmdArgs;
66 if (!
D.SysRoot.empty())
67 CmdArgs.push_back(Args.MakeArgString(
"--sysroot=" +
D.SysRoot));
69 CmdArgs.push_back(
"--eh-frame-hdr");
71 CmdArgs.push_back(
"-Bstatic");
73 if (Args.hasArg(options::OPT_rdynamic))
74 CmdArgs.push_back(
"-export-dynamic");
76 CmdArgs.push_back(
"-shared");
77 else if (!Args.hasArg(options::OPT_r)) {
78 CmdArgs.push_back(
"-dynamic-linker");
79 CmdArgs.push_back(
"/usr/libexec/ld-elf.so.2");
81 CmdArgs.push_back(
"--hash-style=gnu");
82 CmdArgs.push_back(
"--enable-new-dtags");
87 if (Arch == llvm::Triple::x86) {
88 CmdArgs.push_back(
"-m");
89 CmdArgs.push_back(
"elf_i386");
94 CmdArgs.push_back(
"-o");
98 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
100 const char *crt1 =
nullptr;
101 const char *crtbegin =
nullptr;
114 crtbegin =
"crtbeginS.o";
116 crtbegin =
"crtbegin.o";
124 Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
125 options::OPT_s, options::OPT_t});
130 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs,
133 CmdArgs.push_back(
"-rpath");
134 CmdArgs.push_back(
"/usr/lib/gcc80");
138 bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) && !
Static;
144 CmdArgs.push_back(
"-lm");
148 Args.ClaimAllArgs(options::OPT_stdlib_EQ);
154 if (
D.IsFlangMode() &&
155 !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
158 CmdArgs.push_back(
"-lm");
161 if (Args.hasArg(options::OPT_pthread))
162 CmdArgs.push_back(
"-lpthread");
164 if (!Args.hasArg(options::OPT_nolibc))
165 CmdArgs.push_back(
"-lc");
167 if (
Static || Args.hasArg(options::OPT_static_libgcc)) {
168 CmdArgs.push_back(
"-lgcc");
169 CmdArgs.push_back(
"-lgcc_eh");
171 if (Args.hasArg(options::OPT_shared_libgcc)) {
172 CmdArgs.push_back(
"-lgcc_pic");
174 CmdArgs.push_back(
"-lgcc");
176 CmdArgs.push_back(
"-lgcc");
177 CmdArgs.push_back(
"--as-needed");
178 CmdArgs.push_back(
"-lgcc_pic");
179 CmdArgs.push_back(
"--no-as-needed");
184 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
186 const char *crtend =
nullptr;
199 C.addCommand(std::make_unique<Command>(JA, *
this,
201 Exec, CmdArgs, Inputs, Output));
218 const llvm::opt::ArgList &DriverArgs,
219 llvm::opt::ArgStringList &CC1Args)
const {
222 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
225 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
227 llvm::sys::path::append(Dir,
"include");
231 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
235 concat(
D.SysRoot,
"/usr/include"));
239 llvm::opt::ArgStringList &CC1Args)
const {
241 DriverArgs, CC1Args);
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...
The JSON file list parser is used to communicate input to InstallAPI.
static constexpr ResponseFileSupport AtFileCurCP()