1 //===- Config.h -------------------------------------------------*- C++ -*-===//
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLD_ELF_CONFIG_H
11 #define LLD_ELF_CONFIG_H
13 #include "llvm/ADT/MapVector.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/ELF.h"
33 enum class BuildIdKind { None, Fnv1, Md5, Sha1, Hexstring };
35 enum class UnresolvedPolicy { NoUndef, Error, Warn, Ignore };
37 struct SymbolVersion {
42 // This struct contains symbols version definition that
43 // can be found in version script if it is used for link.
44 struct VersionDefinition {
45 VersionDefinition(llvm::StringRef Name, size_t Id) : Name(Name), Id(Id) {}
48 std::vector<SymbolVersion> Globals;
49 size_t NameOff; // Offset in string table.
52 // This struct contains the global configuration for the linker.
53 // Most fields are direct mapping from the command line options
54 // and such fields have the same name as the corresponding options.
55 // Most fields are initialized by the driver.
56 struct Configuration {
57 Symbol *EntrySym = nullptr;
58 InputFile *FirstElf = nullptr;
59 llvm::StringRef DynamicLinker;
60 llvm::StringRef Entry;
61 llvm::StringRef Emulation;
64 llvm::StringRef LtoAAPipeline;
65 llvm::StringRef LtoNewPmPasses;
66 llvm::StringRef OutputFile;
67 llvm::StringRef SoName;
68 llvm::StringRef Sysroot;
70 std::vector<VersionDefinition> VersionDefinitions;
71 std::vector<llvm::StringRef> DynamicList;
72 std::vector<llvm::StringRef> SearchPaths;
73 std::vector<llvm::StringRef> Undefined;
74 std::vector<SymbolVersion> VersionScriptGlobals;
75 std::vector<uint8_t> BuildIdVector;
76 bool AllowMultipleDefinition;
77 bool AsNeeded = false;
79 bool BsymbolicFunctions;
92 bool Mips64EL = false;
94 bool NoUndefinedVersion;
105 bool SysvHash = true;
116 UnresolvedPolicy UnresolvedSymbols;
117 BuildIdKind BuildId = BuildIdKind::None;
118 ELFKind EKind = ELFNoneKind;
119 uint16_t DefaultSymbolVersion = llvm::ELF::VER_NDX_GLOBAL;
120 uint16_t EMachine = llvm::ELF::EM_NONE;
121 uint64_t EntryAddr = -1;
128 // The only instance of Configuration struct.
129 extern Configuration *Config;