#include "InputFiles.h"
#include "OutputSections.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "llvm/Support/ELFAttributes.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/RISCVAttributeParser.h"
#include "llvm/Support/RISCVAttributes.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/TargetParser/RISCVISAInfo.h"
usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::support::endian;
usingnamespacellvm::ELF;
usingnamespacelld;
usingnamespacelld::elf;
namespace {
class RISCV final : public TargetInfo { … };
}
#define INTERNAL_R_RISCV_GPREL_I …
#define INTERNAL_R_RISCV_GPREL_S …
const uint64_t dtpOffset = …;
namespace {
enum Op { … };
enum Reg { … };
}
static uint32_t hi20(uint32_t val) { … }
static uint32_t lo12(uint32_t val) { … }
static uint32_t itype(uint32_t op, uint32_t rd, uint32_t rs1, uint32_t imm) { … }
static uint32_t rtype(uint32_t op, uint32_t rd, uint32_t rs1, uint32_t rs2) { … }
static uint32_t utype(uint32_t op, uint32_t rd, uint32_t imm) { … }
static uint32_t extractBits(uint64_t v, uint32_t begin, uint32_t end) { … }
static uint32_t setLO12_I(uint32_t insn, uint32_t imm) { … }
static uint32_t setLO12_S(uint32_t insn, uint32_t imm) { … }
RISCV::RISCV() { … }
static uint32_t getEFlags(InputFile *f) { … }
uint32_t RISCV::calcEFlags() const { … }
int64_t RISCV::getImplicitAddend(const uint8_t *buf, RelType type) const { … }
void RISCV::writeGotHeader(uint8_t *buf) const { … }
void RISCV::writeGotPlt(uint8_t *buf, const Symbol &s) const { … }
void RISCV::writeIgotPlt(uint8_t *buf, const Symbol &s) const { … }
void RISCV::writePltHeader(uint8_t *buf) const { … }
void RISCV::writePlt(uint8_t *buf, const Symbol &sym,
uint64_t pltEntryAddr) const { … }
RelType RISCV::getDynRel(RelType type) const { … }
RelExpr RISCV::getRelExpr(const RelType type, const Symbol &s,
const uint8_t *loc) const { … }
void RISCV::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { … }
static bool relaxable(ArrayRef<Relocation> relocs, size_t i) { … }
static void tlsdescToIe(uint8_t *loc, const Relocation &rel, uint64_t val) { … }
static void tlsdescToLe(uint8_t *loc, const Relocation &rel, uint64_t val) { … }
void RISCV::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { … }
void elf::initSymbolAnchors() { … }
static void relaxCall(const InputSection &sec, size_t i, uint64_t loc,
Relocation &r, uint32_t &remove) { … }
static void relaxTlsLe(const InputSection &sec, size_t i, uint64_t loc,
Relocation &r, uint32_t &remove) { … }
static void relaxHi20Lo12(const InputSection &sec, size_t i, uint64_t loc,
Relocation &r, uint32_t &remove) { … }
static bool relax(InputSection &sec) { … }
bool RISCV::relaxOnce(int pass) const { … }
void RISCV::finalizeRelax(int passes) const { … }
namespace {
class RISCVAttributesSection final : public SyntheticSection { … };
}
static void mergeArch(RISCVISAUtils::OrderedExtensionMap &mergedExts,
unsigned &mergedXlen, const InputSectionBase *sec,
StringRef s) { … }
static void mergeAtomic(DenseMap<unsigned, unsigned>::iterator it,
const InputSectionBase *oldSection,
const InputSectionBase *newSection,
RISCVAttrs::RISCVAtomicAbiTag oldTag,
RISCVAttrs::RISCVAtomicAbiTag newTag) { … }
static RISCVAttributesSection *
mergeAttributesSection(const SmallVector<InputSectionBase *, 0> §ions) { … }
void RISCVAttributesSection::writeTo(uint8_t *buf) { … }
void elf::mergeRISCVAttributesSections() { … }
TargetInfo *elf::getRISCVTargetInfo() { … }