This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix DT_GNU_HASH 4th ElfW(Word) value


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]