FreeBSD/contrib/binutils/bfd/elflink.c
/* Add an entry to the .dynamic table.  */
Add an entry to the .dynamic table.
Add an entry to the . dynamic table .
bfd_boolean
_bfd_elf_add_dynamic_entry (struct bfd_link_info *info,
			    bfd_vma tag,
			    bfd_vma val)
{
  struct elf_link_hash_table *hash_table;
  const struct elf_backend_data *bed;
  asection *s;
  bfd_size_type newsize;
  bfd_byte *newcontents;
  Elf_Internal_Dyn dyn;
  hash_table = elf_hash_table (info);
  if (! is_elf_hash_table (hash_table))
    return FALSE;
  bed = get_elf_backend_data (hash_table->dynobj);
  s = bfd_get_section_by_name (hash_table->dynobj, ".dynamic");
  BFD_ASSERT (s != NULL);
  newsize = s->size + bed->s->sizeof_dyn;
  newcontents = bfd_realloc (s->contents, newsize);
  if (newcontents == NULL)
    return FALSE;
  dyn.d_tag = tag;
  dyn.d_un.d_val = val;
  bed->s->swap_dyn_out (hash_table->dynobj, &dyn, newcontents + s->size);
  s->size = newsize;
  s->contents = newcontents;
  return TRUE;
}
bfd_boolean _bfd_elf_add_dynamic_entry ( struct bfd_link_info * info , bfd_vma tag , bfd_vma val ) { struct elf_link_hash_table * hash_table ; const struct elf_backend_data * bed ; asection * s ; bfd_size_type newsize ; bfd_byte * newcontents ; Elf_Internal_Dyn dyn ; hash_table = elf_hash_table ( info ) ; if ( ! is_elf_hash_table ( hash_table ) ) return FALSE ; bed = get_elf_backend_data ( hash_table -> dynobj ) ; s = bfd_get_section_by_name ( hash_table -> dynobj , " " ) ; BFD_ASSERT ( s != NULL ) ; newsize = s -> size + bed -> s -> sizeof_dyn ; newcontents = bfd_realloc ( s -> contents , newsize ) ; if ( newcontents == NULL ) return FALSE ; dyn . d_tag = tag ; dyn . d_un . d_val = val ; bed -> s -> swap_dyn_out ( hash_table -> dynobj , & dyn , newcontents + s -> size ) ; s -> size = newsize ; s -> contents = newcontents ; return TRUE ; }
Add an entry to the .dynamic table.
Add an entry to the . dynamic table .