From 6cd59ad0124d8a22e8cbb77f87e8f0aa20633c59 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 21 Jul 2022 15:25:33 +0200 Subject: fix type-related compiler warnings --- src/usertestelf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/usertestelf.c') diff --git a/src/usertestelf.c b/src/usertestelf.c index 54a397c..218f684 100644 --- a/src/usertestelf.c +++ b/src/usertestelf.c @@ -8,7 +8,7 @@ __attribute__((visibility("hidden"))) extern struct Elf64_Dyn _DYNAMIC[]; __attribute__((visibility("hidden"))) -extern char _image_base; +extern char _image_base[]; static void printf_backend(void *arg, const char *buf, size_t len) { (void)arg; @@ -45,12 +45,12 @@ static void reloc(void) { size_t relasz = dyn_gettag(DT_RELASZ)->d_val; size_t relaent = dyn_gettag(DT_RELAENT)->d_val; for (size_t o = 0; o < relasz; o += relaent) { - struct Elf64_Rela *r = &_image_base + rela_tag->d_ptr + o; - uintptr_t *target = &_image_base + r->r_offset; + struct Elf64_Rela *r = (void*)_image_base + rela_tag->d_ptr + o; + uintptr_t *target = (void*)_image_base + r->r_offset; switch (ELF64_R_TYPE(r->r_info)) { case R_X86_64_RELATIVE: - *target = &_image_base + r->r_addend; + *target = (uintptr_t)&_image_base + r->r_addend; break; default: printf("elf: unsupported relocation type\n"); -- cgit v1.2.3