Changeset View
Changeset View
Standalone View
Standalone View
ELF/Arch/X86_64.cpp
Show All 31 Lines | public: | ||||
void writeGotPlt(uint8_t *Buf, const Symbol &S) const override; | void writeGotPlt(uint8_t *Buf, const Symbol &S) const override; | ||||
void writePltHeader(uint8_t *Buf) const override; | void writePltHeader(uint8_t *Buf) const override; | ||||
void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, | void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, | ||||
int32_t Index, unsigned RelOff) const override; | int32_t Index, unsigned RelOff) const override; | ||||
void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const override; | void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||||
RelExpr adjustRelaxExpr(RelType Type, const uint8_t *Data, | RelExpr adjustRelaxExpr(RelType Type, const uint8_t *Data, | ||||
RelExpr Expr) const override; | RelExpr Expr) const override; | ||||
void relaxGot(uint8_t *Loc, uint64_t Val) const override; | void relaxGot(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||||
void relaxTlsGdToIe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | void relaxTlsGdToIe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||||
void relaxTlsGdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | void relaxTlsGdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||||
void relaxTlsIeToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | void relaxTlsIeToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||||
void relaxTlsLdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | void relaxTlsLdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||||
bool adjustPrologueForCrossSplitStack(uint8_t *Loc, uint8_t *End, | bool adjustPrologueForCrossSplitStack(uint8_t *Loc, uint8_t *End, | ||||
uint8_t StOther) const override; | uint8_t StOther) const override; | ||||
private: | private: | ||||
▲ Show 20 Lines • Show All 400 Lines • ▼ Show 20 Lines | void X86_64<ELFT>::relaxGotNoPic(uint8_t *Loc, uint64_t Val, uint8_t Op, | ||||
// "INSTRUCTION SET REFERENCE, N-Z" (Vol. 2B 4-1) for | // "INSTRUCTION SET REFERENCE, N-Z" (Vol. 2B 4-1) for | ||||
// descriptions about each operation. | // descriptions about each operation. | ||||
Loc[-2] = 0x81; | Loc[-2] = 0x81; | ||||
Loc[-3] = (Rex & ~0x4) | (Rex & 0x4) >> 2; | Loc[-3] = (Rex & ~0x4) | (Rex & 0x4) >> 2; | ||||
write32le(Loc, Val); | write32le(Loc, Val); | ||||
} | } | ||||
template <class ELFT> | template <class ELFT> | ||||
void X86_64<ELFT>::relaxGot(uint8_t *Loc, uint64_t Val) const { | void X86_64<ELFT>::relaxGot(uint8_t *Loc, RelType Type, uint64_t Val) const { | ||||
const uint8_t Op = Loc[-2]; | const uint8_t Op = Loc[-2]; | ||||
const uint8_t ModRm = Loc[-1]; | const uint8_t ModRm = Loc[-1]; | ||||
// Convert "mov foo@GOTPCREL(%rip),%reg" to "lea foo(%rip),%reg". | // Convert "mov foo@GOTPCREL(%rip),%reg" to "lea foo(%rip),%reg". | ||||
if (Op == 0x8b) { | if (Op == 0x8b) { | ||||
Loc[-2] = 0x8d; | Loc[-2] = 0x8d; | ||||
write32le(Loc, Val); | write32le(Loc, Val); | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 211 Lines • Show Last 20 Lines |