[PATCH] _dl_find_hash: optmizie symbol lookup delaying stringcomparisons

Carmelo AMOROSO carmelo.amoroso at st.com
Fri Sep 21 05:18:58 PDT 2007


Joakim Tjernlund wrote:
> Hi Carmelo
>
> This has been up before and I am not convinced it is a gain.
> The if (sym->st_value == 0) and if (ELF_ST_TYPE(sym->st_info) > STT_FUNC)
> are mostly false.
>
> Suggest you get some numbers before applying this patch.
>   
Yes, sure... this is on my plan.
Anyway the order is the same as glibc (elf/do-lookup.h:check_match), 
that doesn't mean is "the right" design,
but it sounded reasonable.

Carmelo
>  Jocke
>
> On Fri, 2007-09-21 at 11:52 +0200, Carmelo AMOROSO wrote:
>   
>> Hi,
>> the attached patch tries to optimize a bit the lookup process
>> into the dynamic linker postponing the string comparisons as late
>> as possible.
>>
>> At the moment I have not figures/benchmarks to be shown; hope to produce
>> some data in the future.
>>
>> Regards,
>> Carmelo
>> plain text document attachment (dl_find_hash-delay-strncmp.patch)
>> Do string comparisos as late as possible during symbol lookup.
>>
>> Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
>>
>> --- uClibc-trunk/ldso/ldso/dl-hash.c	2007-09-19 11:06:45.000000000 +0200
>> +++ uClibc-st/ldso/ldso/dl-hash.c	2007-09-21 11:42:30.837795000 +0200
>> @@ -171,12 +171,12 @@ char *_dl_find_hash(const char *name, st
>>  
>>  			if (type_class & (sym->st_shndx == SHN_UNDEF))
>>  				continue;
>> -			if (_dl_strcmp(strtab + sym->st_name, name) != 0)
>> -				continue;
>>  			if (sym->st_value == 0)
>>  				continue;
>>  			if (ELF_ST_TYPE(sym->st_info) > STT_FUNC)
>>  				continue;
>> +			if (_dl_strcmp(strtab + sym->st_name, name) != 0)
>> +				continue;
>>  
>>  			switch (ELF_ST_BIND(sym->st_info)) {
>>  			case STB_WEAK:
>> _______________________________________________
>> uClibc mailing list
>> uClibc at uclibc.org
>> http://busybox.net/cgi-bin/mailman/listinfo/uclibc
>>     
>
>
>
>   



More information about the uClibc mailing list