diff --git a/arm64-gen.c b/arm64-gen.c index 268319af..85aa7c0e 100644 --- a/arm64-gen.c +++ b/arm64-gen.c @@ -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 diff --git a/tests/tests2/152_arm64_addend.c b/tests/tests2/152_arm64_addend.c new file mode 100644 index 00000000..c2f126ba --- /dev/null +++ b/tests/tests2/152_arm64_addend.c @@ -0,0 +1,17 @@ +#include +#include + +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; +} diff --git a/tests/tests2/152_arm64_addend.expect b/tests/tests2/152_arm64_addend.expect new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/tests/tests2/152_arm64_addend.expect @@ -0,0 +1 @@ +1