aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdmund Grimley Evans <Edmund.Grimley.Evans@gmail.com>2015-11-20 23:29:08 +0000
committerEdmund Grimley Evans <Edmund.Grimley.Evans@gmail.com>2015-11-20 23:29:08 +0000
commitc7067aeb844f5421f2256164cbe59bc625d52c25 (patch)
tree72234ed8e3d4b59a6da227e87cf9331933a4da6d
parent4ae626451e5b64d2b5e0ad19e67b77a88a7bab55 (diff)
downloadtinycc-c7067aeb844f5421f2256164cbe59bc625d52c25.tar.gz
tinycc-c7067aeb844f5421f2256164cbe59bc625d52c25.tar.bz2
tccelf.c: On arm64, use read64le, and use uint64_t to check range.
-rw-r--r--tccelf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tccelf.c b/tccelf.c
index 7b29bd6..ffc1079 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1961,9 +1961,8 @@ ST_FUNC void relocate_plt(TCCState *s1)
p += 32;
while (p < p_end) {
uint64_t pc = plt + (p - s1->plt->data);
- uint64_t addr = got +
- (read32le(p) | (uint64_t)read32le(p + 4) << 32);
- uint32_t off = (addr >> 12) - (pc >> 12);
+ uint64_t addr = got + read64le(p);
+ uint64_t off = (addr >> 12) - (pc >> 12);
if ((off + ((uint32_t)1 << 20)) >> 21)
tcc_error("Failed relocating PLT (off=0x%lx, addr=0x%lx, pc=0x%lx)", off, addr, pc);
write32le(p, (0x90000010 | // adrp x16,...