diff options
Diffstat (limited to 'ldso')
-rw-r--r-- | ldso/ldso/sh/elfinterp.c | 77 |
1 files changed, 34 insertions, 43 deletions
diff --git a/ldso/ldso/sh/elfinterp.c b/ldso/ldso/sh/elfinterp.c index 393435bbb..3027a27f8 100644 --- a/ldso/ldso/sh/elfinterp.c +++ b/ldso/ldso/sh/elfinterp.c @@ -61,21 +61,19 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) symtab_index = ELF32_R_SYM(this_reloc->r_info); symtab = (Elf32_Sym *)(intptr_t) tpnt->dynamic_info[DT_SYMTAB]; - strtab = (char *) tpnt->dynamic_info[DT_STRTAB]; + strtab = (char *)tpnt->dynamic_info[DT_STRTAB]; symname = strtab + symtab[symtab_index].st_name; if (unlikely(reloc_type != R_SH_JMP_SLOT)) { - _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n", - _dl_progname); - _dl_exit(1); + _dl_dprintf(2, "%s: Incorrect relocation type in jump relocations\n", + _dl_progname); + _dl_exit(1); } /* Address of jump instruction to fix up */ - instr_addr = ((unsigned long) this_reloc->r_offset + - (unsigned long) tpnt->loadaddr); + instr_addr = (unsigned long) (this_reloc->r_offset + tpnt->loadaddr); got_addr = (char **) instr_addr; - /* Get the address of the GOT entry */ new_addr = _dl_find_hash(symname, tpnt->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT); if (unlikely(!new_addr)) { @@ -84,18 +82,15 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) } #if defined (__SUPPORT_LD_DEBUG__) - if ((unsigned long) got_addr < 0x20000000) - { - if (_dl_debug_bindings) - { + if ((unsigned long) got_addr < 0x20000000) { + if (_dl_debug_bindings) { _dl_dprintf(_dl_debug_file, "\nresolve function: %s", symname); if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, "\n\tpatched %x ==> %x @ %x\n", *got_addr, new_addr, got_addr); } } - if (!_dl_debug_nofixups) { + if (!_dl_debug_nofixups) *got_addr = new_addr; - } #else *got_addr = new_addr; #endif @@ -123,25 +118,24 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, symtab = (Elf32_Sym *)(intptr_t)tpnt->dynamic_info[DT_SYMTAB]; strtab = (char *)tpnt->dynamic_info[DT_STRTAB]; - for (i = 0; i < rel_size; i++, rpnt++) { - int res; + for (i = 0; i < rel_size; i++, rpnt++) { + int res; symtab_index = ELF32_R_SYM(rpnt->r_info); debug_sym(symtab,strtab,symtab_index); debug_reloc(symtab,strtab,rpnt); - res = reloc_fnc (tpnt, scope, rpnt, symtab, strtab); + res = reloc_fnc(tpnt, scope, rpnt, symtab, strtab); - if (res==0) continue; + if (res == 0) continue; _dl_dprintf(2, "\n%s: ",_dl_progname); if (symtab_index) - _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); + _dl_dprintf(2, "symbol '%s': ", strtab + symtab[symtab_index].st_name); - if (unlikely(res <0)) - { - int reloc_type = ELF32_R_TYPE(rpnt->r_info); + if (unlikely(res < 0)) { + int reloc_type = ELF32_R_TYPE(rpnt->r_info); #if defined (__SUPPORT_LD_DEBUG__) _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); #else @@ -149,13 +143,12 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, #endif _dl_exit(-res); } - if (unlikely(res >0)) - { + if (unlikely(res > 0)) { _dl_dprintf(2, "can't resolve symbol\n"); return res; } - } - return 0; + } + return 0; } @@ -163,7 +156,7 @@ static int _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, ELF_RELOC *rpnt, Elf32_Sym *symtab, char *strtab) { - int reloc_type; + int reloc_type; int symtab_index; char *symname; unsigned long *reloc_addr; @@ -176,7 +169,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, reloc_type = ELF32_R_TYPE(rpnt->r_info); symtab_index = ELF32_R_SYM(rpnt->r_info); symbol_addr = 0; - symname = strtab + symtab[symtab_index].st_name; + symname = strtab + symtab[symtab_index].st_name; if (symtab_index) { symbol_addr = (unsigned long) _dl_find_hash(symname, scope, tpnt, @@ -188,17 +181,16 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, * here, so all bases should be covered. */ if (!symbol_addr && ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) { - _dl_dprintf (2, "%s: can't resolve symbol '%s'\n", - _dl_progname, strtab + symtab[symtab_index].st_name); + _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", + _dl_progname, strtab + symtab[symtab_index].st_name); _dl_exit (1); } } - #if defined (__SUPPORT_LD_DEBUG__) old_val = *reloc_addr; #endif - switch (reloc_type) { + switch (reloc_type) { case R_SH_NONE: break; case R_SH_COPY: @@ -226,7 +218,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct dyn_elf *scope, break; default: return -1; /*call _dl_exit(1) */ - } + } #if defined (__SUPPORT_LD_DEBUG__) if(_dl_debug_reloc && _dl_debug_detail) _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); @@ -255,17 +247,17 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct dyn_elf *scope, #if defined (__SUPPORT_LD_DEBUG__) old_val = *reloc_addr; #endif - switch (reloc_type) { - case R_SH_NONE: - break; - case R_SH_JMP_SLOT: - *reloc_addr += (unsigned long) tpnt->loadaddr; - break; - default: - return -1; /*call _dl_exit(1) */ - } + switch (reloc_type) { + case R_SH_NONE: + break; + case R_SH_JMP_SLOT: + *reloc_addr += (unsigned long) tpnt->loadaddr; + break; + default: + return -1; /*call _dl_exit(1) */ + } #if defined (__SUPPORT_LD_DEBUG__) - if(_dl_debug_reloc && _dl_debug_detail) + if(_dl_debug_reloc && _dl_debug_detail) _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x", old_val, *reloc_addr, reloc_addr); #endif return 0; @@ -283,4 +275,3 @@ int _dl_parse_relocation_information(struct dyn_elf *rpnt, { return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, _dl_do_reloc); } - |