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]

Re: bfd_link_hash_traverse


Alan Modra <amodra@gmail.com> writes:

> +  for (i = 0; i < htab->table.size; i++)
> +    {
> +      struct bfd_link_hash_entry *p;
> +
> +      p = (struct bfd_link_hash_entry *) htab->table.table[i];
> +      for (; p != NULL; p = (struct bfd_link_hash_entry *) p->root.next)
> +	if (!(*func) (p->type == bfd_link_hash_warning ? p->u.i.link : p, info))
> +	  goto out;
> +    }

I believe it is technically possible to have two warnings on a single
symbol, which I believe will show up as a warning symbol pointing to a
warning symbol pointing to a real symbol.  That's why the linker code is
littered with loops like

  while (h->root.type == bfd_link_hash_indirect
	 || h->root.type == bfd_link_hash_warning)
    h = (struct elf_link_hash_entry *) h->root.u.i.link;

You probably want to have such a loop here.

Ian


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