[PATCH] ldso/x86_64: support protected symbols

Timo Teräs timo.teras at iki.fi
Tue Apr 27 14:44:43 UTC 2010


Roman I Khimov wrote:
> Fixes dltest with NPTL.
> 
> Signed-off-by: Roman I Khimov <khimov at altell.ru>
> ---
>  ldso/ldso/x86_64/elfinterp.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/ldso/ldso/x86_64/elfinterp.c b/ldso/ldso/x86_64/elfinterp.c
> index 54528d3..ec53c48 100644
> --- a/ldso/ldso/x86_64/elfinterp.c
> +++ b/ldso/ldso/x86_64/elfinterp.c
> @@ -172,7 +172,9 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
>  	symbol_addr = 0;
>  	symname = strtab + sym->st_name;
>  
> -	if (symtab_index) {
> +	if (symtab_index &&
> +		(ELF64_ST_VISIBILITY(symtab[symtab_index].st_other)
> +		 != STV_PROTECTED)) {
>  		symbol_addr = (ElfW(Addr))_dl_find_hash(symname, scope, tpnt,
>  				elf_machine_type_class(reloc_type), &tls_tpnt);
>  		/*
> @@ -189,7 +191,11 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
>  		/* Relocs against STN_UNDEF are usually treated as using a
>  		 * symbol value of zero, and using the module containing the
>  		 * reloc itself. */
> -		symbol_addr = sym->st_value;
> +		if (symtab_index)
> +			symbol_addr = DL_FIND_HASH_VALUE(tpnt, elf_machine_type_class(reloc_type),
> +							 sym);
> +		else
> +			symbol_addr = sym->st_value;
>  		tls_tpnt = tpnt;
>  	}
>  

Joakim had a clean up patch for the above construct. See patch 1/2 of:
  http://lists.uclibc.org/pipermail/uclibc/2010-April/043840.html
(patch 2/2 there is wrong). See also rest of the thread.

For some reason that did not got merged yet. Austin, care to merge
that?

But otherwise looks good.

- Timo


More information about the uClibc mailing list