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-06-06 10:54:58 +08:00
|
|
|
#include "llvm/TextAPI/MachO/Architecture.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
|
|
|
|
|
|
|
struct Configuration {
|
2020-04-29 02:30:57 +08:00
|
|
|
Symbol *entry;
|
2020-04-24 11:16:49 +08:00
|
|
|
bool hasReexports = false;
|
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-04-24 11:16:49 +08:00
|
|
|
llvm::MachO::HeaderFileType outputType;
|
2020-04-22 04:37:57 +08:00
|
|
|
std::vector<llvm::StringRef> searchPaths;
|
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
|