#ifndef LLD_ELF_TARGET_H
#define LLD_ELF_TARGET_H
#include "Config.h"
#include "InputSection.h"
#include "lld/Common/ErrorHandler.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Object/ELF.h"
#include "llvm/Object/ELFTypes.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include <array>
namespace lld {
std::string toString(elf::RelType type);
namespace elf {
class Defined;
class InputFile;
class Symbol;
class TargetInfo { … };
TargetInfo *getAArch64TargetInfo(Ctx &);
TargetInfo *getAMDGPUTargetInfo(Ctx &);
TargetInfo *getARMTargetInfo(Ctx &);
TargetInfo *getAVRTargetInfo(Ctx &);
TargetInfo *getHexagonTargetInfo(Ctx &);
TargetInfo *getLoongArchTargetInfo(Ctx &);
TargetInfo *getMSP430TargetInfo(Ctx &);
TargetInfo *getMipsTargetInfo(Ctx &);
TargetInfo *getPPC64TargetInfo(Ctx &);
TargetInfo *getPPCTargetInfo(Ctx &);
TargetInfo *getRISCVTargetInfo(Ctx &);
TargetInfo *getSPARCV9TargetInfo(Ctx &);
TargetInfo *getSystemZTargetInfo(Ctx &);
TargetInfo *getX86TargetInfo(Ctx &);
TargetInfo *getX86_64TargetInfo(Ctx &);
struct ErrorPlace { … };
ErrorPlace getErrorPlace(Ctx &ctx, const uint8_t *loc);
static inline std::string getErrorLocation(const uint8_t *loc) { … }
void processArmCmseSymbols(Ctx &);
void writePPC32GlinkSection(uint8_t *buf, size_t numEntries);
unsigned getPPCDFormOp(unsigned secondaryOp);
unsigned getPPCDSFormOp(unsigned secondaryOp);
unsigned getPPC64GlobalEntryToLocalEntryOffset(uint8_t stOther);
void writePrefixedInstruction(uint8_t *loc, uint64_t insn);
void addPPC64SaveRestore();
uint64_t getPPC64TocBase();
uint64_t getAArch64Page(uint64_t expr);
bool isAArch64BTILandingPad(Symbol &s, int64_t a);
template <typename ELFT> void writeARMCmseImportLib();
uint64_t getLoongArchPageDelta(uint64_t dest, uint64_t pc, RelType type);
void riscvFinalizeRelax(int passes);
void mergeRISCVAttributesSections(Ctx &);
void addArmInputSectionMappingSymbols();
void addArmSyntheticSectionMappingSymbol(Defined *);
void sortArmMappingSymbols();
void convertArmInstructionstoBE8(InputSection *sec, uint8_t *buf);
void createTaggedSymbols(const SmallVector<ELFFileBase *, 0> &files);
void initSymbolAnchors();
TargetInfo *getTarget(Ctx &);
template <class ELFT> bool isMipsPIC(const Defined *sym);
void reportRangeError(Ctx &, uint8_t *loc, const Relocation &rel,
const Twine &v, int64_t min, uint64_t max);
void reportRangeError(Ctx &ctx, uint8_t *loc, int64_t v, int n,
const Symbol &sym, const Twine &msg);
inline void checkInt(uint8_t *loc, int64_t v, int n, const Relocation &rel) { … }
inline void checkUInt(uint8_t *loc, uint64_t v, int n, const Relocation &rel) { … }
inline void checkIntUInt(uint8_t *loc, uint64_t v, int n,
const Relocation &rel) { … }
inline void checkAlignment(uint8_t *loc, uint64_t v, int n,
const Relocation &rel) { … }
inline uint16_t read16(const void *p) { … }
inline uint32_t read32(const void *p) { … }
inline uint64_t read64(const void *p) { … }
inline void write16(void *p, uint16_t v) { … }
inline void write32(void *p, uint32_t v) { … }
inline void write64(void *p, uint64_t v) { … }
inline uint64_t overwriteULEB128(uint8_t *bufLoc, uint64_t val) { … }
}
}
#ifdef __clang__
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
#define invokeELFT(f, ...) …
#endif