[PATCH] Remove divide from _ELF_DYNAMIC_DO_RELOC

Carlos O'Donell carlos@redhat.com
Fri May 23 14:40:00 GMT 2014


On 04/11/2014 05:37 AM, Chung-Lin Tang wrote:
> 2014-04-11  Chung-Lin Tang  <cltang@codesourcery.com>
> 
> 	* elf/dynamic-link.h (_ELF_DYNAMIC_DO_RELOC): Remove MIN() and
> 	assign raw DT_REL[A]COUNT value to ranges[0].nrelative.
 
OK with changes.
 
> diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
> index 7b3e295..34ef88a 100644
> --- a/elf/dynamic-link.h
> +++ b/elf/dynamic-link.h
> @@ -122,8 +122,7 @@ elf_machine_lazy_rel (struct link_map *map,
>  	ranges[0].size = (map)->l_info[DT_##RELOC##SZ]->d_un.d_val;	      \
>  	if (map->l_info[VERSYMIDX (DT_##RELOC##COUNT)] != NULL)		      \
>  	  ranges[0].nrelative						      \
> -	    = MIN (map->l_info[VERSYMIDX (DT_##RELOC##COUNT)]->d_un.d_val,    \
> -		   ranges[0].size / sizeof (ElfW(reloc)));		      \
> +	    = map->l_info[VERSYMIDX (DT_##RELOC##COUNT)]->d_un.d_val;	      \
>        }									      \
>      if ((map)->l_info[DT_PLTREL]					      \
>  	&& (!test_rel || (map)->l_info[DT_PLTREL]->d_un.d_val == DT_##RELOC)) \

Please add a top-level comment saying that 'COUNT', when present, overrides the
use of 'SZ' to compute the size of the range.

OK with that.

Should we assert if SZ/sizeof(ElfW(reloc)) != COUNT?

Cheers,
Carlos.



More information about the Libc-alpha mailing list