48,9 → 48,10 |
elf_symbol_t *sym_def; |
elf_symbol_t *sym; |
uint32_t gotsym; |
uint32_t lgotno; |
uint32_t *got; |
char *str_tab; |
int i; |
int i, j; |
|
uint32_t sym_addr; |
module_t *dest; |
59,6 → 60,7 |
sym_table = m->dyn.sym_tab; |
str_tab = m->dyn.str_tab; |
gotsym = m->dyn.arch.gotsym; |
lgotno = m->dyn.arch.lgotno; |
|
DPRINTF("** Relocate GOT entries **\n"); |
DPRINTF("MIPS base = 0x%x\n", m->dyn.arch.base); |
72,15 → 74,20 |
} |
|
DPRINTF("sym_ent = %d, gotsym = %d\n", m->dyn.arch.sym_no, gotsym); |
DPRINTF("lgotno = %d\n", lgotno); |
|
/* |
* Global entries. |
* Iterate over GOT-mapped symbol entries. |
*/ |
for (i = gotsym; i < m->dyn.arch.sym_no; i++) { |
for (j = gotsym; j < m->dyn.arch.sym_no; j++) { |
/* Corresponding (global) GOT entry. */ |
i = lgotno + j - gotsym; |
|
DPRINTF("relocate GOT entry %d\n", i); |
// getchar(); |
// getchar(); |
|
sym = &sym_table[i]; |
sym = &sym_table[j]; |
if (ELF32_R_TYPE(sym->st_info) == STT_FUNC) { |
if (sym->st_shndx == SHN_UNDEF) { |
if (sym->st_value == 0) { |
123,7 → 130,6 |
continue; |
} |
DPRINTF("write 0x%x at 0x%x\n", sym_addr, (uint32_t) &got[i]); |
// getchar(); |
got[i] = sym_addr; |
} |
|
155,6 → 161,7 |
|
uint32_t *got; |
uint32_t gotsym; |
uint32_t lgotno; |
uint32_t ea; |
|
DPRINTF("parse relocation table\n"); |
164,6 → 171,7 |
str_tab = m->dyn.str_tab; |
got = (uint32_t *) m->dyn.plt_got; |
gotsym = m->dyn.arch.gotsym; |
lgotno = m->dyn.arch.lgotno; |
|
DPRINTF("got=0x%lx, gotsym=%d\n", (uintptr_t) got, gotsym); |
|
211,7 → 219,7 |
if (sym_idx < gotsym) |
ea = sym_addr; |
else |
ea = got[sym_idx]; |
ea = got[lgotno + sym_idx - gotsym]; |
|
*r_ptr += sym_addr - ea; |
DPRINTF("p = 0x%x, val := 0x%x\n", (uint32_t) r_ptr, |