#include "InputFiles.h"
#include "COFFLinkerContext.h"
#include "Chunks.h"
#include "Config.h"
#include "DebugTypes.h"
#include "Driver.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "lld/Common/DWARF.h"
#include "llvm-c/lto.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolDeserializer.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/Native/PDBFile.h"
#include "llvm/IR/Mangler.h"
#include "llvm/LTO/LTO.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/TargetParser/Triple.h"
#include <cstring>
#include <optional>
#include <system_error>
#include <utility>
usingnamespacellvm;
usingnamespacellvm::COFF;
usingnamespacellvm::codeview;
usingnamespacellvm::object;
usingnamespacellvm::support::endian;
usingnamespacelld;
usingnamespacelld::coff;
Triple;
ulittle32_t;
static StringRef getBasename(StringRef path) { … }
std::string lld::toString(const coff::InputFile *file) { … }
static void checkAndSetWeakAlias(COFFLinkerContext &ctx, InputFile *f,
Symbol *source, Symbol *target) { … }
static bool ignoredSymbolName(StringRef name) { … }
ArchiveFile::ArchiveFile(COFFLinkerContext &ctx, MemoryBufferRef m)
: … { … }
void ArchiveFile::parse() { … }
void ArchiveFile::addMember(const Archive::Symbol &sym) { … }
std::vector<MemoryBufferRef> lld::coff::getArchiveMembers(Archive *file) { … }
void ObjFile::parseLazy() { … }
struct ECMapEntry { … };
void ObjFile::initializeECThunks() { … }
void ObjFile::parse() { … }
const coff_section *ObjFile::getSection(uint32_t i) { … }
static SectionChunk *const pendingComdat = …;
void ObjFile::initializeChunks() { … }
SectionChunk *ObjFile::readSection(uint32_t sectionNumber,
const coff_aux_section_definition *def,
StringRef leaderName) { … }
void ObjFile::includeResourceChunks() { … }
void ObjFile::readAssociativeDefinition(
COFFSymbolRef sym, const coff_aux_section_definition *def) { … }
void ObjFile::readAssociativeDefinition(COFFSymbolRef sym,
const coff_aux_section_definition *def,
uint32_t parentIndex) { … }
void ObjFile::recordPrevailingSymbolForMingw(
COFFSymbolRef sym, DenseMap<StringRef, uint32_t> &prevailingSectionMap) { … }
void ObjFile::maybeAssociateSEHForMingw(
COFFSymbolRef sym, const coff_aux_section_definition *def,
const DenseMap<StringRef, uint32_t> &prevailingSectionMap) { … }
Symbol *ObjFile::createRegular(COFFSymbolRef sym) { … }
void ObjFile::initializeSymbols() { … }
Symbol *ObjFile::createUndefined(COFFSymbolRef sym) { … }
static const coff_aux_section_definition *findSectionDef(COFFObjectFile *obj,
int32_t section) { … }
void ObjFile::handleComdatSelection(
COFFSymbolRef sym, COMDATType &selection, bool &prevailing,
DefinedRegular *leader,
const llvm::object::coff_aux_section_definition *def) { … }
std::optional<Symbol *> ObjFile::createDefined(
COFFSymbolRef sym,
std::vector<const coff_aux_section_definition *> &comdatDefs,
bool &prevailing) { … }
MachineTypes ObjFile::getMachineType() const { … }
ArrayRef<uint8_t> ObjFile::getDebugSection(StringRef secName) { … }
void ObjFile::initializeFlags() { … }
void ObjFile::initializeDependencies() { … }
static std::string normalizePdbPath(StringRef path) { … }
static std::optional<std::string>
findPdbPath(StringRef pdbPath, ObjFile *dependentFile, StringRef outputPath) { … }
PDBInputFile::PDBInputFile(COFFLinkerContext &ctx, MemoryBufferRef m)
: … { … }
PDBInputFile::~PDBInputFile() = default;
PDBInputFile *PDBInputFile::findFromRecordPath(const COFFLinkerContext &ctx,
StringRef path,
ObjFile *fromFile) { … }
void PDBInputFile::parse() { … }
std::optional<std::pair<StringRef, uint32_t>>
ObjFile::getVariableLocation(StringRef var) { … }
std::optional<DILineInfo> ObjFile::getDILineInfo(uint32_t offset,
uint32_t sectionIndex) { … }
void ObjFile::enqueuePdbFile(StringRef path, ObjFile *fromFile) { … }
ImportFile::ImportFile(COFFLinkerContext &ctx, MemoryBufferRef m)
: … { … }
MachineTypes ImportFile::getMachineType() const { … }
ImportThunkChunk *ImportFile::makeImportThunk() { … }
void ImportFile::parse() { … }
BitcodeFile::BitcodeFile(COFFLinkerContext &ctx, MemoryBufferRef mb,
StringRef archiveName, uint64_t offsetInArchive,
bool lazy)
: … { … }
BitcodeFile::~BitcodeFile() = default;
void BitcodeFile::parse() { … }
void BitcodeFile::parseLazy() { … }
MachineTypes BitcodeFile::getMachineType() const { … }
std::string lld::coff::replaceThinLTOSuffix(StringRef path, StringRef suffix,
StringRef repl) { … }
static bool isRVACode(COFFObjectFile *coffObj, uint64_t rva, InputFile *file) { … }
void DLLFile::parse() { … }
MachineTypes DLLFile::getMachineType() const { … }
void DLLFile::makeImport(DLLFile::Symbol *s) { … }