blob: 2614f07e3ef0f6f99416b6553a03259e164bbcea [file] [log] [blame]
Rui Ueyama411c63602015-05-28 19:09:30 +00001//===- Config.h -----------------------------------------------------------===//
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#ifndef LLD_COFF_CONFIG_H
11#define LLD_COFF_CONFIG_H
12
13#include "llvm/ADT/StringRef.h"
Rui Ueyama3d3e6fb2015-05-29 16:06:00 +000014#include "llvm/Object/COFF.h"
Rui Ueyama411c63602015-05-28 19:09:30 +000015#include <cstdint>
Rui Ueyama8854d8a2015-06-04 19:21:24 +000016#include <map>
Rui Ueyama411c63602015-05-28 19:09:30 +000017#include <set>
18#include <string>
19
20namespace lld {
21namespace coff {
22
Rui Ueyama15cc47e2015-05-29 16:34:31 +000023using llvm::COFF::WindowsSubsystem;
Rui Ueyamad21b00b2015-05-31 19:17:14 +000024using llvm::StringRef;
Rui Ueyama97dff9e2015-06-17 00:16:33 +000025class Defined;
Rui Ueyama15cc47e2015-05-29 16:34:31 +000026
Rui Ueyama97dff9e2015-06-17 00:16:33 +000027// Represents an /export option.
28struct Export {
29 StringRef Name;
30 StringRef ExtName;
31 Defined *Sym = nullptr;
32 uint16_t Ordinal = 0;
33 bool Noname = false;
34 bool Data = false;
35 bool Private = false;
36};
37
38// Global configuration.
39struct Configuration {
Rui Ueyama24c5fd02015-06-18 00:12:42 +000040 enum ManifestKind { SideBySide, Embed, No };
41
Rui Ueyama3d3e6fb2015-05-29 16:06:00 +000042 llvm::COFF::MachineTypes MachineType = llvm::COFF::IMAGE_FILE_MACHINE_AMD64;
Rui Ueyama411c63602015-05-28 19:09:30 +000043 bool Verbose = false;
Rui Ueyama3ee0fe42015-05-31 03:55:46 +000044 WindowsSubsystem Subsystem = llvm::COFF::IMAGE_SUBSYSTEM_UNKNOWN;
Rui Ueyamaeb262ce2015-06-04 02:12:16 +000045 StringRef EntryName;
Rui Ueyamaad660982015-06-07 00:20:32 +000046 std::string OutputFile;
Rui Ueyamae2cbfea2015-06-07 03:17:42 +000047 bool DoGC = true;
Rui Ueyama588e8322015-06-15 01:23:58 +000048 bool Relocatable = true;
Rui Ueyamaeb262ce2015-06-04 02:12:16 +000049
50 // Symbols in this set are considered as live by the garbage collector.
51 std::set<StringRef> GCRoots;
Rui Ueyamab41b7e52015-05-29 16:21:11 +000052
Rui Ueyamad21b00b2015-05-31 19:17:14 +000053 std::set<StringRef> NoDefaultLibs;
54 bool NoDefaultLibAll = false;
55
Rui Ueyama08d5e182015-06-18 23:20:11 +000056 // Used for /include.
57 std::set<StringRef> Includes;
58
Rui Ueyama97dff9e2015-06-17 00:16:33 +000059 // True if we are creating a DLL.
60 bool DLL = false;
Rui Ueyamab95188c2015-06-18 20:27:09 +000061 StringRef Implib;
Rui Ueyama97dff9e2015-06-17 00:16:33 +000062 std::vector<Export> Exports;
63
Rui Ueyama24c5fd02015-06-18 00:12:42 +000064 // Options for manifest files.
65 ManifestKind Manifest = SideBySide;
66 int ManifestID = 1;
67 StringRef ManifestDependency;
68 bool ManifestUAC = true;
69 StringRef ManifestLevel = "'asInvoker'";
70 StringRef ManifestUIAccess = "'false'";
71 StringRef ManifestFile;
72
Rui Ueyama2edb35a2015-06-18 19:09:30 +000073 // Used for /failifmismatch.
Rui Ueyama8854d8a2015-06-04 19:21:24 +000074 std::map<StringRef, StringRef> MustMatch;
75
Rui Ueyama2edb35a2015-06-18 19:09:30 +000076 // Used for /alternatename.
Rui Ueyamae8d56b52015-06-18 23:04:26 +000077 std::map<StringRef, StringRef> AlternateNames;
Rui Ueyama2edb35a2015-06-18 19:09:30 +000078
Rui Ueyama411c63602015-05-28 19:09:30 +000079 uint64_t ImageBase = 0x140000000;
Rui Ueyamab41b7e52015-05-29 16:21:11 +000080 uint64_t StackReserve = 1024 * 1024;
81 uint64_t StackCommit = 4096;
Rui Ueyamac377e9a2015-05-29 16:23:40 +000082 uint64_t HeapReserve = 1024 * 1024;
83 uint64_t HeapCommit = 4096;
Rui Ueyamab9dcdb52015-05-29 16:28:29 +000084 uint32_t MajorImageVersion = 0;
85 uint32_t MinorImageVersion = 0;
Rui Ueyama15cc47e2015-05-29 16:34:31 +000086 uint32_t MajorOSVersion = 6;
87 uint32_t MinorOSVersion = 0;
Rui Ueyama6592ff82015-06-16 23:13:00 +000088 bool DynamicBase = true;
89 bool HighEntropyVA = true;
90 bool AllowBind = true;
91 bool NxCompat = true;
92 bool AllowIsolation = true;
93 bool TerminalServerAware = true;
Rui Ueyama411c63602015-05-28 19:09:30 +000094};
95
96extern Configuration *Config;
97
98} // namespace coff
99} // namespace lld
100
101#endif