llvm/lld/COFF/SymbolTable.cpp

//===- SymbolTable.cpp ----------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "SymbolTable.h"
#include "COFFLinkerContext.h"
#include "Config.h"
#include "Driver.h"
#include "LTO.h"
#include "PDB.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Timer.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/LTO/LTO.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/raw_ostream.h"
#include <utility>

usingnamespacellvm;

namespace lld::coff {

StringRef ltrim1(StringRef s, const char *chars) {}

static bool compatibleMachineType(COFFLinkerContext &ctx, MachineTypes mt) {}

void SymbolTable::addFile(InputFile *file) {}

static void errorOrWarn(const Twine &s, bool forceUnresolved) {}

// Causes the file associated with a lazy symbol to be linked in.
static void forceLazy(Symbol *s) {}

// Returns the symbol in SC whose value is <= Addr that is closest to Addr.
// This is generally the global variable or function whose definition contains
// Addr.
static Symbol *getSymbol(SectionChunk *sc, uint32_t addr) {}

static std::vector<std::string> getSymbolLocations(BitcodeFile *file) {}

static std::optional<std::pair<StringRef, uint32_t>>
getFileLineDwarf(const SectionChunk *c, uint32_t addr) {}

static std::optional<std::pair<StringRef, uint32_t>>
getFileLine(const SectionChunk *c, uint32_t addr) {}

// Given a file and the index of a symbol in that file, returns a description
// of all references to that symbol from that file. If no debug information is
// available, returns just the name of the file, else one string per actual
// reference as described in the debug info.
// Returns up to maxStrings string descriptions, along with the total number of
// locations found.
static std::pair<std::vector<std::string>, size_t>
getSymbolLocations(ObjFile *file, uint32_t symIndex, size_t maxStrings) {}

std::vector<std::string> getSymbolLocations(ObjFile *file, uint32_t symIndex) {}

static std::pair<std::vector<std::string>, size_t>
getSymbolLocations(InputFile *file, uint32_t symIndex, size_t maxStrings) {}

// For an undefined symbol, stores all files referencing it and the index of
// the undefined symbol in each file.
struct UndefinedDiag {};

static void reportUndefinedSymbol(const COFFLinkerContext &ctx,
                                  const UndefinedDiag &undefDiag) {}

void SymbolTable::loadMinGWSymbols() {}

Defined *SymbolTable::impSymbol(StringRef name) {}

bool SymbolTable::handleMinGWAutomaticImport(Symbol *sym, StringRef name) {}

/// Helper function for reportUnresolvable and resolveRemainingUndefines.
/// This function emits an "undefined symbol" diagnostic for each symbol in
/// undefs. If localImports is not nullptr, it also emits a "locally
/// defined symbol imported" diagnostic for symbols in localImports.
/// objFiles and bitcodeFiles (if not nullptr) are used to report where
/// undefined symbols are referenced.
static void reportProblemSymbols(
    const COFFLinkerContext &ctx, const SmallPtrSetImpl<Symbol *> &undefs,
    const DenseMap<Symbol *, Symbol *> *localImports, bool needBitcodeFiles) {}

void SymbolTable::reportUnresolvable() {}

void SymbolTable::resolveRemainingUndefines() {}

std::pair<Symbol *, bool> SymbolTable::insert(StringRef name) {}

std::pair<Symbol *, bool> SymbolTable::insert(StringRef name, InputFile *file) {}

void SymbolTable::addEntryThunk(Symbol *from, Symbol *to) {}

void SymbolTable::initializeEntryThunks() {}

Symbol *SymbolTable::addUndefined(StringRef name, InputFile *f,
                                  bool isWeakAlias) {}

void SymbolTable::addLazyArchive(ArchiveFile *f, const Archive::Symbol &sym) {}

void SymbolTable::addLazyObject(InputFile *f, StringRef n) {}

void SymbolTable::addLazyDLLSymbol(DLLFile *f, DLLFile::Symbol *sym,
                                   StringRef n) {}

static std::string getSourceLocationBitcode(BitcodeFile *file) {}

static std::string getSourceLocationObj(ObjFile *file, SectionChunk *sc,
                                        uint32_t offset, StringRef name) {}

static std::string getSourceLocation(InputFile *file, SectionChunk *sc,
                                     uint32_t offset, StringRef name) {}

// Construct and print an error message in the form of:
//
//   lld-link: error: duplicate symbol: foo
//   >>> defined at bar.c:30
//   >>>            bar.o
//   >>> defined at baz.c:563
//   >>>            baz.o
void SymbolTable::reportDuplicate(Symbol *existing, InputFile *newFile,
                                  SectionChunk *newSc,
                                  uint32_t newSectionOffset) {}

Symbol *SymbolTable::addAbsolute(StringRef n, COFFSymbolRef sym) {}

Symbol *SymbolTable::addAbsolute(StringRef n, uint64_t va) {}

Symbol *SymbolTable::addSynthetic(StringRef n, Chunk *c) {}

Symbol *SymbolTable::addRegular(InputFile *f, StringRef n,
                                const coff_symbol_generic *sym, SectionChunk *c,
                                uint32_t sectionOffset, bool isWeak) {}

std::pair<DefinedRegular *, bool>
SymbolTable::addComdat(InputFile *f, StringRef n,
                       const coff_symbol_generic *sym) {}

Symbol *SymbolTable::addCommon(InputFile *f, StringRef n, uint64_t size,
                               const coff_symbol_generic *sym, CommonChunk *c) {}

Symbol *SymbolTable::addImportData(StringRef n, ImportFile *f) {}

Symbol *SymbolTable::addImportThunk(StringRef name, DefinedImportData *id,
                                    uint16_t machine) {}

void SymbolTable::addLibcall(StringRef name) {}

std::vector<Chunk *> SymbolTable::getChunks() const {}

Symbol *SymbolTable::find(StringRef name) const {}

Symbol *SymbolTable::findUnderscore(StringRef name) const {}

// Return all symbols that start with Prefix, possibly ignoring the first
// character of Prefix or the first character symbol.
std::vector<Symbol *> SymbolTable::getSymsWithPrefix(StringRef prefix) {}

Symbol *SymbolTable::findMangle(StringRef name) {}

Symbol *SymbolTable::addUndefined(StringRef name) {}

void SymbolTable::compileBitcodeFiles() {}

} // namespace lld::coff