From 1f31dd66a94c74ea098116fb4310d798ecfb5e88 Mon Sep 17 00:00:00 2001 From: wawa Date: Fri, 8 Mar 2019 13:14:22 +0000 Subject: [PATCH] fix casts in debug statements so they also work with elf64 on 32bit. Handle plt32 relocations in internalloadseg_elf also. (NicJA) git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@55795 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- bootstrap/elfloader.c | 8 ++++---- rom/dos/internalloadseg_elf.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bootstrap/elfloader.c b/bootstrap/elfloader.c index 49fd97a0e3..3a2a381e3c 100644 --- a/bootstrap/elfloader.c +++ b/bootstrap/elfloader.c @@ -80,7 +80,7 @@ static void *load_hunk(void *file, struct sheader *sh, void *addr, struct Kernel if (!sh->size) return addr; - D(kprintf("[ELF Loader] Chunk (%ld bytes, align=%ld (%p) @ ", sh->size, sh->addralign, (void *)sh->addralign)); + D(kprintf("[ELF Loader] Chunk (%ld bytes, align=%ld (%p) @ ", sh->size, sh->addralign, (void *)(uintptr_t)sh->addralign)); align = sh->addralign - 1; addr = (char *)(((uintptr_t)addr + align) & ~align); @@ -159,7 +159,7 @@ static int relocate(struct elfheader *eh, struct sheader *sh, long shrel_idx, el if (!SysBase_ptr) { SysBase_ptr = DefSysBase; - D(kprintf("[ELF Loader] SysBase symbol set to default %p\n", (void *)SysBase_ptr)); + D(kprintf("[ELF Loader] SysBase symbol set to default %p\n", (void *)(uintptr_t)SysBase_ptr)); } s = SysBase_ptr; @@ -188,7 +188,7 @@ static int relocate(struct elfheader *eh, struct sheader *sh, long shrel_idx, el if (!SysBase_ptr) { SysBase_ptr = DefSysBase; - D(kprintf("[ELF Loader] SysBase symbol set to default %p\n", (void *)SysBase_ptr)); + D(kprintf("[ELF Loader] SysBase symbol set to default %p\n", (void *)(uintptr_t)SysBase_ptr)); } s = SysBase_ptr; @@ -212,7 +212,7 @@ static int relocate(struct elfheader *eh, struct sheader *sh, long shrel_idx, el if (Strcmp(name, "SysBase") == 0) { SysBase_ptr = s; - D(kprintf("[ELF Loader] SysBase symbol set to %p\n", (void *)SysBase_ptr)); + D(kprintf("[ELF Loader] SysBase symbol set to %p\n", (void *)(uintptr_t)SysBase_ptr)); } } } diff --git a/rom/dos/internalloadseg_elf.c b/rom/dos/internalloadseg_elf.c index 5ccc409fa4..f471cdede4 100644 --- a/rom/dos/internalloadseg_elf.c +++ b/rom/dos/internalloadseg_elf.c @@ -1,5 +1,5 @@ /* - Copyright � 1995-2016, The AROS Development Team. All rights reserved. + Copyright (C) 1995-2019, The AROS Development Team. All rights reserved. $Id$ Desc: Code to dynamically load ELF executables @@ -404,6 +404,7 @@ static int relocate *(UQUAD *)p = s + rel->addend; break; + case R_X86_64_PLT32: case R_X86_64_PC32: /* PC relative 32 bit signed */ *(ULONG *)p = s + rel->addend - (IPTR) p; break; @@ -631,7 +632,7 @@ static int relocate #endif default: - D(bug("[ELF Loader] Unrecognized relocation type %d %d\n", i, ELF_R_TYPE(rel->info))); + bug("[ELF Loader] Unknown relocation #%d type %d\n", i, ELF_R_TYPE(rel->info)); SetIoErr(ERROR_BAD_HUNK); return 0; } -- 2.11.4.GIT