#include "SymbolTable.h"
#include "Config.h"
#include "InputChunks.h"
#include "InputElement.h"
#include "WriterUtils.h"
#include "lld/Common/CommonLinkerContext.h"
#include <optional>
#define DEBUG_TYPE …
usingnamespacellvm;
usingnamespacellvm::wasm;
usingnamespacellvm::object;
namespace lld::wasm {
SymbolTable *symtab;
void SymbolTable::addFile(InputFile *file, StringRef symName) { … }
void SymbolTable::compileBitcodeFiles() { … }
Symbol *SymbolTable::find(StringRef name) { … }
void SymbolTable::replace(StringRef name, Symbol* sym) { … }
std::pair<Symbol *, bool> SymbolTable::insertName(StringRef name) { … }
std::pair<Symbol *, bool> SymbolTable::insert(StringRef name,
const InputFile *file) { … }
static void reportTypeError(const Symbol *existing, const InputFile *file,
llvm::wasm::WasmSymbolType type) { … }
static bool signatureMatches(FunctionSymbol *existing,
const WasmSignature *newSig) { … }
static void checkGlobalType(const Symbol *existing, const InputFile *file,
const WasmGlobalType *newType) { … }
static void checkTagType(const Symbol *existing, const InputFile *file,
const WasmSignature *newSig) { … }
static void checkTableType(const Symbol *existing, const InputFile *file,
const WasmTableType *newType) { … }
static void checkDataType(const Symbol *existing, const InputFile *file) { … }
DefinedFunction *SymbolTable::addSyntheticFunction(StringRef name,
uint32_t flags,
InputFunction *function) { … }
DefinedData *SymbolTable::addOptionalDataSymbol(StringRef name,
uint64_t value) { … }
DefinedData *SymbolTable::addSyntheticDataSymbol(StringRef name,
uint32_t flags) { … }
DefinedGlobal *SymbolTable::addSyntheticGlobal(StringRef name, uint32_t flags,
InputGlobal *global) { … }
DefinedGlobal *SymbolTable::addOptionalGlobalSymbol(StringRef name,
InputGlobal *global) { … }
DefinedTable *SymbolTable::addSyntheticTable(StringRef name, uint32_t flags,
InputTable *table) { … }
static bool shouldReplace(const Symbol *existing, InputFile *newFile,
uint32_t newFlags) { … }
static void reportFunctionSignatureMismatch(StringRef symName,
FunctionSymbol *sym,
const WasmSignature *signature,
InputFile *file,
bool isError = true) { … }
static void reportFunctionSignatureMismatch(StringRef symName,
FunctionSymbol *a,
FunctionSymbol *b,
bool isError = true) { … }
Symbol *SymbolTable::addSharedFunction(StringRef name, uint32_t flags,
InputFile *file,
const WasmSignature *sig) { … }
Symbol *SymbolTable::addSharedData(StringRef name, uint32_t flags,
InputFile *file) { … }
Symbol *SymbolTable::addDefinedFunction(StringRef name, uint32_t flags,
InputFile *file,
InputFunction *function) { … }
Symbol *SymbolTable::addDefinedData(StringRef name, uint32_t flags,
InputFile *file, InputChunk *segment,
uint64_t address, uint64_t size) { … }
Symbol *SymbolTable::addDefinedGlobal(StringRef name, uint32_t flags,
InputFile *file, InputGlobal *global) { … }
Symbol *SymbolTable::addDefinedTag(StringRef name, uint32_t flags,
InputFile *file, InputTag *tag) { … }
Symbol *SymbolTable::addDefinedTable(StringRef name, uint32_t flags,
InputFile *file, InputTable *table) { … }
template <typename T>
static void setImportAttributes(T *existing,
std::optional<StringRef> importName,
std::optional<StringRef> importModule,
uint32_t flags, InputFile *file) { … }
Symbol *SymbolTable::addUndefinedFunction(StringRef name,
std::optional<StringRef> importName,
std::optional<StringRef> importModule,
uint32_t flags, InputFile *file,
const WasmSignature *sig,
bool isCalledDirectly) { … }
Symbol *SymbolTable::addUndefinedData(StringRef name, uint32_t flags,
InputFile *file) { … }
Symbol *SymbolTable::addUndefinedGlobal(StringRef name,
std::optional<StringRef> importName,
std::optional<StringRef> importModule,
uint32_t flags, InputFile *file,
const WasmGlobalType *type) { … }
Symbol *SymbolTable::addUndefinedTable(StringRef name,
std::optional<StringRef> importName,
std::optional<StringRef> importModule,
uint32_t flags, InputFile *file,
const WasmTableType *type) { … }
Symbol *SymbolTable::addUndefinedTag(StringRef name,
std::optional<StringRef> importName,
std::optional<StringRef> importModule,
uint32_t flags, InputFile *file,
const WasmSignature *sig) { … }
TableSymbol *SymbolTable::createUndefinedIndirectFunctionTable(StringRef name) { … }
TableSymbol *SymbolTable::createDefinedIndirectFunctionTable(StringRef name) { … }
TableSymbol *SymbolTable::resolveIndirectFunctionTable(bool required) { … }
void SymbolTable::addLazy(StringRef name, InputFile *file) { … }
bool SymbolTable::addComdat(StringRef name) { … }
bool SymbolTable::getFunctionVariant(Symbol* sym, const WasmSignature *sig,
const InputFile *file, Symbol **out) { … }
void SymbolTable::trace(StringRef name) { … }
void SymbolTable::wrap(Symbol *sym, Symbol *real, Symbol *wrap) { … }
static const uint8_t unreachableFn[] = …;
InputFunction *SymbolTable::replaceWithUnreachable(Symbol *sym,
const WasmSignature &sig,
StringRef debugName) { … }
void SymbolTable::replaceWithUndefined(Symbol *sym) { … }
void SymbolTable::handleWeakUndefines() { … }
DefinedFunction *SymbolTable::createUndefinedStub(const WasmSignature &sig) { … }
void SymbolTable::handleSymbolVariants() { … }
}