#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 { … };
void setAArch64TargetInfo(Ctx &);
void setAMDGPUTargetInfo(Ctx &);
void setARMTargetInfo(Ctx &);
void setAVRTargetInfo(Ctx &);
void setHexagonTargetInfo(Ctx &);
void setLoongArchTargetInfo(Ctx &);
void setMSP430TargetInfo(Ctx &);
void setMipsTargetInfo(Ctx &);
void setPPC64TargetInfo(Ctx &);
void setPPCTargetInfo(Ctx &);
void setRISCVTargetInfo(Ctx &);
void setSPARCV9TargetInfo(Ctx &);
void setSystemZTargetInfo(Ctx &);
void setX86TargetInfo(Ctx &);
void setX86_64TargetInfo(Ctx &);
struct ErrorPlace { … };
ErrorPlace getErrorPlace(Ctx &ctx, const uint8_t *loc);
static inline std::string getErrorLoc(Ctx &ctx, const uint8_t *loc) { … }
void processArmCmseSymbols(Ctx &);
template <class ELFT> uint32_t calcMipsEFlags(Ctx &);
uint8_t getMipsFpAbiFlag(uint8_t oldFlag, uint8_t newFlag,
llvm::StringRef fileName);
bool isMipsN32Abi(Ctx &, const InputFile &f);
bool isMicroMips(Ctx &);
bool isMipsR6(Ctx &);
void writePPC32GlinkSection(Ctx &, uint8_t *buf, size_t numEntries);
unsigned getPPCDFormOp(unsigned secondaryOp);
unsigned getPPCDSFormOp(unsigned secondaryOp);
unsigned getPPC64GlobalEntryToLocalEntryOffset(uint8_t stOther);
void writePrefixedInst(Ctx &, uint8_t *loc, uint64_t insn);
void addPPC64SaveRestore(Ctx &);
uint64_t getPPC64TocBase(Ctx &ctx);
uint64_t getAArch64Page(uint64_t expr);
bool isAArch64BTILandingPad(Ctx &, Symbol &s, int64_t a);
template <typename ELFT> void writeARMCmseImportLib(Ctx &);
uint64_t getLoongArchPageDelta(uint64_t dest, uint64_t pc, RelType type);
void riscvFinalizeRelax(int passes);
void mergeRISCVAttributesSections(Ctx &);
void addArmInputSectionMappingSymbols(Ctx &);
void addArmSyntheticSectionMappingSymbol(Defined *);
void sortArmMappingSymbols();
void convertArmInstructionstoBE8(InputSection *sec, uint8_t *buf);
void createTaggedSymbols(Ctx &);
void initSymbolAnchors(Ctx &);
void setTarget(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