Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3688 → Rev 3689

/branches/dynload/uspace/lib/rtld/module.c
54,6 → 54,10
void module_process_relocs(module_t *m)
{
DPRINTF("module_process_relocs('%s')\n", m->dyn.soname);
 
/* Do not relocate twice. */
if (m->relocated) return;
 
if (m->dyn.plt_rel == DT_REL) {
if (m->dyn.rel != NULL)
rel_table_process(m, m->dyn.rel, m->dyn.rel_sz);
67,6 → 71,8
rela_table_process(m, m->dyn.rela, m->dyn.rela_sz);
}
}
 
m->relocated = true;
}
 
/** Find module structure by soname/pathname.
131,16 → 137,21
strcpy(name_buf, "/lib/");
strcpy(name_buf + 5, name);
 
/* FIXME: need to vary bias / allocate address space */
m->bias = 0x20000;
/* FIXME: need to real allocation of address space */
m->bias = runtime_env->next_bias;
runtime_env->next_bias += 0x100000;
 
DPRINTF("filename:'%s'\n", name_buf);
 
rc = elf_load_file(name_buf, m->bias, ELDF_RW, &info);
if (rc < 0) {
if (rc != EE_OK) {
printf("Failed to load '%s'\n", name_buf);
exit(1);
}
 
/* Pending relocation. */
m->relocated = false;
 
DPRINTF("parse dynamic section\n");
/* Parse ELF .dynamic section. Store info to m->dyn. */
dynamic_parse(info.dynamic, m->bias, &m->dyn);
207,7 → 218,14
}
}
 
void modules_process_relocs(void)
/** Process relocations in modules.
*
* Processes relocations in @a start and all its dependencies.
* Modules that have already been relocated are unaffected.
*
* @param start The module where to start from.
*/
void modules_process_relocs(module_t *start)
{
link_t *head = &runtime_env->modules_head;