From d43e470e3ce9cacff9ae57358d0f4b475d120686 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 1 Aug 2015 15:48:56 +0300 Subject: [PATCH] libdyld: fix DT_HASH address calculation. --- software/libdyld/dyld.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/software/libdyld/dyld.c b/software/libdyld/dyld.c index 04cdbc62..3b9cfe46 100644 --- a/software/libdyld/dyld.c +++ b/software/libdyld/dyld.c @@ -21,8 +21,8 @@ static int fixup_rela(Elf32_Addr base, Elf32_Rela *rela, value = resolve_import(&strtab[sym->st_name]); if(value == 0) { static char error[256]; - error[scnprintf(error, sizeof(error), "ELF object has an unresolved symbol: %s", - &strtab[sym->st_name])] = 0; + snprintf(error, sizeof(error), + "ELF object has an unresolved symbol: %s", &strtab[sym->st_name]); *error_out = error; return 0; } @@ -95,7 +95,7 @@ int dyld_load(void *shlib, Elf32_Addr base, case DT_RELASZ: relanum = dyn->d_un.d_val / sizeof(Elf32_Rela); break; case DT_JMPREL: pltrel = (Elf32_Rela *)(base + dyn->d_un.d_ptr); break; case DT_PLTRELSZ: pltrelnum = dyn->d_un.d_val / sizeof(Elf32_Rela); break; - case DT_HASH: hash = (Elf32_Word *)dyn->d_un.d_val; break; + case DT_HASH: hash = (Elf32_Word *)(base + dyn->d_un.d_ptr); break; case DT_INIT: init = dyn->d_un.d_val; break; case DT_REL: -- 2.30.2