2015-05-29 03:09:30 +08:00
|
|
|
//===- Config.h -----------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Linker
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLD_COFF_CONFIG_H
|
|
|
|
#define LLD_COFF_CONFIG_H
|
|
|
|
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
2015-05-30 00:06:00 +08:00
|
|
|
#include "llvm/Object/COFF.h"
|
2015-05-29 03:09:30 +08:00
|
|
|
#include <cstdint>
|
2015-06-05 03:21:24 +08:00
|
|
|
#include <map>
|
2015-05-29 03:09:30 +08:00
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace lld {
|
|
|
|
namespace coff {
|
|
|
|
|
2015-05-30 00:34:31 +08:00
|
|
|
using llvm::COFF::WindowsSubsystem;
|
2015-06-01 03:17:14 +08:00
|
|
|
using llvm::StringRef;
|
2015-07-02 08:04:14 +08:00
|
|
|
class Undefined;
|
2015-05-30 00:34:31 +08:00
|
|
|
|
2015-06-17 08:16:33 +08:00
|
|
|
// Represents an /export option.
|
|
|
|
struct Export {
|
|
|
|
StringRef Name;
|
|
|
|
StringRef ExtName;
|
2015-07-02 08:04:14 +08:00
|
|
|
Undefined *Sym = nullptr;
|
2015-06-17 08:16:33 +08:00
|
|
|
uint16_t Ordinal = 0;
|
|
|
|
bool Noname = false;
|
|
|
|
bool Data = false;
|
|
|
|
bool Private = false;
|
2015-07-04 07:23:29 +08:00
|
|
|
|
|
|
|
bool operator==(const Export &E) {
|
|
|
|
return (Name == E.Name && ExtName == E.ExtName &&
|
|
|
|
Ordinal == E.Ordinal && Noname == E.Noname &&
|
|
|
|
Data == E.Data && Private == E.Private);
|
|
|
|
}
|
2015-06-17 08:16:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// Global configuration.
|
|
|
|
struct Configuration {
|
2015-06-18 08:12:42 +08:00
|
|
|
enum ManifestKind { SideBySide, Embed, No };
|
|
|
|
|
2015-05-30 00:06:00 +08:00
|
|
|
llvm::COFF::MachineTypes MachineType = llvm::COFF::IMAGE_FILE_MACHINE_AMD64;
|
2015-05-29 03:09:30 +08:00
|
|
|
bool Verbose = false;
|
2015-05-31 11:55:46 +08:00
|
|
|
WindowsSubsystem Subsystem = llvm::COFF::IMAGE_SUBSYSTEM_UNKNOWN;
|
2015-07-02 08:04:14 +08:00
|
|
|
Undefined *Entry = nullptr;
|
2015-06-29 03:56:30 +08:00
|
|
|
bool NoEntry = false;
|
2015-06-07 08:20:32 +08:00
|
|
|
std::string OutputFile;
|
2015-06-07 11:17:42 +08:00
|
|
|
bool DoGC = true;
|
2015-06-15 09:23:58 +08:00
|
|
|
bool Relocatable = true;
|
2015-06-29 03:35:15 +08:00
|
|
|
bool Force = false;
|
2015-06-04 10:12:16 +08:00
|
|
|
|
|
|
|
// Symbols in this set are considered as live by the garbage collector.
|
2015-07-02 08:21:08 +08:00
|
|
|
std::set<Undefined *> GCRoot;
|
2015-05-30 00:21:11 +08:00
|
|
|
|
2015-06-01 03:17:14 +08:00
|
|
|
std::set<StringRef> NoDefaultLibs;
|
|
|
|
bool NoDefaultLibAll = false;
|
|
|
|
|
2015-06-17 08:16:33 +08:00
|
|
|
// True if we are creating a DLL.
|
|
|
|
bool DLL = false;
|
2015-06-19 04:27:09 +08:00
|
|
|
StringRef Implib;
|
2015-06-17 08:16:33 +08:00
|
|
|
std::vector<Export> Exports;
|
2015-07-03 09:40:14 +08:00
|
|
|
std::set<std::string> DelayLoads;
|
2015-06-17 08:16:33 +08:00
|
|
|
|
2015-06-24 12:36:52 +08:00
|
|
|
// Used for /opt:icf
|
|
|
|
bool ICF = false;
|
|
|
|
|
2015-06-18 08:12:42 +08:00
|
|
|
// Options for manifest files.
|
|
|
|
ManifestKind Manifest = SideBySide;
|
|
|
|
int ManifestID = 1;
|
|
|
|
StringRef ManifestDependency;
|
|
|
|
bool ManifestUAC = true;
|
|
|
|
StringRef ManifestLevel = "'asInvoker'";
|
|
|
|
StringRef ManifestUIAccess = "'false'";
|
|
|
|
StringRef ManifestFile;
|
|
|
|
|
2015-06-19 03:09:30 +08:00
|
|
|
// Used for /failifmismatch.
|
2015-06-05 03:21:24 +08:00
|
|
|
std::map<StringRef, StringRef> MustMatch;
|
|
|
|
|
2015-06-19 03:09:30 +08:00
|
|
|
// Used for /alternatename.
|
2015-06-19 07:04:26 +08:00
|
|
|
std::map<StringRef, StringRef> AlternateNames;
|
2015-06-19 03:09:30 +08:00
|
|
|
|
2015-07-03 08:02:19 +08:00
|
|
|
uint64_t ImageBase = 0x140000000U;
|
2015-05-30 00:21:11 +08:00
|
|
|
uint64_t StackReserve = 1024 * 1024;
|
|
|
|
uint64_t StackCommit = 4096;
|
2015-05-30 00:23:40 +08:00
|
|
|
uint64_t HeapReserve = 1024 * 1024;
|
|
|
|
uint64_t HeapCommit = 4096;
|
2015-05-30 00:28:29 +08:00
|
|
|
uint32_t MajorImageVersion = 0;
|
|
|
|
uint32_t MinorImageVersion = 0;
|
2015-05-30 00:34:31 +08:00
|
|
|
uint32_t MajorOSVersion = 6;
|
|
|
|
uint32_t MinorOSVersion = 0;
|
2015-06-17 07:13:00 +08:00
|
|
|
bool DynamicBase = true;
|
|
|
|
bool HighEntropyVA = true;
|
|
|
|
bool AllowBind = true;
|
|
|
|
bool NxCompat = true;
|
|
|
|
bool AllowIsolation = true;
|
|
|
|
bool TerminalServerAware = true;
|
2015-05-29 03:09:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern Configuration *Config;
|
|
|
|
|
|
|
|
} // namespace coff
|
|
|
|
} // namespace lld
|
|
|
|
|
|
|
|
#endif
|