diff options
Diffstat (limited to 'com32/lib/sys/module/shallow_module.c')
-rw-r--r-- | com32/lib/sys/module/shallow_module.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/com32/lib/sys/module/shallow_module.c b/com32/lib/sys/module/shallow_module.c index f43582c4..fdcb20f8 100644 --- a/com32/lib/sys/module/shallow_module.c +++ b/com32/lib/sys/module/shallow_module.c @@ -115,29 +115,8 @@ out: return res; } -static int offset_symbols(struct elf_module *module, Elf32_Off offset) { - unsigned int i; - Elf32_Sym *crt_sym = NULL; - - for (i = 1; i < module->symtable_size; i++) { - crt_sym = (Elf32_Sym*)(module->sym_table + i*module->syment_size); - - // Skip the undefined or absolute symbols - if (crt_sym->st_shndx == SHN_UNDEF || crt_sym->st_shndx == SHN_ABS) - continue; - // Also skip the non-local symbols - if (ELF32_ST_BIND(crt_sym->st_info) != STB_GLOBAL && - ELF32_ST_BIND(crt_sym->st_info) != STB_WEAK) - continue; - - crt_sym->st_value += offset; - } - - return 0; -} - -int module_load_shallow(struct elf_module *module, Elf32_Off offset) { +int module_load_shallow(struct elf_module *module, Elf32_Addr base_addr) { int res; Elf32_Ehdr elf_hdr; @@ -160,12 +139,11 @@ int module_load_shallow(struct elf_module *module, Elf32_Off offset) { CHECKED(res, check_header_shallow(&elf_hdr), error); CHECKED(res, load_shallow_sections(module, &elf_hdr), error); + module->base_addr = base_addr; // Check the symbols for duplicates / missing definitions CHECKED(res, check_symbols(module), error); - CHECKED(res, offset_symbols(module, offset), error); - // Add the module at the beginning of the module list list_add(&module->list, &modules_head); |