This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fix DT_GNU_HASH 4th ElfW(Word) value
- From: Jakub Jelinek <jakub at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Fri, 14 Jul 2006 16:36:43 +0200
- Subject: [PATCH] Fix DT_GNU_HASH 4th ElfW(Word) value
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
As Djamel reported to me privately, the cinfo.shift2 computation is wrong,
we would unnecessarily use higher bits than I wanted. Things still work,
but if the bloom filter is too big, we'd more quickly end up using only
fewer bits than the 5 (resp. 6 on 64-bit arches).
If say the bloom filter is 32KB on 64-bit arch, then we use the bottommost
6 bits for bit selection within a 64-bit bitmask word, then 9 bits above
that for selection which 64-bit bitmask word we load.
Now, without this patch, we'd then have 6 bits not used for anything and
then 6 bits for the 2nd bit selection within the 64-bit bitmask word (so
bits 21..26). With this patch, we'll use bits (15..20 for that).
Committed as obvious.
2006-07-14 Jakub Jelinek <jakub@redhat.com>
* elflink.c (bfd_elf_size_dynsym_hash_dynstr): Fix cinfo.shift2 value.
--- bfd/elflink.c.jj 2006-07-14 15:10:57.000000000 +0200
+++ bfd/elflink.c 2006-07-14 15:13:11.000000000 +0200
@@ -6079,7 +6079,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *ou
else
cinfo.shift1 = 5;
cinfo.mask = (1 << cinfo.shift1) - 1;
- cinfo.shift2 = maskbitslog2 + cinfo.shift1;
+ cinfo.shift2 = maskbitslog2;
cinfo.maskbits = 1 << maskbitslog2;
maskwords = 1 << (maskbitslog2 - cinfo.shift1);
amt = bucketcount * sizeof (unsigned long int) * 2;
Jakub