1 //===- Config.h -------------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_MACHO_CONFIG_H
10 #define LLD_MACHO_CONFIG_H
12 #include "llvm/ADT/DenseMap.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/BinaryFormat/MachO.h"
15 #include "llvm/Support/VersionTuple.h"
16 #include "llvm/TextAPI/MachO/Architecture.h"
17 #include "llvm/TextAPI/MachO/Platform.h"
25 struct SymbolPriorityEntry;
28 llvm::MachO::PlatformKind kind;
29 llvm::VersionTuple minimum;
30 llvm::VersionTuple sdk;
33 enum class UndefinedSymbolTreatment {
41 struct Configuration {
43 bool hasReexports = false;
45 bool forceLoadObjC = false;
46 bool staticLink = false;
47 bool implicitDylibs = false;
49 bool headerPadMaxInstallNames = false;
50 bool ltoNewPassManager = LLVM_ENABLE_NEW_PASS_MANAGER;
51 bool printEachFile = false;
52 bool printWhyLoad = false;
53 bool searchDylibsFirst = false;
54 bool saveTemps = false;
56 uint32_t dylibCompatibilityVersion = 0;
57 uint32_t dylibCurrentVersion = 0;
58 llvm::StringRef installName;
59 llvm::StringRef outputFile;
60 llvm::StringRef ltoObjPath;
61 bool demangle = false;
62 llvm::MachO::Architecture arch;
63 PlatformInfo platform;
64 UndefinedSymbolTreatment undefinedSymbolTreatment =
65 UndefinedSymbolTreatment::error;
66 llvm::MachO::HeaderFileType outputType;
67 std::vector<llvm::StringRef> systemLibraryRoots;
68 std::vector<llvm::StringRef> librarySearchPaths;
69 std::vector<llvm::StringRef> frameworkSearchPaths;
70 std::vector<llvm::StringRef> runtimePaths;
71 llvm::DenseMap<llvm::StringRef, SymbolPriorityEntry> priorities;
74 // The symbol with the highest priority should be ordered first in the output
75 // section (modulo input section contiguity constraints). Using priority
76 // (highest first) instead of order (lowest first) has the convenient property
77 // that the default-constructed zero priority -- for symbols/sections without a
78 // user-defined order -- naturally ends up putting them at the end of the
80 struct SymbolPriorityEntry {
81 // The priority given to a matching symbol, regardless of which object file
82 // it originated from.
83 size_t anyObjectFile = 0;
84 // The priority given to a matching symbol from a particular object file.
85 llvm::DenseMap<llvm::StringRef, size_t> objectFiles;
88 extern Configuration *config;