#include "InputFiles.h"
#include "OutputSections.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/LEB128.h"
usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::support::endian;
usingnamespacellvm::ELF;
usingnamespacelld;
usingnamespacelld::elf;
namespace {
class LoongArch final : public TargetInfo { … };
}
namespace {
enum Op { … };
enum Reg { … };
}
static uint64_t getLoongArchPage(uint64_t p) { … }
static uint32_t lo12(uint32_t val) { … }
uint64_t elf::getLoongArchPageDelta(uint64_t dest, uint64_t pc, RelType type) { … }
static uint32_t hi20(uint32_t val) { … }
static uint32_t insn(uint32_t op, uint32_t d, uint32_t j, uint32_t k) { … }
static uint32_t extractBits(uint64_t v, uint32_t begin, uint32_t end) { … }
static uint32_t setD5k16(uint32_t insn, uint32_t imm) { … }
static uint32_t setD10k16(uint32_t insn, uint32_t imm) { … }
static uint32_t setJ20(uint32_t insn, uint32_t imm) { … }
static uint32_t setK12(uint32_t insn, uint32_t imm) { … }
static uint32_t setK16(uint32_t insn, uint32_t imm) { … }
static bool isJirl(uint32_t insn) { … }
static void handleUleb128(uint8_t *loc, uint64_t val) { … }
LoongArch::LoongArch(Ctx &ctx) : … { … }
static uint32_t getEFlags(const InputFile *f) { … }
static bool inputFileHasCode(const InputFile *f) { … }
uint32_t LoongArch::calcEFlags() const { … }
int64_t LoongArch::getImplicitAddend(const uint8_t *buf, RelType type) const { … }
void LoongArch::writeGotPlt(uint8_t *buf, const Symbol &s) const { … }
void LoongArch::writeIgotPlt(uint8_t *buf, const Symbol &s) const { … }
void LoongArch::writePltHeader(uint8_t *buf) const { … }
void LoongArch::writePlt(uint8_t *buf, const Symbol &sym,
uint64_t pltEntryAddr) const { … }
RelType LoongArch::getDynRel(RelType type) const { … }
RelExpr LoongArch::getRelExpr(const RelType type, const Symbol &s,
const uint8_t *loc) const { … }
bool LoongArch::usesOnlyLowPageBits(RelType type) const { … }
void LoongArch::relocate(uint8_t *loc, const Relocation &rel,
uint64_t val) const { … }
static bool relax(InputSection &sec) { … }
bool LoongArch::relaxOnce(int pass) const { … }
void LoongArch::finalizeRelax(int passes) const { … }
TargetInfo *elf::getLoongArchTargetInfo(Ctx &ctx) { … }