@@ -329,13 +329,11 @@ void elfObjectApplyRelocations(g_fd file, g_elf_object* object)
329329 break ;
330330 }
331331
332- if (shdr.sh_type != SHT_REL)
333- {
332+ if (shdr.sh_type != SHT_RELA)
334333 continue ;
335- }
336334
337- auto entry = (Elf64_Rel *) (object->baseAddress + shdr.sh_addr );
338- while (entry < (Elf64_Rel *) (object->baseAddress + shdr.sh_addr + shdr.sh_size ))
335+ auto entry = (Elf64_Rela *) (object->baseAddress + shdr.sh_addr );
336+ while (entry < (Elf64_Rela *) (object->baseAddress + shdr.sh_addr + shdr.sh_size ))
339337 {
340338 uint32_t symbolIndex = ELF64_R_SYM (entry->r_info );
341339 uint8_t type = ELF64_R_TYPE (entry->r_info );
@@ -392,7 +390,7 @@ void elfObjectApplyRelocations(g_fd file, g_elf_object* object)
392390 {
393391 if (ELF64_ST_BIND (symbol->st_info ) != STB_WEAK)
394392 logDebug (" %! missing symbol '%s' (%h, bind: %i)" , " elf" , symbolName, cP,
395- ELF64_ST_BIND (symbol->st_info ));
393+ ELF64_ST_BIND (symbol->st_info ));
396394
397395 cS = 0 ;
398396 }
@@ -420,7 +418,7 @@ void elfObjectApplyRelocations(g_fd file, g_elf_object* object)
420418 else if (type == R_X86_64_RELATIVE)
421419 {
422420 uint64_t cB = object->baseAddress ;
423- int32_t cA = *((int32_t *) cP);
421+ int64_t cA = *((int64_t *) cP);
424422 *((uint64_t *) cP) = cB + cA;
425423 }
426424 else if (type == R_X86_64_64)
0 commit comments