arm64: fix symbol addends on LLP64 hosts
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-arm64-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
build and test / test-i386-linux (push) Has been cancelled

The host-sized symbol addend parameter was introduced by commit b14ef0e2 and truncates 64-bit addends on LLP64 hosts.

Use addr_t and cover the negative-addend case.
This commit is contained in:
Mounir IDRASSI 2026-07-30 22:53:29 +09:00
parent da58264ab1
commit 2be0218be4
3 changed files with 19 additions and 1 deletions

View File

@ -463,7 +463,7 @@ static void arm64_strv(int sz_, int dst, int bas, uint64_t off)
}
}
static void arm64_sym(int r, Sym *sym, unsigned long addend)
static void arm64_sym(int r, Sym *sym, addr_t addend)
{
if (sym->type.t & VT_TLS) {
#if TCC_TARGET_PE

View File

@ -0,0 +1,17 @@
#include <stdint.h>
#include <stdio.h>
static unsigned short data[844];
static uint64_t address_for_index(int index)
{
return (uint64_t)(uintptr_t)data - 845186ULL
+ (uint64_t)index * 2;
}
int main(void)
{
printf("%d\n", address_for_index(422593)
== (uint64_t)(uintptr_t)data);
return 0;
}

View File

@ -0,0 +1 @@
1