2020-04-03 02:54:05 +08:00
|
|
|
//===- Config.h -------------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLD_MACHO_CONFIG_H
|
|
|
|
#define LLD_MACHO_CONFIG_H
|
|
|
|
|
2020-05-06 07:37:34 +08:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2020-04-03 02:54:05 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2020-04-29 07:58:22 +08:00
|
|
|
#include "llvm/BinaryFormat/MachO.h"
|
2020-08-11 09:47:16 +08:00
|
|
|
#include "llvm/Support/VersionTuple.h"
|
2020-06-06 10:54:58 +08:00
|
|
|
#include "llvm/TextAPI/MachO/Architecture.h"
|
2020-08-11 09:47:16 +08:00
|
|
|
#include "llvm/TextAPI/MachO/Platform.h"
|
2020-04-03 02:54:05 +08:00
|
|
|
|
2020-04-22 04:37:57 +08:00
|
|
|
#include <vector>
|
|
|
|
|
2020-04-03 02:54:05 +08:00
|
|
|
namespace lld {
|
|
|
|
namespace macho {
|
|
|
|
|
|
|
|
class Symbol;
|
2020-05-06 07:37:34 +08:00
|
|
|
struct SymbolPriorityEntry;
|
2020-04-03 02:54:05 +08:00
|
|
|
|
2020-08-11 09:47:16 +08:00
|
|
|
struct PlatformInfo {
|
|
|
|
llvm::MachO::PlatformKind kind;
|
|
|
|
llvm::VersionTuple minimum;
|
|
|
|
llvm::VersionTuple sdk;
|
|
|
|
};
|
|
|
|
|
2020-04-03 02:54:05 +08:00
|
|
|
struct Configuration {
|
2020-04-29 02:30:57 +08:00
|
|
|
Symbol *entry;
|
2020-04-24 11:16:49 +08:00
|
|
|
bool hasReexports = false;
|
2020-08-26 11:00:42 +08:00
|
|
|
bool allLoad = false;
|
2020-08-19 05:37:04 +08:00
|
|
|
bool forceLoadObjC = false;
|
2020-09-22 04:21:45 +08:00
|
|
|
bool staticLink = false;
|
2020-09-22 02:04:13 +08:00
|
|
|
bool headerPadMaxInstallNames = false;
|
2020-07-31 05:28:45 +08:00
|
|
|
uint32_t headerPad;
|
2020-04-29 07:58:22 +08:00
|
|
|
llvm::StringRef installName;
|
|
|
|
llvm::StringRef outputFile;
|
2020-06-06 10:54:58 +08:00
|
|
|
llvm::MachO::Architecture arch;
|
2020-08-11 09:47:16 +08:00
|
|
|
PlatformInfo platform;
|
2020-04-24 11:16:49 +08:00
|
|
|
llvm::MachO::HeaderFileType outputType;
|
2020-08-14 04:48:47 +08:00
|
|
|
std::vector<llvm::StringRef> systemLibraryRoots;
|
2020-06-18 10:59:27 +08:00
|
|
|
std::vector<llvm::StringRef> librarySearchPaths;
|
|
|
|
std::vector<llvm::StringRef> frameworkSearchPaths;
|
2020-08-13 10:50:28 +08:00
|
|
|
std::vector<llvm::StringRef> runtimePaths;
|
2020-05-06 07:37:34 +08:00
|
|
|
llvm::DenseMap<llvm::StringRef, SymbolPriorityEntry> priorities;
|
|
|
|
};
|
|
|
|
|
|
|
|
// The symbol with the highest priority should be ordered first in the output
|
|
|
|
// section (modulo input section contiguity constraints). Using priority
|
|
|
|
// (highest first) instead of order (lowest first) has the convenient property
|
|
|
|
// that the default-constructed zero priority -- for symbols/sections without a
|
|
|
|
// user-defined order -- naturally ends up putting them at the end of the
|
|
|
|
// output.
|
|
|
|
struct SymbolPriorityEntry {
|
|
|
|
// The priority given to a matching symbol, regardless of which object file
|
|
|
|
// it originated from.
|
|
|
|
size_t anyObjectFile = 0;
|
|
|
|
// The priority given to a matching symbol from a particular object file.
|
|
|
|
llvm::DenseMap<llvm::StringRef, size_t> objectFiles;
|
2020-04-03 02:54:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern Configuration *config;
|
|
|
|
|
|
|
|
} // namespace macho
|
|
|
|
} // namespace lld
|
|
|
|
|
|
|
|
#endif
|