[PATCH] ldso:mips: fix symbol lookup for JUMP_SLOT and COPY relocations

Carmelo AMOROSO carmelo.amoroso at st.com
Thu Jan 19 14:42:22 UTC 2012


On 19/01/2012 15.28, Carmelo AMOROSO wrote:
> Fill properly the sym_ref fields when invoking _dl_find_hash to lookup
> symbols
> 
> Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
> ---
>  ldso/ldso/mips/elfinterp.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/ldso/ldso/mips/elfinterp.c b/ldso/ldso/mips/elfinterp.c
> index b748839..5d0eff5 100644
> --- a/ldso/ldso/mips/elfinterp.c
> +++ b/ldso/ldso/mips/elfinterp.c
> @@ -161,7 +161,7 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
>  	unsigned long old_val=0;
>  #endif
>  
> -	struct symbol_ref sym_ref = { NULL, NULL };
> +	struct symbol_ref sym_ref;
>  	/* Now parse the relocation information */
>  	rel_size = rel_size / sizeof(ElfW(Rel));
>  	rpnt = (ELF_RELOC *) rel_addr;
> @@ -187,6 +187,8 @@ int _dl_parse_relocation_information(struct dyn_elf *xpnt,
>  #endif
>  
>  		if (reloc_type == R_MIPS_JUMP_SLOT || reloc_type == R_MIPS_COPY) {
> +			sym_ref.tpnt = NULL;
> +			sym_ref.sym = &symtab[symtab_index];
>  			symbol_addr = (unsigned long)_dl_find_hash(symname,
>  								   scope,
>  								   tpnt,

Khem,
not sure, but this could be a problem. Unfortunately the code that
handle relocations for mips is enough different from all other
architectures.
The symbol scope redesign was mixed with another big change to handle
protected symbols, so the risk of breakage on some archs were high.

Please let me know if it helps.

Thanks,
Carmelo


More information about the uClibc mailing list