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]

FW: Is there bug in elf64_alpha_copy_indirect_symbol() of binutils/bfd/elf64-alpha.c?


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


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