* elflink.c (bfd_elf_size_dynsym_hash_dynstr): Replace bfd_log2
call with expanded old round down version of the function.
2011-04-20 Alan Modra <amodra@gmail.com>
+ * libbfd.c (bfd_log2): Do return rounded up value.
+ * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Replace bfd_log2
+ call with expanded old round down version of the function.
+
* archive.c (_bfd_get_elt_at_filepos): Don't release n_nfd.
* elflink.c (elf_link_add_object_symbols): Delete redundant code.
}
else
{
- unsigned long int maskwords, maskbitslog2;
+ unsigned long int maskwords, maskbitslog2, x;
BFD_ASSERT (cinfo.min_dynindx != -1);
- maskbitslog2 = bfd_log2 (cinfo.nsyms) + 1;
+ x = cinfo.nsyms;
+ maskbitslog2 = 1;
+ while ((x >>= 1) != 0)
+ ++maskbitslog2;
if (maskbitslog2 < 3)
maskbitslog2 = 5;
else if ((1 << (maskbitslog2 - 2)) & cinfo.nsyms)
{
unsigned int result = 0;
- while ((x = (x >> 1)) != 0)
+ if (x <= 1)
+ return result;
+ --x;
+ do
++result;
+ while ((x >>= 1) != 0);
return result;
}