svn commit: trunk/uClibc/ldso/ldso
Peter Kjellerstedt
peter.kjellerstedt at axis.com
Mon Mar 10 08:28:37 UTC 2008
> -----Original Message-----
> From: uclibc-cvs-bounces at uclibc.org
> [mailto:uclibc-cvs-bounces at uclibc.org] On Behalf Of carmelo at uclibc.org
> Sent: den 9 mars 2008 08:07
> To: uclibc-cvs at uclibc.org
> Subject: svn commit: trunk/uClibc/ldso/ldso
>
> Author: carmelo
> Date: 2008-03-08 23:07:20 -0800 (Sat, 08 Mar 2008)
> New Revision: 21278
>
> Log:
> Khem Raj <kraj at mvista.com> writes:
> While compiling trunk on ARM with GCC 4.2 and enabling
> LDSO_GNU_HASH_SUPPORT I stumbled upon this problem.
> GCC made a call to libgcc function
> __aeabi_uidivmod()->__div0()->__raise() and raise is not yet
> compiled in at the time of compiling ldso
> so I got well known undefined symbol __raise problem
>
> This patch uses the do_rem () macro to do the same operation.
>
> Modified:
> trunk/uClibc/ldso/ldso/dl-hash.c
>
> Changeset:
> Modified: trunk/uClibc/ldso/ldso/dl-hash.c
> ===================================================================
> --- trunk/uClibc/ldso/ldso/dl-hash.c 2008-03-08 21:33:40 UTC
> (rev 21277)
> +++ trunk/uClibc/ldso/ldso/dl-hash.c 2008-03-09 07:07:20 UTC
> (rev 21278)
> @@ -204,11 +204,12 @@
>
> unsigned int hashbit1 = hash & (__ELF_NATIVE_CLASS - 1);
> unsigned int hashbit2 = ((hash >> tpnt->l_gnu_shift) &
(__ELF_NATIVE_CLASS - 1));
> -
> + unsigned long rem;
> + do_rem (rem, hash, tpnt->nbucket);
> _dl_assert (bitmask != NULL);
>
> if (unlikely((bitmask_word >> hashbit1) & (bitmask_word >>
hashbit2) & 1)) {
> - Elf32_Word bucket = tpnt->l_gnu_buckets[hash %
tpnt->nbucket];
> + Elf32_Word bucket = tpnt->l_gnu_buckets[rem];
>
> if (bucket != 0) {
> const Elf32_Word *hasharr =
&tpnt->l_gnu_chain_zero[bucket];
You should move the calculation of rem to within the if statement,
since the modulo operation is time consuming and the if statement
is marked as unlikely(), i.e.:
if (unlikely((bitmask_word >> hashbit1) & (bitmask_word >>
hashbit2) & 1)) {
Elf32_Word bucket;
unsigned long rem;
do_rem(rem, hash, tpnt->nbucket);
bucket = tpnt->l_gnu_buckets[rem];
//Peter
More information about the uClibc
mailing list