Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3969 → Rev 3970

/branches/dynload/uspace/lib/rtld/arch/mips32/include/elf_dyn.h
39,6 → 39,7
* mips32 program header types
*/
#define DT_MIPS_BASE_ADDRESS 0x70000006
#define DT_MIPS_LOCAL_GOTNO 0x7000000a
#define DT_MIPS_SYMTABNO 0x70000011
#define DT_MIPS_GOTSYM 0x70000013
 
/branches/dynload/uspace/lib/rtld/arch/mips32/include/dynamic.h
39,6 → 39,8
 
typedef struct {
/** Number of local entries in GOT. */
uint32_t lgotno;
/** Index of first GOT-mapped dynamic symbol. */
uint32_t gotsym;
/** Number of entries in dynamic symbol table. */
uint32_t sym_no;
/branches/dynload/uspace/lib/rtld/arch/mips32/src/dynamic.c
50,6 → 50,7
 
switch (dp->d_tag) {
case DT_MIPS_BASE_ADDRESS: info->arch.base = d_val; break;
case DT_MIPS_LOCAL_GOTNO: info->arch.lgotno = d_val; break;
case DT_MIPS_SYMTABNO: info->arch.sym_no = d_val; break;
case DT_MIPS_GOTSYM: info->arch.gotsym = d_val; break;
default: break;
/branches/dynload/uspace/lib/rtld/arch/mips32/src/reloc.c
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,