#include "OutputSections.h"
#include "Relocations.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "lld/Common/ErrorHandler.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MathExtras.h"
usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::support::endian;
usingnamespacellvm::ELF;
usingnamespacelld;
usingnamespacelld::elf;
namespace {
class X86_64 : public TargetInfo { … };
}
static const std::vector<std::vector<uint8_t>> nopInstructions = …;
X86_64::X86_64() { … }
int X86_64::getTlsGdRelaxSkip(RelType type) const { … }
enum JmpInsnOpcode : uint32_t { … };
static JmpInsnOpcode getJmpInsnType(const uint8_t *first,
const uint8_t *second) { … }
static unsigned getRelocationWithOffset(const InputSection &is,
uint64_t offset) { … }
static bool isRelocationForJmpInsn(Relocation &R) { … }
static bool isFallThruRelocation(InputSection &is, InputFile *file,
InputSection *nextIS, Relocation &r) { … }
static JmpInsnOpcode invertJmpOpcode(const JmpInsnOpcode opcode) { … }
bool X86_64::deleteFallThruJmpInsn(InputSection &is, InputFile *file,
InputSection *nextIS) const { … }
bool X86_64::relaxOnce(int pass) const { … }
RelExpr X86_64::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const { … }
void X86_64::writeGotPltHeader(uint8_t *buf) const { … }
void X86_64::writeGotPlt(uint8_t *buf, const Symbol &s) const { … }
void X86_64::writeIgotPlt(uint8_t *buf, const Symbol &s) const { … }
void X86_64::writePltHeader(uint8_t *buf) const { … }
void X86_64::writePlt(uint8_t *buf, const Symbol &sym,
uint64_t pltEntryAddr) const { … }
RelType X86_64::getDynRel(RelType type) const { … }
static void relaxTlsGdToLe(uint8_t *loc, const Relocation &rel, uint64_t val) { … }
static void relaxTlsGdToIe(uint8_t *loc, const Relocation &rel, uint64_t val) { … }
static void relaxTlsIeToLe(uint8_t *loc, const Relocation &, uint64_t val) { … }
static void relaxTlsLdToLe(uint8_t *loc, const Relocation &rel, uint64_t val) { … }
void X86_64::applyJumpInstrMod(uint8_t *loc, JumpModType type,
unsigned size) const { … }
int64_t X86_64::getImplicitAddend(const uint8_t *buf, RelType type) const { … }
static void relaxGot(uint8_t *loc, const Relocation &rel, uint64_t val);
void X86_64::relocate(uint8_t *loc, const Relocation &rel, uint64_t val) const { … }
RelExpr X86_64::adjustGotPcExpr(RelType type, int64_t addend,
const uint8_t *loc) const { … }
static void relaxGotNoPic(uint8_t *loc, uint64_t val, uint8_t op,
uint8_t modRm) { … }
static void relaxGot(uint8_t *loc, const Relocation &rel, uint64_t val) { … }
bool X86_64::adjustPrologueForCrossSplitStack(uint8_t *loc, uint8_t *end,
uint8_t stOther) const { … }
void X86_64::relocateAlloc(InputSectionBase &sec, uint8_t *buf) const { … }
namespace {
class IntelIBT : public X86_64 { … };
}
IntelIBT::IntelIBT() { … }
void IntelIBT::writeGotPlt(uint8_t *buf, const Symbol &s) const { … }
void IntelIBT::writePlt(uint8_t *buf, const Symbol &sym,
uint64_t pltEntryAddr) const { … }
void IntelIBT::writeIBTPlt(uint8_t *buf, size_t numEntries) const { … }
namespace {
class Retpoline : public X86_64 { … };
class RetpolineZNow : public X86_64 { … };
}
Retpoline::Retpoline() { … }
void Retpoline::writeGotPlt(uint8_t *buf, const Symbol &s) const { … }
void Retpoline::writePltHeader(uint8_t *buf) const { … }
void Retpoline::writePlt(uint8_t *buf, const Symbol &sym,
uint64_t pltEntryAddr) const { … }
RetpolineZNow::RetpolineZNow() { … }
void RetpolineZNow::writePltHeader(uint8_t *buf) const { … }
void RetpolineZNow::writePlt(uint8_t *buf, const Symbol &sym,
uint64_t pltEntryAddr) const { … }
static TargetInfo *getTargetInfo() { … }
TargetInfo *elf::getX86_64TargetInfo() { … }