Changeset View
Changeset View
Standalone View
Standalone View
ELF/Arch/X86_64.cpp
Show All 31 Lines | 26 | public: | |||
---|---|---|---|---|---|
32 | void writeGotPlt(uint8_t *Buf, const Symbol &S) const override; | 32 | void writeGotPlt(uint8_t *Buf, const Symbol &S) const override; | ||
33 | void writePltHeader(uint8_t *Buf) const override; | 33 | void writePltHeader(uint8_t *Buf) const override; | ||
34 | void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, | 34 | void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, | ||
35 | int32_t Index, unsigned RelOff) const override; | 35 | int32_t Index, unsigned RelOff) const override; | ||
36 | void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const override; | 36 | void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||
37 | 37 | | |||
38 | RelExpr adjustRelaxExpr(RelType Type, const uint8_t *Data, | 38 | RelExpr adjustRelaxExpr(RelType Type, const uint8_t *Data, | ||
39 | RelExpr Expr) const override; | 39 | RelExpr Expr) const override; | ||
40 | void relaxGot(uint8_t *Loc, uint64_t Val) const override; | 40 | void relaxGot(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||
41 | void relaxTlsGdToIe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | 41 | void relaxTlsGdToIe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||
42 | void relaxTlsGdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | 42 | void relaxTlsGdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||
43 | void relaxTlsIeToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | 43 | void relaxTlsIeToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||
44 | void relaxTlsLdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | 44 | void relaxTlsLdToLe(uint8_t *Loc, RelType Type, uint64_t Val) const override; | ||
45 | bool adjustPrologueForCrossSplitStack(uint8_t *Loc, uint8_t *End, | 45 | bool adjustPrologueForCrossSplitStack(uint8_t *Loc, uint8_t *End, | ||
46 | uint8_t StOther) const override; | 46 | uint8_t StOther) const override; | ||
47 | 47 | | |||
48 | private: | 48 | private: | ||
▲ Show 20 Lines • Show All 400 Lines • ▼ Show 20 Line(s) | 393 | void X86_64<ELFT>::relaxGotNoPic(uint8_t *Loc, uint64_t Val, uint8_t Op, | |||
449 | // "INSTRUCTION SET REFERENCE, N-Z" (Vol. 2B 4-1) for | 449 | // "INSTRUCTION SET REFERENCE, N-Z" (Vol. 2B 4-1) for | ||
450 | // descriptions about each operation. | 450 | // descriptions about each operation. | ||
451 | Loc[-2] = 0x81; | 451 | Loc[-2] = 0x81; | ||
452 | Loc[-3] = (Rex & ~0x4) | (Rex & 0x4) >> 2; | 452 | Loc[-3] = (Rex & ~0x4) | (Rex & 0x4) >> 2; | ||
453 | write32le(Loc, Val); | 453 | write32le(Loc, Val); | ||
454 | } | 454 | } | ||
455 | 455 | | |||
456 | template <class ELFT> | 456 | template <class ELFT> | ||
457 | void X86_64<ELFT>::relaxGot(uint8_t *Loc, uint64_t Val) const { | 457 | void X86_64<ELFT>::relaxGot(uint8_t *Loc, RelType Type, uint64_t Val) const { | ||
458 | const uint8_t Op = Loc[-2]; | 458 | const uint8_t Op = Loc[-2]; | ||
459 | const uint8_t ModRm = Loc[-1]; | 459 | const uint8_t ModRm = Loc[-1]; | ||
460 | 460 | | |||
461 | // Convert "mov foo@GOTPCREL(%rip),%reg" to "lea foo(%rip),%reg". | 461 | // Convert "mov foo@GOTPCREL(%rip),%reg" to "lea foo(%rip),%reg". | ||
462 | if (Op == 0x8b) { | 462 | if (Op == 0x8b) { | ||
463 | Loc[-2] = 0x8d; | 463 | Loc[-2] = 0x8d; | ||
464 | write32le(Loc, Val); | 464 | write32le(Loc, Val); | ||
465 | return; | 465 | return; | ||
▲ Show 20 Lines • Show All 211 Lines • Show Last 20 Lines |