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()) {
157 CmdArgs.push_back(
"-lm");
160 if (Args.hasArg(options::OPT_pthread))
161 CmdArgs.push_back(
"-lpthread");
163 if (!Args.hasArg(options::OPT_nolibc))
164 CmdArgs.push_back(
"-lc");
166 if (
Static || Args.hasArg(options::OPT_static_libgcc)) {
167 CmdArgs.push_back(
"-lgcc");
168 CmdArgs.push_back(
"-lgcc_eh");
170 if (Args.hasArg(options::OPT_shared_libgcc)) {
171 CmdArgs.push_back(
"-lgcc_pic");
173 CmdArgs.push_back(
"-lgcc");
175 CmdArgs.push_back(
"-lgcc");
176 CmdArgs.push_back(
"--as-needed");
177 CmdArgs.push_back(
"-lgcc_pic");
178 CmdArgs.push_back(
"--no-as-needed");
183 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
185 const char *crtend =
nullptr;
198 C.addCommand(std::make_unique<Command>(JA, *
this,
200 Exec, CmdArgs, Inputs, Output));
217 const llvm::opt::ArgList &DriverArgs,
218 llvm::opt::ArgStringList &CC1Args)
const {
221 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
224 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
226 llvm::sys::path::append(Dir,
"include");
230 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
234 concat(
D.SysRoot,
"/usr/include"));
238 llvm::opt::ArgStringList &CC1Args)
const {
240 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()