From d38cd7c8fb5964d559c5f0826007551429b73cda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vivek=20Das=C2=A0Mohapatra?= <vivek@collabora.co.uk> Date: Wed, 24 May 2017 00:28:34 +0100 Subject: [PATCH] ElfW(Rel) is not 32/64 bit symmetric The r_addend member is ElfW(Sxword) in 64 bit ELF but ElfW(Sword) in 32 bit mode. This mostly doesn't matter but if we want to quash a pointer/integer size-mismatch warning we need to have a different protoype for the address offset calculator helper in each model. --- utils/process-pt-dynamic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/process-pt-dynamic.c b/utils/process-pt-dynamic.c index 62131eba3..7511a0d1e 100644 --- a/utils/process-pt-dynamic.c +++ b/utils/process-pt-dynamic.c @@ -31,7 +31,13 @@ #include "mmap-info.h" static void * +#if __ELF_NATIVE_CLASS == 32 +addr (ElfW(Addr) base, ElfW(Addr) ptr, ElfW(Sword) addend) +#elif __ELF_NATIVE_CLASS == 64 addr (ElfW(Addr) base, ElfW(Addr) ptr, ElfW(Sxword) addend) +#else +#error "Unsupported __ELF_NATIVE_CLASS size (not 32 or 64)" +#endif { if( (ptr + addend) > base ) return (void *)(ptr + addend); -- GitLab