39,6 → 39,7 |
|
#include <elf_dyn.h> |
#include <dynamic.h> |
#include <rtld.h> |
|
void dynamic_parse(elf_dyn_t *dyn_ptr, size_t bias, dyn_info_t *info) |
{ |
50,13 → 51,13 |
elf_word soname_idx; |
elf_word rpath_idx; |
|
printf("memset\n"); |
DPRINTF("memset\n"); |
memset(info, 0, sizeof(info)); |
|
soname_idx = 0; |
rpath_idx = 0; |
|
printf("pass 1\n"); |
DPRINTF("pass 1\n"); |
while (dp->d_tag != DT_NULL) { |
d_ptr = (void *)((uint8_t *)dp->d_un.d_ptr + bias); |
d_val = dp->d_un.d_val; |
98,11 → 99,11 |
/* This will be useful for parsing dependencies later */ |
info->dynamic = dyn_ptr; |
|
printf("str_tab=0x%x, soname_idx=0x%x, soname=0x%x\n", |
DPRINTF("str_tab=0x%x, soname_idx=0x%x, soname=0x%x\n", |
(uintptr_t)info->soname, soname_idx, (uintptr_t)info->soname); |
printf("soname='%s'\n", info->soname); |
printf("rpath='%s'\n", info->rpath); |
printf("hash=0x%x\n", (uintptr_t)info->hash); |
DPRINTF("soname='%s'\n", info->soname); |
DPRINTF("rpath='%s'\n", info->rpath); |
DPRINTF("hash=0x%x\n", (uintptr_t)info->hash); |
|
/* |
* Now that we have a pointer to the string table, |
109,7 → 110,7 |
* we can parse DT_NEEDED fields (which contain offsets into it). |
*/ |
|
printf("pass 2\n"); |
DPRINTF("pass 2\n"); |
dp = dyn_ptr; |
while (dp->d_tag != DT_NULL) { |
d_val = dp->d_un.d_val; |
118,7 → 119,7 |
case DT_NEEDED: |
/* Assume just for now there's only one dependency */ |
info->needed = info->str_tab + d_val; |
printf("needed:'%s'\n", info->needed); |
DPRINTF("needed:'%s'\n", info->needed); |
break; |
|
default: break; |