| Rui Ueyama | 411c6360 | 2015-05-28 19:09:30 +0000 | [diff] [blame] | 1 | //===- 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 Ueyama | 3d3e6fb | 2015-05-29 16:06:00 +0000 | [diff] [blame] | 14 | #include "llvm/Object/COFF.h" | 
| Rui Ueyama | 411c6360 | 2015-05-28 19:09:30 +0000 | [diff] [blame] | 15 | #include <cstdint> | 
| Rui Ueyama | 8854d8a | 2015-06-04 19:21:24 +0000 | [diff] [blame] | 16 | #include <map> | 
| Rui Ueyama | 411c6360 | 2015-05-28 19:09:30 +0000 | [diff] [blame] | 17 | #include <set> | 
|  | 18 | #include <string> | 
|  | 19 |  | 
|  | 20 | namespace lld { | 
|  | 21 | namespace coff { | 
|  | 22 |  | 
| Rui Ueyama | 15cc47e | 2015-05-29 16:34:31 +0000 | [diff] [blame] | 23 | using llvm::COFF::WindowsSubsystem; | 
| Rui Ueyama | d21b00b | 2015-05-31 19:17:14 +0000 | [diff] [blame] | 24 | using llvm::StringRef; | 
| Rui Ueyama | 6bf638e | 2015-07-02 00:04:14 +0000 | [diff] [blame] | 25 | class Undefined; | 
| Rui Ueyama | 15cc47e | 2015-05-29 16:34:31 +0000 | [diff] [blame] | 26 |  | 
| Rui Ueyama | 97dff9e | 2015-06-17 00:16:33 +0000 | [diff] [blame] | 27 | // Represents an /export option. | 
|  | 28 | struct Export { | 
|  | 29 | StringRef Name; | 
|  | 30 | StringRef ExtName; | 
| Rui Ueyama | 6bf638e | 2015-07-02 00:04:14 +0000 | [diff] [blame] | 31 | Undefined *Sym = nullptr; | 
| Rui Ueyama | 97dff9e | 2015-06-17 00:16:33 +0000 | [diff] [blame] | 32 | uint16_t Ordinal = 0; | 
|  | 33 | bool Noname = false; | 
|  | 34 | bool Data = false; | 
|  | 35 | bool Private = false; | 
|  | 36 | }; | 
|  | 37 |  | 
|  | 38 | // Global configuration. | 
|  | 39 | struct Configuration { | 
| Rui Ueyama | 24c5fd0 | 2015-06-18 00:12:42 +0000 | [diff] [blame] | 40 | enum ManifestKind { SideBySide, Embed, No }; | 
|  | 41 |  | 
| Rui Ueyama | 3d3e6fb | 2015-05-29 16:06:00 +0000 | [diff] [blame] | 42 | llvm::COFF::MachineTypes MachineType = llvm::COFF::IMAGE_FILE_MACHINE_AMD64; | 
| Rui Ueyama | 411c6360 | 2015-05-28 19:09:30 +0000 | [diff] [blame] | 43 | bool Verbose = false; | 
| Rui Ueyama | 3ee0fe4 | 2015-05-31 03:55:46 +0000 | [diff] [blame] | 44 | WindowsSubsystem Subsystem = llvm::COFF::IMAGE_SUBSYSTEM_UNKNOWN; | 
| Rui Ueyama | 6bf638e | 2015-07-02 00:04:14 +0000 | [diff] [blame] | 45 | Undefined *Entry = nullptr; | 
| Rui Ueyama | a8b6045 | 2015-06-28 19:56:30 +0000 | [diff] [blame] | 46 | bool NoEntry = false; | 
| Rui Ueyama | ad66098 | 2015-06-07 00:20:32 +0000 | [diff] [blame] | 47 | std::string OutputFile; | 
| Rui Ueyama | e2cbfea | 2015-06-07 03:17:42 +0000 | [diff] [blame] | 48 | bool DoGC = true; | 
| Rui Ueyama | 588e832 | 2015-06-15 01:23:58 +0000 | [diff] [blame] | 49 | bool Relocatable = true; | 
| Rui Ueyama | 95925fd | 2015-06-28 19:35:15 +0000 | [diff] [blame] | 50 | bool Force = false; | 
| Rui Ueyama | eb262ce | 2015-06-04 02:12:16 +0000 | [diff] [blame] | 51 |  | 
|  | 52 | // Symbols in this set are considered as live by the garbage collector. | 
| Rui Ueyama | 18f8d2c | 2015-07-02 00:21:08 +0000 | [diff] [blame] | 53 | std::set<Undefined *> GCRoot; | 
| Rui Ueyama | b41b7e5 | 2015-05-29 16:21:11 +0000 | [diff] [blame] | 54 |  | 
| Rui Ueyama | d21b00b | 2015-05-31 19:17:14 +0000 | [diff] [blame] | 55 | std::set<StringRef> NoDefaultLibs; | 
|  | 56 | bool NoDefaultLibAll = false; | 
|  | 57 |  | 
| Rui Ueyama | 97dff9e | 2015-06-17 00:16:33 +0000 | [diff] [blame] | 58 | // True if we are creating a DLL. | 
|  | 59 | bool DLL = false; | 
| Rui Ueyama | b95188c | 2015-06-18 20:27:09 +0000 | [diff] [blame] | 60 | StringRef Implib; | 
| Rui Ueyama | 97dff9e | 2015-06-17 00:16:33 +0000 | [diff] [blame] | 61 | std::vector<Export> Exports; | 
| Rui Ueyama | a77336b | 2015-06-21 22:31:52 +0000 | [diff] [blame] | 62 | std::set<StringRef> DelayLoads; | 
| Rui Ueyama | 97dff9e | 2015-06-17 00:16:33 +0000 | [diff] [blame] | 63 |  | 
| Rui Ueyama | ddf71fc | 2015-06-24 04:36:52 +0000 | [diff] [blame] | 64 | // Used for /opt:icf | 
|  | 65 | bool ICF = false; | 
|  | 66 |  | 
| Rui Ueyama | 24c5fd0 | 2015-06-18 00:12:42 +0000 | [diff] [blame] | 67 | // Options for manifest files. | 
|  | 68 | ManifestKind Manifest = SideBySide; | 
|  | 69 | int ManifestID = 1; | 
|  | 70 | StringRef ManifestDependency; | 
|  | 71 | bool ManifestUAC = true; | 
|  | 72 | StringRef ManifestLevel = "'asInvoker'"; | 
|  | 73 | StringRef ManifestUIAccess = "'false'"; | 
|  | 74 | StringRef ManifestFile; | 
|  | 75 |  | 
| Rui Ueyama | 2edb35a | 2015-06-18 19:09:30 +0000 | [diff] [blame] | 76 | // Used for /failifmismatch. | 
| Rui Ueyama | 8854d8a | 2015-06-04 19:21:24 +0000 | [diff] [blame] | 77 | std::map<StringRef, StringRef> MustMatch; | 
|  | 78 |  | 
| Rui Ueyama | 2edb35a | 2015-06-18 19:09:30 +0000 | [diff] [blame] | 79 | // Used for /alternatename. | 
| Rui Ueyama | e8d56b5 | 2015-06-18 23:04:26 +0000 | [diff] [blame] | 80 | std::map<StringRef, StringRef> AlternateNames; | 
| Rui Ueyama | 2edb35a | 2015-06-18 19:09:30 +0000 | [diff] [blame] | 81 |  | 
| Rui Ueyama | 49d6cd3 | 2015-07-03 00:02:19 +0000 | [diff] [blame^] | 82 | uint64_t ImageBase = 0x140000000U; | 
| Rui Ueyama | b41b7e5 | 2015-05-29 16:21:11 +0000 | [diff] [blame] | 83 | uint64_t StackReserve = 1024 * 1024; | 
|  | 84 | uint64_t StackCommit = 4096; | 
| Rui Ueyama | c377e9a | 2015-05-29 16:23:40 +0000 | [diff] [blame] | 85 | uint64_t HeapReserve = 1024 * 1024; | 
|  | 86 | uint64_t HeapCommit = 4096; | 
| Rui Ueyama | b9dcdb5 | 2015-05-29 16:28:29 +0000 | [diff] [blame] | 87 | uint32_t MajorImageVersion = 0; | 
|  | 88 | uint32_t MinorImageVersion = 0; | 
| Rui Ueyama | 15cc47e | 2015-05-29 16:34:31 +0000 | [diff] [blame] | 89 | uint32_t MajorOSVersion = 6; | 
|  | 90 | uint32_t MinorOSVersion = 0; | 
| Rui Ueyama | 6592ff8 | 2015-06-16 23:13:00 +0000 | [diff] [blame] | 91 | bool DynamicBase = true; | 
|  | 92 | bool HighEntropyVA = true; | 
|  | 93 | bool AllowBind = true; | 
|  | 94 | bool NxCompat = true; | 
|  | 95 | bool AllowIsolation = true; | 
|  | 96 | bool TerminalServerAware = true; | 
| Rui Ueyama | 411c6360 | 2015-05-28 19:09:30 +0000 | [diff] [blame] | 97 | }; | 
|  | 98 |  | 
|  | 99 | extern Configuration *Config; | 
|  | 100 |  | 
|  | 101 | } // namespace coff | 
|  | 102 | } // namespace lld | 
|  | 103 |  | 
|  | 104 | #endif |