From 4ec89b87bc0eea8d9ca6b50564d12eeb3b1b0119 Mon Sep 17 00:00:00 2001 From: Filippo Arcidiacono Date: Mon, 11 Oct 2010 12:56:21 +0200 Subject: ldso: Extend prelink support for all other achitectures Update Arch specific part of the dynamic linker to the latest cahnges required by prelink: - Use _dl_loaded_modules->scope as global symbol scope - Pass the sym argument (or NULL) to the _dl_find_hash - Update _dl_parse, _dl_do_reloc, _dl_do_lazy_reloc and _dl_parse_relocation_information to reflect the change of the scope argument's type - Add the call to _dl_debug_lookup used for trace prelinking. Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- ldso/ldso/avr32/elfinterp.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'ldso/ldso/avr32') diff --git a/ldso/ldso/avr32/elfinterp.c b/ldso/ldso/avr32/elfinterp.c index 797f8513e..e741fd60e 100644 --- a/ldso/ldso/avr32/elfinterp.c +++ b/ldso/ldso/avr32/elfinterp.c @@ -51,8 +51,8 @@ unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got) symname = strtab + sym->st_name; new_addr = (unsigned long) _dl_find_hash(strtab + sym->st_name, - tpnt->symbol_scope, tpnt, - resolver); + &_dl_loaded_modules->symbol_scope, tpnt, + NULL, 0, resolver); entry = (unsigned long *)(got + local_gotno + sym_index - gotsym); *entry = new_addr; @@ -63,9 +63,9 @@ unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got) } static int -_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, +_dl_parse(struct elf_resolve *tpnt, struct r_scope_elem *scope, unsigned long rel_addr, unsigned long rel_size, - int (*reloc_func)(struct elf_resolve *tpnt, struct dyn_elf *scope, + int (*reloc_func)(struct elf_resolve *tpnt, struct r_scope_elem *scope, Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab)) { Elf32_Sym *symtab; @@ -116,7 +116,7 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, return 0; } -static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, +static int _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope, Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab) { int reloc_type; @@ -128,6 +128,8 @@ static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, unsigned long old_val; #endif + struct sym_val current_value = { NULL, NULL }; + reloc_addr = (unsigned long *)(tpnt->loadaddr + rpnt->r_offset); reloc_type = ELF32_R_TYPE(rpnt->r_info); symtab_index = ELF32_R_SYM(rpnt->r_info); @@ -137,7 +139,7 @@ static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, if (symtab_index) { symbol_addr = (unsigned long) _dl_find_hash(strtab + symtab[symtab_index].st_name, - tpnt->symbol_scope, tpnt, + scope, tpnt, ¤t_value, elf_machine_type_class(reloc_type), NULL); /* Allow undefined references to weak symbols */ @@ -147,6 +149,9 @@ static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope, _dl_progname, symname); return 0; } + if (_dl_trace_prelink) + _dl_debug_lookup (symname, tpnt, &symtab[symtab_index], + ¤t_value, elf_machine_type_class(reloc_type)); } #if defined(__SUPPORT_LD_DEBUG__) @@ -185,9 +190,10 @@ void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, } int _dl_parse_relocation_information(struct dyn_elf *rpnt, + struct r_scope_elem *scope, unsigned long rel_addr, unsigned long rel_size) { - return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size, + return _dl_parse(rpnt->dyn, scope, rel_addr, rel_size, _dl_do_reloc); } -- cgit v1.2.3