This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
FW: Is there bug in elf64_alpha_copy_indirect_symbol() of binutils/bfd/elf64-alpha.c?
- From: Jiaming Wei <jmwei at hxgpt dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 2 Aug 2016 06:53:08 +0000
- Subject: FW: Is there bug in elf64_alpha_copy_indirect_symbol() of binutils/bfd/elf64-alpha.c?
- Authentication-results: sourceware.org; auth=none
- References: <9ff1d2a9a9bc4d29872509b1e28b3900@hxgpt.com>
Hi,
I am studying elf64-alpha.c. I think there is one bug in the below function.
Because I cannot send mail to Richard Henderson, so I send this mail to you.
static void
elf64_alpha_copy_indirect_symbol (struct bfd_link_info *info,
struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *ind)
{
struct alpha_elf_link_hash_entry *hi = (struct alpha_elf_link_hash_entry *) ind;
struct alpha_elf_link_hash_entry *hs = (struct alpha_elf_link_hash_entry *) dir;
.................................................................................
.................................................................................
if (hs->got_entries == NULL)
hs->got_entries = hi->got_entries;
else
{
struct alpha_elf_got_entry *gi, *gs, *gin, *gsh;
gsh = hs->got_entries;
for (gi = hi->got_entries; gi ; gi = gin)
{
gin = gi->next;
for (gs = gsh; gs ; gs = gs->next)
if (gi->gotobj == gs->gotobj
&& gi->reloc_type == gs->reloc_type
&& gi->addend == gs->addend)
{
gi->use_count += gs->use_count; //<-------------------- Note: Here is not correct. I think it should be written as gs->use_count += gi->use_count
goto got_found;
}
gi->next = hs->got_entries;
hs->got_entries = gi;
got_found:;
}
}
hi->got_entries = NULL;
/* And similar for the reloc entries. */
if (hs->reloc_entries == NULL)
hs->reloc_entries = hi->reloc_entries;
else
{
struct alpha_elf_reloc_entry *ri, *rs, *rin, *rsh;
rsh = hs->reloc_entries;
for (ri = hi->reloc_entries; ri ; ri = rin)
{
rin = ri->next;
for (rs = rsh; rs ; rs = rs->next)
if (ri->rtype == rs->rtype && ri->srel == rs->srel)
{
rs->count += ri->count; //<-------------------- Note: Here is correct.
goto found_reloc;
}
ri->next = hs->reloc_entries;
hs->reloc_entries = ri;
found_reloc:;
}
}
hi->reloc_entries = NULL;
}
Sincerely,
Wei Jiaming