diff options
-rw-r--r-- | lld/ELF/Relocations.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/Target.cpp | 13 | ||||
-rw-r--r-- | lld/ELF/Target.h | 3 |
3 files changed, 7 insertions, 11 deletions
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 6a410eca8a1..c54e28b4354 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -354,7 +354,7 @@ static RelExpr adjustExpr(const elf::ObjectFile<ELFT> &File, SymbolBody &Body, } else if (!Preemptible) { if (needsPlt(Expr)) Expr = fromPlt(Expr); - if (Expr == R_GOT_PC && Target->canRelaxGot(Type, Data, Offset)) + if (Expr == R_GOT_PC && Target->canRelaxGot(Type, Data + Offset)) Expr = R_RELAX_GOT_PC; } diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index 02a7af5cd2a..b13989556ec 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -113,8 +113,7 @@ public: int32_t Index, unsigned RelOff) const override; void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; - bool canRelaxGot(uint32_t Type, const uint8_t *Data, - uint64_t Offset) const override; + bool canRelaxGot(uint32_t Type, const uint8_t *Data) const override; void relaxGot(uint8_t *Loc, uint64_t Val) const override; void relaxTlsGdToIe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; void relaxTlsGdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; @@ -235,8 +234,7 @@ bool TargetInfo::isTlsGlobalDynamicRel(uint32_t Type) const { return false; } -bool TargetInfo::canRelaxGot(uint32_t Type, const uint8_t *Data, - uint64_t Offset) const { +bool TargetInfo::canRelaxGot(uint32_t Type, const uint8_t *Data) const { return false; } @@ -736,12 +734,11 @@ void X86_64TargetInfo::relocateOne(uint8_t *Loc, uint32_t Type, } } -bool X86_64TargetInfo::canRelaxGot(uint32_t Type, const uint8_t *Data, - uint64_t Offset) const { +bool X86_64TargetInfo::canRelaxGot(uint32_t Type, const uint8_t *Data) const { if (Type != R_X86_64_GOTPCRELX && Type != R_X86_64_REX_GOTPCRELX) return false; - const uint8_t Op = Data[Offset - 2]; - const uint8_t ModRm = Data[Offset - 1]; + const uint8_t Op = Data[-2]; + const uint8_t ModRm = Data[-1]; // Relax mov. if (Op == 0x8b) return true; diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index 77280b02659..3e1dd12ccba 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -88,8 +88,7 @@ public: uint32_t ThunkSize = 0; - virtual bool canRelaxGot(uint32_t Type, const uint8_t *Data, - uint64_t Offset) const; + virtual bool canRelaxGot(uint32_t Type, const uint8_t *Data) const; virtual void relaxGot(uint8_t *Loc, uint64_t Val) const; virtual void relaxTlsGdToIe(uint8_t *Loc, uint32_t Type, uint64_t Val) const; virtual void relaxTlsGdToLe(uint8_t *Loc, uint32_t Type, uint64_t Val) const; |