forked from OSchip/llvm-project
ELF2: Do not use host pointer size to calculate x86_64 relocation addresses.
Previous code had a potential portability issue because intptr_t is not guaranteed to be 64 bit. llvm-svn: 248856
This commit is contained in:
parent
9a0db7cbef
commit
e3fbc89c44
|
@ -107,8 +107,8 @@ void X86_64TargetInfo::writePltEntry(uint8_t *Buf, uint64_t GotEntryAddr,
|
||||||
const uint8_t Inst[] = {0xff, 0x25, 0, 0, 0, 0, 0x90, 0x90};
|
const uint8_t Inst[] = {0xff, 0x25, 0, 0, 0, 0, 0x90, 0x90};
|
||||||
memcpy(Buf, Inst, sizeof(Inst));
|
memcpy(Buf, Inst, sizeof(Inst));
|
||||||
|
|
||||||
uintptr_t NextPC = PltEntryAddr + 6;
|
uint64_t NextPC = PltEntryAddr + 6;
|
||||||
intptr_t Delta = GotEntryAddr - NextPC;
|
int64_t Delta = GotEntryAddr - NextPC;
|
||||||
assert(isInt<32>(Delta));
|
assert(isInt<32>(Delta));
|
||||||
write32le(Buf + 2, Delta);
|
write32le(Buf + 2, Delta);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue