FreeBSD/contrib/binutils/ld/ldmain.c
/* This is called by warning_callback for each section.  It checks the
   relocs of the section to see if it can find a reference to the
   symbol which triggered the warning.  If it can, it uses the reloc
   to give an error message with a file and line number.  */
This is called by warning_callback for each section.  It checks the
relocs of the section to see if it can find a reference to the
symbol which triggered the warning.  If it can, it uses the reloc
to give an error message with a file and line number.
This is called by warning_callback for each section . It checks the relocs of the section to see if it can find a reference to the symbol which triggered the warning . If it can it uses the reloc to give an error message with a file and line number .
static void
warning_find_reloc (bfd *abfd, asection *sec, void *iarg)
{
  struct warning_callback_info *info = iarg;
  long relsize;
  arelent **relpp;
  long relcount;
  arelent **p, **pend;
  if (info->found)
    return;
  relsize = bfd_get_reloc_upper_bound (abfd, sec);
  if (relsize < 0)
    einfo (_("%B%F: could not read relocs: %E\n"), abfd);
  if (relsize == 0)
    return;
  relpp = xmalloc (relsize);
  relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols);
  if (relcount < 0)
    einfo (_("%B%F: could not read relocs: %E\n"), abfd);
  p = relpp;
  pend = p + relcount;
  for (; p < pend && *p != NULL; p++)
    {
      arelent *q = *p;
      if (q->sym_ptr_ptr != NULL
	  && *q->sym_ptr_ptr != NULL
	  && strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), info->symbol) == 0)
	{
	  einfo ("%C: %s%s\n", abfd, sec, q->address, _("warning: "),
		 info->warning);
	  info->found = TRUE;
	  break;
	}
    }
  free (relpp);
}
static void warning_find_reloc ( bfd * abfd , asection * sec , void * iarg ) { struct warning_callback_info * info = iarg ; long relsize ; arelent * * relpp ; long relcount ; arelent * * p , * * pend ; if ( info -> found ) return ; relsize = bfd_get_reloc_upper_bound ( abfd , sec ) ; if ( relsize < 0 ) einfo ( _ ( " \n " ) , abfd ) ; if ( relsize == 0 ) return ; relpp = xmalloc ( relsize ) ; relcount = bfd_canonicalize_reloc ( abfd , sec , relpp , info -> asymbols ) ; if ( relcount < 0 ) einfo ( _ ( " \n " ) , abfd ) ; p = relpp ; pend = p + relcount ; for ( ; p < pend && * p != NULL ; p ++ ) { arelent * q = * p ; if ( q -> sym_ptr_ptr != NULL && * q -> sym_ptr_ptr != NULL && strcmp ( bfd_asymbol_name ( * q -> sym_ptr_ptr ) , info -> symbol ) == 0 ) { einfo ( " \n " , abfd , sec , q -> address , _ ( " " ) , info -> warning ) ; info -> found = TRUE ; break ; } } free ( relpp ) ; }
This is called by warning_callback for each section.
This is called by warning_callback for each section .
/* We found a reloc for the symbol we are looking for.  */