FreeBSD/contrib/binutils/bfd/elflink.c
/* Search the symbol table of the archive element of the archive ABFD
   whose archive map contains a mention of SYMDEF, and determine if
   the symbol is defined in this element.  */
Search the symbol table of the archive element of the archive ABFD
whose archive map contains a mention of SYMDEF, and determine if
the symbol is defined in this element.
Search the symbol table of the archive element of the archive ABFD whose archive map contains a mention of SYMDEF and determine if the symbol is defined in this element .
static bfd_boolean
elf_link_is_defined_archive_symbol (bfd * abfd, carsym * symdef)
{
  Elf_Internal_Shdr * hdr;
  bfd_size_type symcount;
  bfd_size_type extsymcount;
  bfd_size_type extsymoff;
  Elf_Internal_Sym *isymbuf;
  Elf_Internal_Sym *isym;
  Elf_Internal_Sym *isymend;
  bfd_boolean result;
  abfd = _bfd_get_elt_at_filepos (abfd, symdef->file_offset);
  if (abfd == NULL)
    return FALSE;
  if (! bfd_check_format (abfd, bfd_object))
    return FALSE;
  if (abfd->archive_pass)
    return FALSE;
  if ((abfd->flags & DYNAMIC) == 0 || elf_dynsymtab (abfd) == 0)
    hdr = &elf_tdata (abfd)->symtab_hdr;
  else
    hdr = &elf_tdata (abfd)->dynsymtab_hdr;
  symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
  if (elf_bad_symtab (abfd))
    {
      extsymcount = symcount;
      extsymoff = 0;
    }
  else
    {
      extsymcount = symcount - hdr->sh_info;
      extsymoff = hdr->sh_info;
    }
  if (extsymcount == 0)
    return FALSE;
  isymbuf = bfd_elf_get_elf_syms (abfd, hdr, extsymcount, extsymoff,
				  NULL, NULL, NULL);
  if (isymbuf == NULL)
    return FALSE;
  result = FALSE;
  for (isym = isymbuf, isymend = isymbuf + extsymcount; isym < isymend; isym++)
    {
      const char *name;
      name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
					      isym->st_name);
      if (name == NULL)
	break;
      if (strcmp (name, symdef->name) == 0)
	{
	  result = is_global_data_symbol_definition (abfd, isym);
	  break;
	}
    }
  free (isymbuf);
  return result;
}
static bfd_boolean elf_link_is_defined_archive_symbol ( bfd * abfd , carsym * symdef ) { Elf_Internal_Shdr * hdr ; bfd_size_type symcount ; bfd_size_type extsymcount ; bfd_size_type extsymoff ; Elf_Internal_Sym * isymbuf ; Elf_Internal_Sym * isym ; Elf_Internal_Sym * isymend ; bfd_boolean result ; abfd = _bfd_get_elt_at_filepos ( abfd , symdef -> file_offset ) ; if ( abfd == NULL ) return FALSE ; if ( ! bfd_check_format ( abfd , bfd_object ) ) return FALSE ; if ( abfd -> archive_pass ) return FALSE ; if ( ( abfd -> flags & DYNAMIC ) == 0 || elf_dynsymtab ( abfd ) == 0 ) hdr = & elf_tdata ( abfd ) -> symtab_hdr ; else hdr = & elf_tdata ( abfd ) -> dynsymtab_hdr ; symcount = hdr -> sh_size / get_elf_backend_data ( abfd ) -> s -> sizeof_sym ; if ( elf_bad_symtab ( abfd ) ) { extsymcount = symcount ; extsymoff = 0 ; } else { extsymcount = symcount - hdr -> sh_info ; extsymoff = hdr -> sh_info ; } if ( extsymcount == 0 ) return FALSE ; isymbuf = bfd_elf_get_elf_syms ( abfd , hdr , extsymcount , extsymoff , NULL , NULL , NULL ) ; if ( isymbuf == NULL ) return FALSE ; result = FALSE ; for ( isym = isymbuf , isymend = isymbuf + extsymcount ; isym < isymend ; isym ++ ) { const char * name ; name = bfd_elf_string_from_elf_section ( abfd , hdr -> sh_link , isym -> st_name ) ; if ( name == NULL ) break ; if ( strcmp ( name , symdef -> name ) == 0 ) { result = is_global_data_symbol_definition ( abfd , isym ) ; break ; } } free ( isymbuf ) ; return result ; }
Search the symbol table of the archive element of the archive ABFD
whose archive map contains a mention of SYMDEF, and determine if
the symbol is defined in this element.
Search the symbol table of the archive element of the archive ABFD whose archive map contains a mention of SYMDEF and determine if the symbol is defined in this element .
/* If we have already included the element containing this symbol in the
     link then we do not need to include it again.  Just claim that any symbol
     it contains is not a definition, so that our caller will not decide to
     (re)include this element.  */ /* Select the appropriate symbol table.  */ /* The sh_info field of the symtab header tells us where the
     external symbols start.  We don't care about the local symbols.  */ /* Read in the symbol table.  */ /* Scan the symbol table looking for SYMDEF.  */