#include "InputFiles.h"
#include "Config.h"
#include "DWARF.h"
#include "Driver.h"
#include "InputSection.h"
#include "LinkerScript.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "lld/Common/CommonLinkerContext.h"
#include "lld/Common/DWARF.h"
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/LTO/LTO.h"
#include "llvm/Object/IRObjectFile.h"
#include "llvm/Support/ARMAttributeParser.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/RISCVAttributeParser.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
usingnamespacellvm;
usingnamespacellvm::ELF;
usingnamespacellvm::object;
usingnamespacellvm::sys;
usingnamespacellvm::sys::fs;
usingnamespacellvm::support::endian;
usingnamespacelld;
usingnamespacelld::elf;
extern template void ObjFile<ELF32LE>::importCmseSymbols();
extern template void ObjFile<ELF32BE>::importCmseSymbols();
extern template void ObjFile<ELF64LE>::importCmseSymbols();
extern template void ObjFile<ELF64BE>::importCmseSymbols();
std::string lld::toString(const InputFile *f) { … }
static ELFKind getELFKind(MemoryBufferRef mb, StringRef archiveName) { … }
static void updateARMVFPArgs(Ctx &ctx, const ARMAttributeParser &attributes,
const InputFile *f) { … }
static void updateSupportedARMFeatures(Ctx &ctx,
const ARMAttributeParser &attributes) { … }
InputFile::InputFile(Ctx &ctx, Kind k, MemoryBufferRef m)
: … { … }
std::optional<MemoryBufferRef> elf::readFile(Ctx &ctx, StringRef path) { … }
static bool isCompatible(Ctx &ctx, InputFile *file) { … }
template <class ELFT> static void doParseFile(Ctx &ctx, InputFile *file) { … }
void elf::parseFile(Ctx &ctx, InputFile *file) { … }
extern template void ObjFile<ELF32LE>::importCmseSymbols();
extern template void ObjFile<ELF32BE>::importCmseSymbols();
extern template void ObjFile<ELF64LE>::importCmseSymbols();
extern template void ObjFile<ELF64BE>::importCmseSymbols();
template <class ELFT>
static void doParseFiles(Ctx &ctx, const std::vector<InputFile *> &files) { … }
void elf::parseFiles(Ctx &ctx, const std::vector<InputFile *> &files) { … }
static std::string createFileLineMsg(StringRef path, unsigned line) { … }
template <class ELFT>
static std::string getSrcMsgAux(ObjFile<ELFT> &file, const Symbol &sym,
const InputSectionBase &sec, uint64_t offset) { … }
std::string InputFile::getSrcMsg(const Symbol &sym, const InputSectionBase &sec,
uint64_t offset) { … }
StringRef InputFile::getNameForScript() const { … }
static void addDependentLibrary(Ctx &ctx, StringRef specifier,
const InputFile *f) { … }
template <class ELFT>
static void handleSectionGroup(ArrayRef<InputSectionBase *> sections,
ArrayRef<typename ELFT::Word> entries) { … }
template <class ELFT> DWARFCache *ObjFile<ELFT>::getDwarf() { … }
template <class ELFT>
std::optional<std::pair<std::string, unsigned>>
ObjFile<ELFT>::getVariableLoc(StringRef name) { … }
template <class ELFT>
std::optional<DILineInfo>
ObjFile<ELFT>::getDILineInfo(const InputSectionBase *s, uint64_t offset) { … }
ELFFileBase::ELFFileBase(Ctx &ctx, Kind k, ELFKind ekind, MemoryBufferRef mb)
: … { … }
template <typename Elf_Shdr>
static const Elf_Shdr *findSection(ArrayRef<Elf_Shdr> sections, uint32_t type) { … }
void ELFFileBase::init() { … }
template <class ELFT> void ELFFileBase::init(InputFile::Kind k) { … }
template <class ELFT>
uint32_t ObjFile<ELFT>::getSectionIndex(const Elf_Sym &sym) const { … }
template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) { … }
template <class ELFT>
StringRef ObjFile<ELFT>::getShtGroupSignature(ArrayRef<Elf_Shdr> sections,
const Elf_Shdr &sec) { … }
template <class ELFT>
bool ObjFile<ELFT>::shouldMerge(const Elf_Shdr &sec, StringRef name) { … }
template <class ELFT> void ObjFile<ELFT>::initializeJustSymbols() { … }
static bool isKnownSpecificSectionType(uint32_t t, uint32_t flags) { … }
template <class ELFT>
void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
const llvm::object::ELFFile<ELFT> &obj) { … }
template <class ELFT>
static void readGnuProperty(Ctx &ctx, const InputSection &sec,
ObjFile<ELFT> &f) { … }
template <class ELFT>
InputSectionBase *ObjFile<ELFT>::getRelocTarget(uint32_t idx, uint32_t info) { … }
template <class ELFT>
InputSectionBase *ObjFile<ELFT>::createInputSection(uint32_t idx,
const Elf_Shdr &sec,
StringRef name) { … }
template <class ELFT>
void ObjFile<ELFT>::initializeSymbols(const object::ELFFile<ELFT> &obj) { … }
template <class ELFT>
void ObjFile<ELFT>::initSectionsAndLocalSyms(bool ignoreComdats) { … }
template <class ELFT> void ObjFile<ELFT>::postParse() { … }
static bool isBitcodeNonCommonDef(MemoryBufferRef mb, StringRef symName,
StringRef archiveName) { … }
template <class ELFT>
static bool isNonCommonDef(ELFKind ekind, MemoryBufferRef mb, StringRef symName,
StringRef archiveName) { … }
static bool isNonCommonDef(MemoryBufferRef mb, StringRef symName,
StringRef archiveName) { … }
unsigned SharedFile::vernauxNum;
SharedFile::SharedFile(Ctx &ctx, MemoryBufferRef m, StringRef defaultSoName)
: … { … }
template <typename ELFT>
static SmallVector<const void *, 0>
parseVerdefs(const uint8_t *base, const typename ELFT::Shdr *sec) { … }
template <typename ELFT>
std::vector<uint32_t> SharedFile::parseVerneed(const ELFFile<ELFT> &obj,
const typename ELFT::Shdr *sec) { … }
template <typename ELFT>
static uint64_t getAlignment(ArrayRef<typename ELFT::Shdr> sections,
const typename ELFT::Sym &sym) { … }
template <class ELFT> void SharedFile::parse() { … }
static ELFKind getBitcodeELFKind(const Triple &t) { … }
static uint16_t getBitcodeMachineKind(StringRef path, const Triple &t) { … }
static uint8_t getOsAbi(const Triple &t) { … }
BitcodeFile::BitcodeFile(Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
uint64_t offsetInArchive, bool lazy)
: … { … }
static uint8_t mapVisibility(GlobalValue::VisibilityTypes gvVisibility) { … }
static void createBitcodeSymbol(Ctx &ctx, Symbol *&sym,
const std::vector<bool> &keptComdats,
const lto::InputFile::Symbol &objSym,
BitcodeFile &f) { … }
void BitcodeFile::parse() { … }
void BitcodeFile::parseLazy() { … }
void BitcodeFile::postParse() { … }
void BinaryFile::parse() { … }
InputFile *elf::createInternalFile(Ctx &ctx, StringRef name) { … }
ELFFileBase *elf::createObjFile(Ctx &ctx, MemoryBufferRef mb,
StringRef archiveName, bool lazy) { … }
template <class ELFT> void ObjFile<ELFT>::parseLazy() { … }
bool InputFile::shouldExtractForCommon(StringRef name) const { … }
std::string elf::replaceThinLTOSuffix(Ctx &ctx, StringRef path) { … }
template class elf::ObjFile<ELF32LE>;
template class elf::ObjFile<ELF32BE>;
template class elf::ObjFile<ELF64LE>;
template class elf::ObjFile<ELF64BE>;
template void SharedFile::parse<ELF32LE>();
template void SharedFile::parse<ELF32BE>();
template void SharedFile::parse<ELF64LE>();
template void SharedFile::parse<ELF64BE>();