summaryrefslogtreecommitdiff
path: root/src/usertestelf.c
diff options
context:
space:
mode:
authordzwdz2022-07-21 15:25:33 +0200
committerdzwdz2022-07-21 15:25:33 +0200
commit6cd59ad0124d8a22e8cbb77f87e8f0aa20633c59 (patch)
treedc1942a47f1c9ca96e9724a8b7ab69d6afd9025b /src/usertestelf.c
parentbc49ea97bb61bbe55af3e847a88a649d04a93777 (diff)
fix type-related compiler warnings
Diffstat (limited to 'src/usertestelf.c')
-rw-r--r--src/usertestelf.c8
1 files changed, 4 insertions, 4 deletions
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");