FreeBSD/contrib/binutils/bfd/elflink.c
/* Record a new dynamic symbol.  We record the dynamic symbols as we
   read the input files, since we need to have a list of all of them
   before we can determine the final sizes of the output sections.
   Note that we may actually call this function even though we are not
   going to output any dynamic symbols; in some cases we know that a
   symbol should be in the dynamic symbol table, but only if there is
   one.  */
Record a new dynamic symbol.  We record the dynamic symbols as we
read the input files, since we need to have a list of all of them
before we can determine the final sizes of the output sections.
Note that we may actually call this function even though we are not
going to output any dynamic symbols; in some cases we know that a
symbol should be in the dynamic symbol table, but only if there is
one.
Record a new dynamic symbol . We record the dynamic symbols as we read the input files since we need to have a list of all of them before we can determine the final sizes of the output sections . Note that we may actually call this function even though we are not going to output any dynamic symbols ; in some cases we know that a symbol should be in the dynamic symbol table but only if there is one .
bfd_boolean
bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
				    struct elf_link_hash_entry *h)
{
  if (h->dynindx == -1)
    {
      struct elf_strtab_hash *dynstr;
      char *p;
      const char *name;
      bfd_size_type indx;
      switch (ELF_ST_VISIBILITY (h->other))
	{
	case STV_INTERNAL:
	case STV_HIDDEN:
	  if (h->root.type != bfd_link_hash_undefined
	      && h->root.type != bfd_link_hash_undefweak)
	    {
	      h->forced_local = 1;
	      if (!elf_hash_table (info)->is_relocatable_executable)
		return TRUE;
	    }
	default:
	  break;
	}
      h->dynindx = elf_hash_table (info)->dynsymcount;
      ++elf_hash_table (info)->dynsymcount;
      dynstr = elf_hash_table (info)->dynstr;
      if (dynstr == NULL)
	{
	  elf_hash_table (info)->dynstr = dynstr = _bfd_elf_strtab_init ();
	  if (dynstr == NULL)
	    return FALSE;
	}
      name = h->root.root.string;
      p = strchr (name, ELF_VER_CHR);
      if (p != NULL)
	*p = 0;
      indx = _bfd_elf_strtab_add (dynstr, name, p != NULL);
      if (p != NULL)
	*p = ELF_VER_CHR;
      if (indx == (bfd_size_type) -1)
	return FALSE;
      h->dynstr_index = indx;
    }
  return TRUE;
}
bfd_boolean bfd_elf_link_record_dynamic_symbol ( struct bfd_link_info * info , struct elf_link_hash_entry * h ) { if ( h -> dynindx == -1 ) { struct elf_strtab_hash * dynstr ; char * p ; const char * name ; bfd_size_type indx ; switch ( ELF_ST_VISIBILITY ( h -> other ) ) { case STV_INTERNAL : case STV_HIDDEN : if ( h -> root . type != bfd_link_hash_undefined && h -> root . type != bfd_link_hash_undefweak ) { h -> forced_local = 1 ; if ( ! elf_hash_table ( info ) -> is_relocatable_executable ) return TRUE ; } default : break ; } h -> dynindx = elf_hash_table ( info ) -> dynsymcount ; ++ elf_hash_table ( info ) -> dynsymcount ; dynstr = elf_hash_table ( info ) -> dynstr ; if ( dynstr == NULL ) { elf_hash_table ( info ) -> dynstr = dynstr = _bfd_elf_strtab_init ( ) ; if ( dynstr == NULL ) return FALSE ; } name = h -> root . root . string ; p = strchr ( name , ELF_VER_CHR ) ; if ( p != NULL ) * p = 0 ; indx = _bfd_elf_strtab_add ( dynstr , name , p != NULL ) ; if ( p != NULL ) * p = ELF_VER_CHR ; if ( indx == ( bfd_size_type ) - 1 ) return FALSE ; h -> dynstr_index = indx ; } return TRUE ; }
Record a new dynamic symbol.
Record a new dynamic symbol .
/* XXX: The ABI draft says the linker must turn hidden and
	 internal symbols into STB_LOCAL symbols when producing the
	 DSO. However, if ld.so honors st_other in the dynamic table,
	 this would not be necessary.  */ /* Create a strtab to hold the dynamic symbol names.  */ /* We don't put any version information in the dynamic string
	 table.  */ /* We know that the p points into writable memory.  In fact,
	   there are only a few symbols that have read-only names, being
	   those like _GLOBAL_OFFSET_TABLE_ that are created specially
	   by the backends.  Most symbols will have names pointing into
	   an ELF string table read from a file, or to objalloc memory.  */