blob: e0fc23962c2d48c2acde53824e546ddf1ca61291 [file] [log] [blame]
Rui Ueyama411c63602015-05-28 19:09:30 +00001//===- Driver.cpp ---------------------------------------------------------===//
2//
3// The LLVM Linker
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "Config.h"
11#include "Driver.h"
Rui Ueyama562daa82015-06-18 21:50:38 +000012#include "Error.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000013#include "InputFiles.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000014#include "SymbolTable.h"
Rui Ueyama685c41c2015-08-05 23:43:53 +000015#include "Symbols.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000016#include "Writer.h"
Rui Ueyamaa453c0a2016-03-02 19:08:05 +000017#include "lld/Driver/Driver.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000018#include "llvm/ADT/Optional.h"
Peter Collingbournebd1cb792015-06-09 21:52:48 +000019#include "llvm/LibDriver/LibDriver.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000020#include "llvm/Option/Arg.h"
21#include "llvm/Option/ArgList.h"
22#include "llvm/Option/Option.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000023#include "llvm/Support/Debug.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000024#include "llvm/Support/Path.h"
Rui Ueyama54b71da2015-05-31 19:17:12 +000025#include "llvm/Support/Process.h"
Peter Collingbourne60c16162015-06-01 20:10:10 +000026#include "llvm/Support/TargetSelect.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000027#include "llvm/Support/raw_ostream.h"
Rui Ueyama2bf6a122015-06-14 21:50:50 +000028#include <algorithm>
Rui Ueyama411c63602015-05-28 19:09:30 +000029#include <memory>
30
31using namespace llvm;
Rui Ueyama84936e02015-07-07 23:39:18 +000032using namespace llvm::COFF;
Rui Ueyama54b71da2015-05-31 19:17:12 +000033using llvm::sys::Process;
Peter Collingbournebaf5f872015-06-26 19:20:09 +000034using llvm::sys::fs::OpenFlags;
Rui Ueyama711cd2d2015-05-31 21:17:10 +000035using llvm::sys::fs::file_magic;
36using llvm::sys::fs::identify_magic;
Rui Ueyama411c63602015-05-28 19:09:30 +000037
Rui Ueyama3500f662015-05-28 20:30:06 +000038namespace lld {
39namespace coff {
Rui Ueyama411c63602015-05-28 19:09:30 +000040
Rui Ueyama3500f662015-05-28 20:30:06 +000041Configuration *Config;
Rui Ueyamaa9cbbf82015-05-31 19:17:09 +000042LinkerDriver *Driver;
43
Rui Ueyama417553d2016-02-28 19:54:51 +000044bool link(llvm::ArrayRef<const char *> Args) {
Rui Ueyama570752c2015-08-18 09:13:25 +000045 Configuration C;
46 LinkerDriver D;
47 Config = &C;
48 Driver = &D;
Rui Ueyama417553d2016-02-28 19:54:51 +000049 Driver->link(Args);
50 return true;
Rui Ueyamaa9cbbf82015-05-31 19:17:09 +000051}
Rui Ueyama411c63602015-05-28 19:09:30 +000052
Rui Ueyamaad660982015-06-07 00:20:32 +000053// Drop directory components and replace extension with ".exe".
54static std::string getOutputPath(StringRef Path) {
55 auto P = Path.find_last_of("\\/");
56 StringRef S = (P == StringRef::npos) ? Path : Path.substr(P + 1);
57 return (S.substr(0, S.rfind('.')) + ".exe").str();
Rui Ueyama411c63602015-05-28 19:09:30 +000058}
59
Rui Ueyamad7c2f582015-05-31 21:04:56 +000060// Opens a file. Path has to be resolved already.
61// Newly created memory buffers are owned by this driver.
Rafael Espindolab835ae82015-08-06 14:58:50 +000062MemoryBufferRef LinkerDriver::openFile(StringRef Path) {
Rui Ueyamad7c2f582015-05-31 21:04:56 +000063 auto MBOrErr = MemoryBuffer::getFile(Path);
Rafael Espindolab835ae82015-08-06 14:58:50 +000064 error(MBOrErr, Twine("Could not open ") + Path);
65 std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;
Rui Ueyamad7c2f582015-05-31 21:04:56 +000066 MemoryBufferRef MBRef = MB->getMemBufferRef();
67 OwningMBs.push_back(std::move(MB)); // take ownership
Rui Ueyama2bf6a122015-06-14 21:50:50 +000068 return MBRef;
69}
Rui Ueyama711cd2d2015-05-31 21:17:10 +000070
Rui Ueyama2bf6a122015-06-14 21:50:50 +000071static std::unique_ptr<InputFile> createFile(MemoryBufferRef MB) {
Rui Ueyama711cd2d2015-05-31 21:17:10 +000072 // File type is detected by contents, not by file extension.
Rui Ueyama2bf6a122015-06-14 21:50:50 +000073 file_magic Magic = identify_magic(MB.getBuffer());
Rui Ueyama711cd2d2015-05-31 21:17:10 +000074 if (Magic == file_magic::archive)
Rui Ueyama2bf6a122015-06-14 21:50:50 +000075 return std::unique_ptr<InputFile>(new ArchiveFile(MB));
Peter Collingbourne60c16162015-06-01 20:10:10 +000076 if (Magic == file_magic::bitcode)
Rui Ueyama2bf6a122015-06-14 21:50:50 +000077 return std::unique_ptr<InputFile>(new BitcodeFile(MB));
Rui Ueyamaad660982015-06-07 00:20:32 +000078 if (Config->OutputFile == "")
Rui Ueyama2bf6a122015-06-14 21:50:50 +000079 Config->OutputFile = getOutputPath(MB.getBufferIdentifier());
80 return std::unique_ptr<InputFile>(new ObjectFile(MB));
Rui Ueyama411c63602015-05-28 19:09:30 +000081}
82
Rui Ueyamaf10a3202015-08-31 08:43:21 +000083static bool isDecorated(StringRef Sym) {
84 return Sym.startswith("_") || Sym.startswith("@") || Sym.startswith("?");
85}
86
Rui Ueyama411c63602015-05-28 19:09:30 +000087// Parses .drectve section contents and returns a list of files
88// specified by /defaultlib.
Rafael Espindolab835ae82015-08-06 14:58:50 +000089void LinkerDriver::parseDirectives(StringRef S) {
90 llvm::opt::InputArgList Args = Parser.parse(S);
Rui Ueyama411c63602015-05-28 19:09:30 +000091
David Blaikie6521ed92015-06-22 22:06:52 +000092 for (auto *Arg : Args) {
Rui Ueyama562daa82015-06-18 21:50:38 +000093 switch (Arg->getOption().getID()) {
94 case OPT_alternatename:
Rafael Espindolab835ae82015-08-06 14:58:50 +000095 parseAlternateName(Arg->getValue());
Rui Ueyama562daa82015-06-18 21:50:38 +000096 break;
97 case OPT_defaultlib:
98 if (Optional<StringRef> Path = findLib(Arg->getValue())) {
Rafael Espindolab835ae82015-08-06 14:58:50 +000099 MemoryBufferRef MB = openFile(*Path);
100 Symtab.addFile(createFile(MB));
Rui Ueyama562daa82015-06-18 21:50:38 +0000101 }
102 break;
103 case OPT_export: {
Rafael Espindolab835ae82015-08-06 14:58:50 +0000104 Export E = parseExport(Arg->getValue());
Rui Ueyamaf10a3202015-08-31 08:43:21 +0000105 E.Directives = true;
Rafael Espindolab835ae82015-08-06 14:58:50 +0000106 Config->Exports.push_back(E);
Rui Ueyama562daa82015-06-18 21:50:38 +0000107 break;
108 }
109 case OPT_failifmismatch:
Rafael Espindolab835ae82015-08-06 14:58:50 +0000110 checkFailIfMismatch(Arg->getValue());
Rui Ueyama562daa82015-06-18 21:50:38 +0000111 break;
Rui Ueyama08d5e182015-06-18 23:20:11 +0000112 case OPT_incl:
Rui Ueyama32f8e1c2015-06-26 03:44:00 +0000113 addUndefined(Arg->getValue());
Rui Ueyama08d5e182015-06-18 23:20:11 +0000114 break;
Rui Ueyamace86c992015-06-18 23:22:39 +0000115 case OPT_merge:
Rafael Espindolab835ae82015-08-06 14:58:50 +0000116 parseMerge(Arg->getValue());
Rui Ueyamace86c992015-06-18 23:22:39 +0000117 break;
118 case OPT_nodefaultlib:
119 Config->NoDefaultLibs.insert(doFindLib(Arg->getValue()));
120 break;
Rui Ueyama3c4737d2015-08-11 16:46:08 +0000121 case OPT_editandcontinue:
Rui Ueyama31e66e32015-09-03 16:20:47 +0000122 case OPT_guardsym:
Rui Ueyama432383172015-07-29 21:01:15 +0000123 case OPT_throwingnew:
Rui Ueyama46682632015-07-29 20:29:15 +0000124 break;
Rui Ueyama562daa82015-06-18 21:50:38 +0000125 default:
Rafael Espindolab835ae82015-08-06 14:58:50 +0000126 error(Twine(Arg->getSpelling()) + " is not allowed in .drectve");
Rui Ueyamad7c2f582015-05-31 21:04:56 +0000127 }
128 }
Rui Ueyama411c63602015-05-28 19:09:30 +0000129}
130
Rui Ueyama54b71da2015-05-31 19:17:12 +0000131// Find file from search paths. You can omit ".obj", this function takes
132// care of that. Note that the returned path is not guaranteed to exist.
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000133StringRef LinkerDriver::doFindFile(StringRef Filename) {
Rui Ueyama54b71da2015-05-31 19:17:12 +0000134 bool hasPathSep = (Filename.find_first_of("/\\") != StringRef::npos);
135 if (hasPathSep)
136 return Filename;
137 bool hasExt = (Filename.find('.') != StringRef::npos);
138 for (StringRef Dir : SearchPaths) {
139 SmallString<128> Path = Dir;
140 llvm::sys::path::append(Path, Filename);
141 if (llvm::sys::fs::exists(Path.str()))
142 return Alloc.save(Path.str());
143 if (!hasExt) {
144 Path.append(".obj");
145 if (llvm::sys::fs::exists(Path.str()))
146 return Alloc.save(Path.str());
147 }
148 }
149 return Filename;
150}
151
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000152// Resolves a file path. This never returns the same path
153// (in that case, it returns None).
154Optional<StringRef> LinkerDriver::findFile(StringRef Filename) {
155 StringRef Path = doFindFile(Filename);
156 bool Seen = !VisitedFiles.insert(Path.lower()).second;
157 if (Seen)
158 return None;
159 return Path;
Rui Ueyama54b71da2015-05-31 19:17:12 +0000160}
161
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000162// Find library file from search path.
163StringRef LinkerDriver::doFindLib(StringRef Filename) {
164 // Add ".lib" to Filename if that has no file extension.
Rui Ueyama54b71da2015-05-31 19:17:12 +0000165 bool hasExt = (Filename.find('.') != StringRef::npos);
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000166 if (!hasExt)
167 Filename = Alloc.save(Filename + ".lib");
168 return doFindFile(Filename);
169}
170
171// Resolves a library path. /nodefaultlib options are taken into
172// consideration. This never returns the same path (in that case,
173// it returns None).
174Optional<StringRef> LinkerDriver::findLib(StringRef Filename) {
175 if (Config->NoDefaultLibAll)
176 return None;
177 StringRef Path = doFindLib(Filename);
178 if (Config->NoDefaultLibs.count(Path))
179 return None;
180 bool Seen = !VisitedFiles.insert(Path.lower()).second;
181 if (Seen)
182 return None;
183 return Path;
Rui Ueyama54b71da2015-05-31 19:17:12 +0000184}
185
186// Parses LIB environment which contains a list of search paths.
Rui Ueyamaf00df0a2015-06-19 22:39:48 +0000187void LinkerDriver::addLibSearchPaths() {
Rui Ueyama54b71da2015-05-31 19:17:12 +0000188 Optional<std::string> EnvOpt = Process::GetEnv("LIB");
189 if (!EnvOpt.hasValue())
Rui Ueyamaf00df0a2015-06-19 22:39:48 +0000190 return;
Rui Ueyama54b71da2015-05-31 19:17:12 +0000191 StringRef Env = Alloc.save(*EnvOpt);
192 while (!Env.empty()) {
193 StringRef Path;
194 std::tie(Path, Env) = Env.split(';');
Rui Ueyamaf00df0a2015-06-19 22:39:48 +0000195 SearchPaths.push_back(Path);
Rui Ueyama54b71da2015-05-31 19:17:12 +0000196 }
Rui Ueyama54b71da2015-05-31 19:17:12 +0000197}
198
Rui Ueyama6bf638e2015-07-02 00:04:14 +0000199Undefined *LinkerDriver::addUndefined(StringRef Name) {
200 Undefined *U = Symtab.addUndefined(Name);
Rui Ueyama18f8d2c2015-07-02 00:21:08 +0000201 Config->GCRoot.insert(U);
Rui Ueyama6bf638e2015-07-02 00:04:14 +0000202 return U;
Rui Ueyama32f8e1c2015-06-26 03:44:00 +0000203}
204
Rui Ueyama7c3e23f2015-07-09 01:25:49 +0000205// Symbol names are mangled by appending "_" prefix on x86.
206StringRef LinkerDriver::mangle(StringRef Sym) {
Rui Ueyama5e706b32015-07-25 21:54:50 +0000207 assert(Config->Machine != IMAGE_FILE_MACHINE_UNKNOWN);
208 if (Config->Machine == I386)
Rui Ueyama7c3e23f2015-07-09 01:25:49 +0000209 return Alloc.save("_" + Sym);
210 return Sym;
211}
212
Rui Ueyama45044f42015-06-29 01:03:53 +0000213// Windows specific -- find default entry point name.
214StringRef LinkerDriver::findDefaultEntry() {
215 // User-defined main functions and their corresponding entry points.
216 static const char *Entries[][2] = {
217 {"main", "mainCRTStartup"},
218 {"wmain", "wmainCRTStartup"},
219 {"WinMain", "WinMainCRTStartup"},
220 {"wWinMain", "wWinMainCRTStartup"},
221 };
222 for (auto E : Entries) {
Rui Ueyamaa50387f2015-07-14 02:58:13 +0000223 StringRef Entry = Symtab.findMangle(mangle(E[0]));
224 if (!Entry.empty() && !isa<Undefined>(Symtab.find(Entry)->Body))
Rui Ueyama7c3e23f2015-07-09 01:25:49 +0000225 return mangle(E[1]);
Rui Ueyama45044f42015-06-29 01:03:53 +0000226 }
227 return "";
228}
229
230WindowsSubsystem LinkerDriver::inferSubsystem() {
Rui Ueyama97dff9e2015-06-17 00:16:33 +0000231 if (Config->DLL)
232 return IMAGE_SUBSYSTEM_WINDOWS_GUI;
Rui Ueyama611add22015-08-08 00:23:37 +0000233 if (Symtab.findUnderscore("main") || Symtab.findUnderscore("wmain"))
Rui Ueyama45044f42015-06-29 01:03:53 +0000234 return IMAGE_SUBSYSTEM_WINDOWS_CUI;
Rui Ueyama611add22015-08-08 00:23:37 +0000235 if (Symtab.findUnderscore("WinMain") || Symtab.findUnderscore("wWinMain"))
Rui Ueyama45044f42015-06-29 01:03:53 +0000236 return IMAGE_SUBSYSTEM_WINDOWS_GUI;
237 return IMAGE_SUBSYSTEM_UNKNOWN;
Rui Ueyama97dff9e2015-06-17 00:16:33 +0000238}
239
Rui Ueyama5c437cd2015-07-25 21:42:33 +0000240static uint64_t getDefaultImageBase() {
241 if (Config->is64())
242 return Config->DLL ? 0x180000000 : 0x140000000;
243 return Config->DLL ? 0x10000000 : 0x400000;
244}
245
Rafael Espindolab835ae82015-08-06 14:58:50 +0000246void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
Rui Ueyama27e470a2015-08-09 20:45:17 +0000247 // If the first command line argument is "/lib", link.exe acts like lib.exe.
248 // We call our own implementation of lib.exe that understands bitcode files.
249 if (ArgsArr.size() > 1 && StringRef(ArgsArr[1]).equals_lower("/lib")) {
250 if (llvm::libDriverMain(ArgsArr.slice(1)) != 0)
251 error("lib failed");
252 return;
253 }
254
Peter Collingbourne60c16162015-06-01 20:10:10 +0000255 // Needed for LTO.
256 llvm::InitializeAllTargetInfos();
257 llvm::InitializeAllTargets();
258 llvm::InitializeAllTargetMCs();
259 llvm::InitializeAllAsmParsers();
260 llvm::InitializeAllAsmPrinters();
261 llvm::InitializeAllDisassemblers();
262
Rui Ueyama411c63602015-05-28 19:09:30 +0000263 // Parse command line options.
Rafael Espindolab835ae82015-08-06 14:58:50 +0000264 llvm::opt::InputArgList Args = Parser.parseLINK(ArgsArr.slice(1));
Rui Ueyama411c63602015-05-28 19:09:30 +0000265
Rui Ueyama5c726432015-05-29 16:11:52 +0000266 // Handle /help
David Blaikie6521ed92015-06-22 22:06:52 +0000267 if (Args.hasArg(OPT_help)) {
David Blaikieb2b1c7c2015-06-21 06:32:10 +0000268 printHelp(ArgsArr[0]);
Rafael Espindolab835ae82015-08-06 14:58:50 +0000269 return;
Rui Ueyama5c726432015-05-29 16:11:52 +0000270 }
271
Rafael Espindolab835ae82015-08-06 14:58:50 +0000272 if (Args.filtered_begin(OPT_INPUT) == Args.filtered_end())
273 error("no input files.");
Rui Ueyama3d3e6fb2015-05-29 16:06:00 +0000274
Rui Ueyamaf00df0a2015-06-19 22:39:48 +0000275 // Construct search path list.
276 SearchPaths.push_back("");
David Blaikie6521ed92015-06-22 22:06:52 +0000277 for (auto *Arg : Args.filtered(OPT_libpath))
Rui Ueyamaf00df0a2015-06-19 22:39:48 +0000278 SearchPaths.push_back(Arg->getValue());
279 addLibSearchPaths();
280
Rui Ueyamaad660982015-06-07 00:20:32 +0000281 // Handle /out
David Blaikie6521ed92015-06-22 22:06:52 +0000282 if (auto *Arg = Args.getLastArg(OPT_out))
Rui Ueyamaad660982015-06-07 00:20:32 +0000283 Config->OutputFile = Arg->getValue();
284
Rui Ueyama3d3e6fb2015-05-29 16:06:00 +0000285 // Handle /verbose
David Blaikie6521ed92015-06-22 22:06:52 +0000286 if (Args.hasArg(OPT_verbose))
Rui Ueyama411c63602015-05-28 19:09:30 +0000287 Config->Verbose = true;
Rui Ueyama3d3e6fb2015-05-29 16:06:00 +0000288
Rui Ueyama95925fd2015-06-28 19:35:15 +0000289 // Handle /force or /force:unresolved
290 if (Args.hasArg(OPT_force) || Args.hasArg(OPT_force_unresolved))
291 Config->Force = true;
292
Rui Ueyama6600eb12015-07-04 23:37:32 +0000293 // Handle /debug
294 if (Args.hasArg(OPT_debug))
295 Config->Debug = true;
296
Rui Ueyamaa8b60452015-06-28 19:56:30 +0000297 // Handle /noentry
298 if (Args.hasArg(OPT_noentry)) {
Rafael Espindolab835ae82015-08-06 14:58:50 +0000299 if (!Args.hasArg(OPT_dll))
300 error("/noentry must be specified with /dll");
Rui Ueyamaa8b60452015-06-28 19:56:30 +0000301 Config->NoEntry = true;
302 }
303
Rui Ueyama97dff9e2015-06-17 00:16:33 +0000304 // Handle /dll
David Blaikie6521ed92015-06-22 22:06:52 +0000305 if (Args.hasArg(OPT_dll)) {
Rui Ueyama97dff9e2015-06-17 00:16:33 +0000306 Config->DLL = true;
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000307 Config->ManifestID = 2;
308 }
Rui Ueyama97dff9e2015-06-17 00:16:33 +0000309
Rui Ueyama588e8322015-06-15 01:23:58 +0000310 // Handle /fixed
David Blaikie6521ed92015-06-22 22:06:52 +0000311 if (Args.hasArg(OPT_fixed)) {
Rafael Espindolab835ae82015-08-06 14:58:50 +0000312 if (Args.hasArg(OPT_dynamicbase))
313 error("/fixed must not be specified with /dynamicbase");
Rui Ueyama588e8322015-06-15 01:23:58 +0000314 Config->Relocatable = false;
Rui Ueyama6592ff82015-06-16 23:13:00 +0000315 Config->DynamicBase = false;
316 }
Rui Ueyama588e8322015-06-15 01:23:58 +0000317
Rui Ueyama3d3e6fb2015-05-29 16:06:00 +0000318 // Handle /machine
Rafael Espindolab835ae82015-08-06 14:58:50 +0000319 if (auto *Arg = Args.getLastArg(OPT_machine))
320 Config->Machine = getMachineType(Arg->getValue());
Rui Ueyama3d3e6fb2015-05-29 16:06:00 +0000321
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000322 // Handle /nodefaultlib:<filename>
David Blaikie6521ed92015-06-22 22:06:52 +0000323 for (auto *Arg : Args.filtered(OPT_nodefaultlib))
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000324 Config->NoDefaultLibs.insert(doFindLib(Arg->getValue()));
325
326 // Handle /nodefaultlib
David Blaikie6521ed92015-06-22 22:06:52 +0000327 if (Args.hasArg(OPT_nodefaultlib_all))
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000328 Config->NoDefaultLibAll = true;
329
Rui Ueyama804a8b62015-05-29 16:18:15 +0000330 // Handle /base
Rafael Espindolab835ae82015-08-06 14:58:50 +0000331 if (auto *Arg = Args.getLastArg(OPT_base))
332 parseNumbers(Arg->getValue(), &Config->ImageBase);
Rui Ueyamab41b7e52015-05-29 16:21:11 +0000333
334 // Handle /stack
Rafael Espindolab835ae82015-08-06 14:58:50 +0000335 if (auto *Arg = Args.getLastArg(OPT_stack))
336 parseNumbers(Arg->getValue(), &Config->StackReserve, &Config->StackCommit);
Rui Ueyama804a8b62015-05-29 16:18:15 +0000337
Rui Ueyamac377e9a2015-05-29 16:23:40 +0000338 // Handle /heap
Rafael Espindolab835ae82015-08-06 14:58:50 +0000339 if (auto *Arg = Args.getLastArg(OPT_heap))
340 parseNumbers(Arg->getValue(), &Config->HeapReserve, &Config->HeapCommit);
Rui Ueyamac377e9a2015-05-29 16:23:40 +0000341
Rui Ueyamab9dcdb52015-05-29 16:28:29 +0000342 // Handle /version
Rafael Espindolab835ae82015-08-06 14:58:50 +0000343 if (auto *Arg = Args.getLastArg(OPT_version))
344 parseVersion(Arg->getValue(), &Config->MajorImageVersion,
345 &Config->MinorImageVersion);
Rui Ueyamab9dcdb52015-05-29 16:28:29 +0000346
Rui Ueyama15cc47e2015-05-29 16:34:31 +0000347 // Handle /subsystem
Rafael Espindolab835ae82015-08-06 14:58:50 +0000348 if (auto *Arg = Args.getLastArg(OPT_subsystem))
349 parseSubsystem(Arg->getValue(), &Config->Subsystem, &Config->MajorOSVersion,
350 &Config->MinorOSVersion);
Rui Ueyama15cc47e2015-05-29 16:34:31 +0000351
Rui Ueyama2edb35a2015-06-18 19:09:30 +0000352 // Handle /alternatename
David Blaikie6521ed92015-06-22 22:06:52 +0000353 for (auto *Arg : Args.filtered(OPT_alternatename))
Rafael Espindolab835ae82015-08-06 14:58:50 +0000354 parseAlternateName(Arg->getValue());
Rui Ueyama2edb35a2015-06-18 19:09:30 +0000355
Rui Ueyama08d5e182015-06-18 23:20:11 +0000356 // Handle /include
David Blaikie6521ed92015-06-22 22:06:52 +0000357 for (auto *Arg : Args.filtered(OPT_incl))
Rui Ueyama32f8e1c2015-06-26 03:44:00 +0000358 addUndefined(Arg->getValue());
Rui Ueyama08d5e182015-06-18 23:20:11 +0000359
Rui Ueyamab95188c2015-06-18 20:27:09 +0000360 // Handle /implib
David Blaikie6521ed92015-06-22 22:06:52 +0000361 if (auto *Arg = Args.getLastArg(OPT_implib))
Rui Ueyamab95188c2015-06-18 20:27:09 +0000362 Config->Implib = Arg->getValue();
363
Rui Ueyamae2cbfea2015-06-07 03:17:42 +0000364 // Handle /opt
David Blaikie6521ed92015-06-22 22:06:52 +0000365 for (auto *Arg : Args.filtered(OPT_opt)) {
Rui Ueyama75656ee2015-10-19 19:40:43 +0000366 std::string Str = StringRef(Arg->getValue()).lower();
367 SmallVector<StringRef, 1> Vec;
368 StringRef(Str).split(Vec, ',');
369 for (StringRef S : Vec) {
370 if (S == "noref") {
371 Config->DoGC = false;
372 Config->DoICF = false;
373 continue;
374 }
375 if (S == "icf" || StringRef(S).startswith("icf=")) {
376 Config->DoICF = true;
377 continue;
378 }
379 if (S == "noicf") {
380 Config->DoICF = false;
381 continue;
382 }
383 if (StringRef(S).startswith("lldlto=")) {
384 StringRef OptLevel = StringRef(S).substr(7);
385 if (OptLevel.getAsInteger(10, Config->LTOOptLevel) ||
386 Config->LTOOptLevel > 3)
387 error("/opt:lldlto: invalid optimization level: " + OptLevel);
388 continue;
389 }
390 if (StringRef(S).startswith("lldltojobs=")) {
391 StringRef Jobs = StringRef(S).substr(11);
392 if (Jobs.getAsInteger(10, Config->LTOJobs) || Config->LTOJobs == 0)
393 error("/opt:lldltojobs: invalid job count: " + Jobs);
394 continue;
395 }
396 if (S != "ref" && S != "lbr" && S != "nolbr")
397 error(Twine("/opt: unknown option: ") + S);
Rui Ueyamae2cbfea2015-06-07 03:17:42 +0000398 }
Rui Ueyamae2cbfea2015-06-07 03:17:42 +0000399 }
400
Rui Ueyama8854d8a2015-06-04 19:21:24 +0000401 // Handle /failifmismatch
David Blaikie6521ed92015-06-22 22:06:52 +0000402 for (auto *Arg : Args.filtered(OPT_failifmismatch))
Rafael Espindolab835ae82015-08-06 14:58:50 +0000403 checkFailIfMismatch(Arg->getValue());
Rui Ueyama8854d8a2015-06-04 19:21:24 +0000404
Rui Ueyama6600eb12015-07-04 23:37:32 +0000405 // Handle /merge
406 for (auto *Arg : Args.filtered(OPT_merge))
Rafael Espindolab835ae82015-08-06 14:58:50 +0000407 parseMerge(Arg->getValue());
Rui Ueyama6600eb12015-07-04 23:37:32 +0000408
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000409 // Handle /manifest
Rafael Espindolab835ae82015-08-06 14:58:50 +0000410 if (auto *Arg = Args.getLastArg(OPT_manifest_colon))
411 parseManifest(Arg->getValue());
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000412
413 // Handle /manifestuac
Rafael Espindolab835ae82015-08-06 14:58:50 +0000414 if (auto *Arg = Args.getLastArg(OPT_manifestuac))
415 parseManifestUAC(Arg->getValue());
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000416
417 // Handle /manifestdependency
David Blaikie6521ed92015-06-22 22:06:52 +0000418 if (auto *Arg = Args.getLastArg(OPT_manifestdependency))
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000419 Config->ManifestDependency = Arg->getValue();
420
421 // Handle /manifestfile
David Blaikie6521ed92015-06-22 22:06:52 +0000422 if (auto *Arg = Args.getLastArg(OPT_manifestfile))
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000423 Config->ManifestFile = Arg->getValue();
424
Rui Ueyama6592ff82015-06-16 23:13:00 +0000425 // Handle miscellaneous boolean flags.
David Blaikie6521ed92015-06-22 22:06:52 +0000426 if (Args.hasArg(OPT_allowbind_no))
427 Config->AllowBind = false;
428 if (Args.hasArg(OPT_allowisolation_no))
429 Config->AllowIsolation = false;
430 if (Args.hasArg(OPT_dynamicbase_no))
431 Config->DynamicBase = false;
David Blaikie6521ed92015-06-22 22:06:52 +0000432 if (Args.hasArg(OPT_nxcompat_no))
433 Config->NxCompat = false;
434 if (Args.hasArg(OPT_tsaware_no))
435 Config->TerminalServerAware = false;
Rui Ueyama96401732015-09-21 23:43:31 +0000436 if (Args.hasArg(OPT_nosymtab))
437 Config->WriteSymtab = false;
Rui Ueyama6592ff82015-06-16 23:13:00 +0000438
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000439 // Create a list of input files. Files can be given as arguments
440 // for /defaultlib option.
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000441 std::vector<StringRef> Paths;
442 std::vector<MemoryBufferRef> MBs;
David Blaikie6521ed92015-06-22 22:06:52 +0000443 for (auto *Arg : Args.filtered(OPT_INPUT))
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000444 if (Optional<StringRef> Path = findFile(Arg->getValue()))
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000445 Paths.push_back(*Path);
David Blaikie6521ed92015-06-22 22:06:52 +0000446 for (auto *Arg : Args.filtered(OPT_defaultlib))
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000447 if (Optional<StringRef> Path = findLib(Arg->getValue()))
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000448 Paths.push_back(*Path);
Rafael Espindolab835ae82015-08-06 14:58:50 +0000449 for (StringRef Path : Paths)
450 MBs.push_back(openFile(Path));
Rui Ueyamad21b00b2015-05-31 19:17:14 +0000451
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000452 // Windows specific -- Create a resource file containing a manifest file.
453 if (Config->Manifest == Configuration::Embed) {
Rafael Espindolab835ae82015-08-06 14:58:50 +0000454 std::unique_ptr<MemoryBuffer> MB = createManifestRes();
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000455 MBs.push_back(MB->getMemBufferRef());
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000456 OwningMBs.push_back(std::move(MB)); // take ownership
457 }
458
Rui Ueyama2bf6a122015-06-14 21:50:50 +0000459 // Windows specific -- Input files can be Windows resource files (.res files).
460 // We invoke cvtres.exe to convert resource files to a regular COFF file
461 // then link the result file normally.
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000462 std::vector<MemoryBufferRef> Resources;
Rui Ueyama77731b42015-06-26 23:59:13 +0000463 auto NotResource = [](MemoryBufferRef MB) {
464 return identify_magic(MB.getBuffer()) != file_magic::windows_resource;
Rui Ueyama2bf6a122015-06-14 21:50:50 +0000465 };
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000466 auto It = std::stable_partition(MBs.begin(), MBs.end(), NotResource);
467 if (It != MBs.end()) {
468 Resources.insert(Resources.end(), It, MBs.end());
469 MBs.erase(It, MBs.end());
Rui Ueyama2bf6a122015-06-14 21:50:50 +0000470 }
471
Rui Ueyama85225b02015-07-02 03:15:15 +0000472 // Read all input files given via the command line. Note that step()
473 // doesn't read files that are specified by directive sections.
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000474 for (MemoryBufferRef MB : MBs)
Rui Ueyama0d2e9992015-06-23 23:56:39 +0000475 Symtab.addFile(createFile(MB));
Rafael Espindolab835ae82015-08-06 14:58:50 +0000476 Symtab.step();
Rui Ueyama5cff6852015-05-31 03:34:08 +0000477
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000478 // Determine machine type and check if all object files are
479 // for the same CPU type. Note that this needs to be done before
480 // any call to mangle().
481 for (std::unique_ptr<InputFile> &File : Symtab.getFiles()) {
482 MachineTypes MT = File->getMachineType();
483 if (MT == IMAGE_FILE_MACHINE_UNKNOWN)
484 continue;
Rui Ueyama5e706b32015-07-25 21:54:50 +0000485 if (Config->Machine == IMAGE_FILE_MACHINE_UNKNOWN) {
486 Config->Machine = MT;
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000487 continue;
488 }
Rafael Espindolab835ae82015-08-06 14:58:50 +0000489 if (Config->Machine != MT)
490 error(Twine(File->getShortName()) + ": machine type " + machineToStr(MT) +
491 " conflicts with " + machineToStr(Config->Machine));
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000492 }
Rui Ueyama5e706b32015-07-25 21:54:50 +0000493 if (Config->Machine == IMAGE_FILE_MACHINE_UNKNOWN) {
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000494 llvm::errs() << "warning: /machine is not specified. x64 is assumed.\n";
Rui Ueyama5e706b32015-07-25 21:54:50 +0000495 Config->Machine = AMD64;
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000496 }
497
498 // Windows specific -- Convert Windows resource files to a COFF file.
499 if (!Resources.empty()) {
Rafael Espindolab835ae82015-08-06 14:58:50 +0000500 std::unique_ptr<MemoryBuffer> MB = convertResToCOFF(Resources);
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000501 Symtab.addFile(createFile(MB->getMemBufferRef()));
502 OwningMBs.push_back(std::move(MB)); // take ownership
503 }
504
Rui Ueyama4d545342015-07-28 03:12:00 +0000505 // Handle /largeaddressaware
506 if (Config->is64() || Args.hasArg(OPT_largeaddressaware))
507 Config->LargeAddressAware = true;
508
Rui Ueyamad68e2112015-07-28 03:15:57 +0000509 // Handle /highentropyva
510 if (Config->is64() && !Args.hasArg(OPT_highentropyva_no))
511 Config->HighEntropyVA = true;
512
Rui Ueyamabbdec4f2015-07-09 22:51:41 +0000513 // Handle /entry and /dll
514 if (auto *Arg = Args.getLastArg(OPT_entry)) {
515 Config->Entry = addUndefined(mangle(Arg->getValue()));
516 } else if (Args.hasArg(OPT_dll) && !Config->NoEntry) {
Rui Ueyama5e706b32015-07-25 21:54:50 +0000517 StringRef S = (Config->Machine == I386) ? "__DllMainCRTStartup@12"
518 : "_DllMainCRTStartup";
Rui Ueyamabbdec4f2015-07-09 22:51:41 +0000519 Config->Entry = addUndefined(S);
520 } else if (!Config->NoEntry) {
521 // Windows specific -- If entry point name is not given, we need to
522 // infer that from user-defined entry name.
Rui Ueyama45044f42015-06-29 01:03:53 +0000523 StringRef S = findDefaultEntry();
Rafael Espindolab835ae82015-08-06 14:58:50 +0000524 if (S.empty())
525 error("entry point must be defined");
Rui Ueyama6bf638e2015-07-02 00:04:14 +0000526 Config->Entry = addUndefined(S);
Rui Ueyama85225b02015-07-02 03:15:15 +0000527 if (Config->Verbose)
528 llvm::outs() << "Entry name inferred: " << S << "\n";
Rui Ueyama45044f42015-06-29 01:03:53 +0000529 }
530
Rui Ueyamabbdec4f2015-07-09 22:51:41 +0000531 // Handle /export
532 for (auto *Arg : Args.filtered(OPT_export)) {
Rafael Espindolab835ae82015-08-06 14:58:50 +0000533 Export E = parseExport(Arg->getValue());
Rui Ueyamaf10a3202015-08-31 08:43:21 +0000534 if (Config->Machine == I386) {
535 if (!isDecorated(E.Name))
536 E.Name = Alloc.save("_" + E.Name);
537 if (!E.ExtName.empty() && !isDecorated(E.ExtName))
538 E.ExtName = Alloc.save("_" + E.ExtName);
539 }
Rafael Espindolab835ae82015-08-06 14:58:50 +0000540 Config->Exports.push_back(E);
Rui Ueyamabbdec4f2015-07-09 22:51:41 +0000541 }
542
543 // Handle /def
544 if (auto *Arg = Args.getLastArg(OPT_deffile)) {
Rafael Espindolab835ae82015-08-06 14:58:50 +0000545 MemoryBufferRef MB = openFile(Arg->getValue());
Rui Ueyamabbdec4f2015-07-09 22:51:41 +0000546 // parseModuleDefs mutates Config object.
Rafael Espindolab835ae82015-08-06 14:58:50 +0000547 parseModuleDefs(MB, &Alloc);
Rui Ueyamabbdec4f2015-07-09 22:51:41 +0000548 }
549
Rui Ueyama6d249082015-07-13 22:31:45 +0000550 // Handle /delayload
551 for (auto *Arg : Args.filtered(OPT_delayload)) {
552 Config->DelayLoads.insert(StringRef(Arg->getValue()).lower());
Rui Ueyama5e706b32015-07-25 21:54:50 +0000553 if (Config->Machine == I386) {
Rui Ueyama6d249082015-07-13 22:31:45 +0000554 Config->DelayLoadHelper = addUndefined("___delayLoadHelper2@8");
Rui Ueyama35ccb0f2015-07-25 00:20:06 +0000555 } else {
556 Config->DelayLoadHelper = addUndefined("__delayLoadHelper2");
Rui Ueyama6d249082015-07-13 22:31:45 +0000557 }
558 }
559
Rui Ueyama5c437cd2015-07-25 21:42:33 +0000560 // Set default image base if /base is not given.
561 if (Config->ImageBase == uint64_t(-1))
562 Config->ImageBase = getDefaultImageBase();
563
Rui Ueyama3cb895c2015-07-24 22:58:44 +0000564 Symtab.addRelative(mangle("__ImageBase"), 0);
Rui Ueyama5e706b32015-07-25 21:54:50 +0000565 if (Config->Machine == I386) {
Rui Ueyamacd3f99b2015-07-24 23:51:14 +0000566 Config->SEHTable = Symtab.addRelative("___safe_se_handler_table", 0);
567 Config->SEHCount = Symtab.addAbsolute("___safe_se_handler_count", 0);
568 }
Rui Ueyamabbdec4f2015-07-09 22:51:41 +0000569
Rui Ueyama107db552015-08-09 21:01:06 +0000570 // We do not support /guard:cf (control flow protection) yet.
571 // Define CFG symbols anyway so that we can link MSVC 2015 CRT.
572 Symtab.addAbsolute(mangle("__guard_fids_table"), 0);
573 Symtab.addAbsolute(mangle("__guard_fids_count"), 0);
574 Symtab.addAbsolute(mangle("__guard_flags"), 0x100);
575
Rui Ueyamaea533cd2015-07-09 19:54:13 +0000576 // Read as much files as we can from directives sections.
Rafael Espindolab835ae82015-08-06 14:58:50 +0000577 Symtab.run();
Rui Ueyama85225b02015-07-02 03:15:15 +0000578
579 // Resolve auxiliary symbols until we get a convergence.
Rui Ueyama573bf7d2015-06-19 21:12:48 +0000580 // (Trying to resolve a symbol may trigger a Lazy symbol to load a new file.
581 // A new file may contain a directive section to add new command line options.
582 // That's why we have to repeat until converge.)
583 for (;;) {
Rui Ueyama6bf638e2015-07-02 00:04:14 +0000584 // Windows specific -- if entry point is not found,
585 // search for its mangled names.
586 if (Config->Entry)
587 Symtab.mangleMaybe(Config->Entry);
588
Rui Ueyama573bf7d2015-06-19 21:12:48 +0000589 // Windows specific -- Make sure we resolve all dllexported symbols.
Rui Ueyama6bf638e2015-07-02 00:04:14 +0000590 for (Export &E : Config->Exports) {
Rui Ueyama84425d72016-01-09 01:22:00 +0000591 if (!E.ForwardTo.empty())
592 continue;
Rui Ueyama6bf638e2015-07-02 00:04:14 +0000593 E.Sym = addUndefined(E.Name);
Rui Ueyamaf10a3202015-08-31 08:43:21 +0000594 if (!E.Directives)
595 Symtab.mangleMaybe(E.Sym);
Rui Ueyama6bf638e2015-07-02 00:04:14 +0000596 }
Rui Ueyama573bf7d2015-06-19 21:12:48 +0000597
598 // Add weak aliases. Weak aliases is a mechanism to give remaining
599 // undefined symbols final chance to be resolved successfully.
Rui Ueyama3d4c69c2015-07-02 02:38:59 +0000600 for (auto Pair : Config->AlternateNames) {
601 StringRef From = Pair.first;
602 StringRef To = Pair.second;
Rui Ueyama458d7442015-07-02 03:59:04 +0000603 Symbol *Sym = Symtab.find(From);
Rui Ueyama3d4c69c2015-07-02 02:38:59 +0000604 if (!Sym)
605 continue;
Rui Ueyama183f53f2015-07-06 17:45:22 +0000606 if (auto *U = dyn_cast<Undefined>(Sym->Body))
Rui Ueyama3d4c69c2015-07-02 02:38:59 +0000607 if (!U->WeakAlias)
608 U->WeakAlias = Symtab.addUndefined(To);
Rui Ueyama2edb35a2015-06-18 19:09:30 +0000609 }
Rui Ueyama573bf7d2015-06-19 21:12:48 +0000610
Rui Ueyamacd3f99b2015-07-24 23:51:14 +0000611 // Windows specific -- if __load_config_used can be resolved, resolve it.
Rui Ueyama8ebdc8c2015-08-07 22:43:53 +0000612 if (Symtab.findUnderscore("_load_config_used"))
613 addUndefined(mangle("_load_config_used"));
Rui Ueyamacd3f99b2015-07-24 23:51:14 +0000614
Rui Ueyama3d4c69c2015-07-02 02:38:59 +0000615 if (Symtab.queueEmpty())
616 break;
Rafael Espindolab835ae82015-08-06 14:58:50 +0000617 Symtab.run();
Rui Ueyama2edb35a2015-06-18 19:09:30 +0000618 }
619
Peter Collingbournedf5783b2015-08-28 22:16:09 +0000620 // Do LTO by compiling bitcode input files to a set of native COFF files then
621 // link those files.
622 Symtab.addCombinedLTOObjects();
Peter Collingbourne60c16162015-06-01 20:10:10 +0000623
Peter Collingbourne2612a322015-07-04 05:28:41 +0000624 // Make sure we have resolved all symbols.
Rafael Espindolab835ae82015-08-06 14:58:50 +0000625 Symtab.reportRemainingUndefines(/*Resolve=*/true);
Peter Collingbourne2612a322015-07-04 05:28:41 +0000626
Rui Ueyama3ee0fe42015-05-31 03:55:46 +0000627 // Windows specific -- if no /subsystem is given, we need to infer
628 // that from entry point name.
629 if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) {
Rui Ueyama97dff9e2015-06-17 00:16:33 +0000630 Config->Subsystem = inferSubsystem();
Rafael Espindolab835ae82015-08-06 14:58:50 +0000631 if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
632 error("subsystem must be defined");
Rui Ueyama3ee0fe42015-05-31 03:55:46 +0000633 }
634
Rui Ueyamaff88d5a2015-07-29 20:25:40 +0000635 // Handle /safeseh.
Rui Ueyama13563d82015-09-15 00:33:11 +0000636 if (Args.hasArg(OPT_safeseh))
637 for (ObjectFile *File : Symtab.ObjectFiles)
638 if (!File->SEHCompat)
639 error("/safeseh: " + File->getName() + " is not compatible with SEH");
Rui Ueyamaff88d5a2015-07-29 20:25:40 +0000640
Rui Ueyama151d8622015-06-17 20:40:43 +0000641 // Windows specific -- when we are creating a .dll file, we also
642 // need to create a .lib file.
Rui Ueyama100ffac2015-09-01 09:15:58 +0000643 if (!Config->Exports.empty() || Config->DLL) {
Rafael Espindolab835ae82015-08-06 14:58:50 +0000644 fixupExports();
645 writeImportLibrary();
Rui Ueyama8765fba2015-07-15 22:21:08 +0000646 assignExportOrdinals();
647 }
Rui Ueyama97dff9e2015-06-17 00:16:33 +0000648
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000649 // Windows specific -- Create a side-by-side manifest file.
650 if (Config->Manifest == Configuration::SideBySide)
Rafael Espindolab835ae82015-08-06 14:58:50 +0000651 createSideBySideManifest();
Rui Ueyama24c5fd02015-06-18 00:12:42 +0000652
Rui Ueyama0fc26d22015-06-29 14:27:12 +0000653 // Create a dummy PDB file to satisfy build sytem rules.
654 if (auto *Arg = Args.getLastArg(OPT_pdb))
Rui Ueyamae7378242015-12-04 23:11:05 +0000655 createPDB(Arg->getValue());
Rui Ueyama0fc26d22015-06-29 14:27:12 +0000656
Rui Ueyamaa5f0f752015-09-19 21:36:28 +0000657 // Identify unreferenced COMDAT sections.
658 if (Config->DoGC)
659 markLive(Symtab.getChunks());
660
661 // Identify identical COMDAT sections to merge them.
662 if (Config->DoICF)
663 doICF(Symtab.getChunks());
664
Rui Ueyama411c63602015-05-28 19:09:30 +0000665 // Write the result.
Rafael Espindolab835ae82015-08-06 14:58:50 +0000666 writeResult(&Symtab);
Peter Collingbournebe549552015-06-26 18:58:24 +0000667
Rui Ueyama016414f2015-06-28 20:07:08 +0000668 // Create a symbol map file containing symbol VAs and their names
669 // to help debugging.
Peter Collingbournebe549552015-06-26 18:58:24 +0000670 if (auto *Arg = Args.getLastArg(OPT_lldmap)) {
671 std::error_code EC;
Peter Collingbournebaf5f872015-06-26 19:20:09 +0000672 llvm::raw_fd_ostream Out(Arg->getValue(), EC, OpenFlags::F_Text);
Rafael Espindolab835ae82015-08-06 14:58:50 +0000673 error(EC, "Could not create the symbol map");
Peter Collingbournebe549552015-06-26 18:58:24 +0000674 Symtab.printMap(Out);
675 }
Rui Ueyamaa51ce712015-07-03 05:31:35 +0000676 // Call exit to avoid calling destructors.
677 exit(0);
Rui Ueyama411c63602015-05-28 19:09:30 +0000678}
679
Rui Ueyama411c63602015-05-28 19:09:30 +0000680} // namespace coff
681} // namespace lld