diff options
Diffstat (limited to 'ldso/ldso/sparc/elfinterp.c')
-rw-r--r-- | ldso/ldso/sparc/elfinterp.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/ldso/ldso/sparc/elfinterp.c b/ldso/ldso/sparc/elfinterp.c index 64f769485..e9e55c090 100644 --- a/ldso/ldso/sparc/elfinterp.c +++ b/ldso/ldso/sparc/elfinterp.c @@ -1,7 +1,7 @@ /* vi: set sw=4 ts=4: */ /* sparc ELF shared library loader suppport * - * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, + * Copyright (c) 1994-2000 Eric Youngdale, Peter MacDonald, * David Engel, Hongjiu Lu and Mitch D'Souza * * All rights reserved. @@ -57,7 +57,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt) int reloc_type; Elf32_Rela * this_reloc; char * strtab; - Elf32_Sym * symtab; + Elf32_Sym * symtab; Elf32_Rela * rel_addr; struct elf_resolve * tpnt; int symtab_index; @@ -66,7 +66,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt) unsigned int instr_addr; tpnt = (struct elf_resolve *) plt[2]; - rel_addr = (Elf32_Rela *) (tpnt->dynamic_info[DT_JMPREL] + + rel_addr = (Elf32_Rela *) (tpnt->dynamic_info[DT_JMPREL] + tpnt->loadaddr); /* @@ -108,7 +108,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt) #endif /* Get the address of the GOT entry */ - new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name, + new_addr = _dl_find_hash(strtab + symtab[symtab_index].st_name, tpnt->symbol_scope, tpnt, resolver); if(!new_addr) { _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", @@ -123,7 +123,7 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt) { _dl_dprintf(_dl_debug_file, "\nresolve function: %s", strtab + symtab[symtab_index].st_name); - if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, + if(_dl_debug_detail) _dl_dprintf(_dl_debug_file, "\tpatch %x ==> %x @ %x", *got_addr, new_addr, got_addr); } } @@ -142,15 +142,17 @@ unsigned int _dl_linux_resolver(unsigned int reloc_entry, unsigned int * plt) return (unsigned int) new_addr; } -void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, int rel_addr, - int rel_size, int type){ +void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, + unsigned long rel_addr, unsigned long rel_size, int type) +{ int i; char * strtab; int reloc_type; int symtab_index; - Elf32_Sym * symtab; + Elf32_Sym * symtab; Elf32_Rela * rpnt; unsigned int * reloc_addr; + struct elf_resolve * tpnt = rpnt->dyn; /* Now parse the relocation information */ rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); @@ -187,17 +189,19 @@ void _dl_parse_lazy_relocation_information(struct elf_resolve * tpnt, int rel_ad }; } -int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr, - int rel_size, int type){ +int _dl_parse_relocation_information(struct dyn_elf *rpnt, + unsigned long rel_addr, unsigned long rel_size, int type) +{ int i; char * strtab; int reloc_type; int goof = 0; - Elf32_Sym * symtab; + Elf32_Sym * symtab; Elf32_Rela * rpnt; unsigned int * reloc_addr; unsigned int symbol_addr; int symtab_index; + struct elf_resolve * tpnt = rpnt->dyn; /* Now parse the relocation information */ rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); @@ -215,11 +219,11 @@ int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr, if(symtab_index) { - if(tpnt->libtype == program_interpreter && + if(tpnt->libtype == program_interpreter && _dl_symbol(strtab + symtab[symtab_index].st_name)) continue; - symbol_addr = (unsigned int) + symbol_addr = (unsigned int) _dl_find_hash(strtab + symtab[symtab_index].st_name, tpnt->symbol_scope, (reloc_type == R_SPARC_JMP_SLOT ? tpnt : NULL), symbolrel); @@ -274,7 +278,7 @@ int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr, if(symtab_index) _dl_dprintf(2, strtab + symtab[symtab_index].st_name); _dl_dprintf(2, "\n"); _dl_memcpy((void *) symtab[symtab_index].st_value, - (void *) symbol_addr, + (void *) symbol_addr, symtab[symtab_index].st_size); #endif break; @@ -302,14 +306,14 @@ int _dl_parse_relocation_information(struct elf_resolve * tpnt, int rel_addr, /* No, there are cases where the SVr4 linker fails to emit COPY relocs at all */ -int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr, - int rel_size, int type) +int _dl_parse_copy_information(struct dyn_elf *xpnt, + unsigned long rel_addr, unsigned long rel_size, int type) { int i; char * strtab; int reloc_type; int goof = 0; - Elf32_Sym * symtab; + Elf32_Sym * symtab; Elf32_Rela * rpnt; unsigned int * reloc_addr; unsigned int symbol_addr; @@ -318,7 +322,7 @@ int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr, /* Now parse the relocation information */ tpnt = xpnt->dyn; - + rpnt = (Elf32_Rela *) (rel_addr + tpnt->loadaddr); symtab = (Elf32_Sym *) (tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr); @@ -333,11 +337,11 @@ int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr, if(!symtab_index && tpnt->libtype == program_interpreter) continue; if(symtab_index) { - if(tpnt->libtype == program_interpreter && + if(tpnt->libtype == program_interpreter && _dl_symbol(strtab + symtab[symtab_index].st_name)) continue; - symbol_addr = (unsigned int) + symbol_addr = (unsigned int) _dl_find_hash(strtab + symtab[symtab_index].st_name, xpnt->next, NULL, copyrel); if(!symbol_addr) { @@ -347,8 +351,8 @@ int _dl_parse_copy_information(struct dyn_elf * xpnt, int rel_addr, }; }; if (!goof) - _dl_memcpy((char *) symtab[symtab_index].st_value, - (char *) symbol_addr, + _dl_memcpy((char *) symtab[symtab_index].st_value, + (char *) symbol_addr, symtab[symtab_index].st_size); }; return goof; |