OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [bfd/] [elflink.c] - Diff between revs 14 and 148

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 148
Line 284... Line 284...
    }
    }
 
 
  /* Let the backend create the rest of the sections.  This lets the
  /* Let the backend create the rest of the sections.  This lets the
     backend set the right flags.  The backend will normally create
     backend set the right flags.  The backend will normally create
     the .got and .plt sections.  */
     the .got and .plt sections.  */
  if (! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
  if (bed->elf_backend_create_dynamic_sections == NULL
 
      || ! (*bed->elf_backend_create_dynamic_sections) (abfd, info))
    return FALSE;
    return FALSE;
 
 
  elf_hash_table (info)->dynamic_sections_created = TRUE;
  elf_hash_table (info)->dynamic_sections_created = TRUE;
 
 
  return TRUE;
  return TRUE;
Line 719... Line 720...
elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
elf_link_renumber_hash_table_dynsyms (struct elf_link_hash_entry *h,
                                      void *data)
                                      void *data)
{
{
  size_t *count = (size_t *) data;
  size_t *count = (size_t *) data;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  if (h->forced_local)
  if (h->forced_local)
    return TRUE;
    return TRUE;
 
 
  if (h->dynindx != -1)
  if (h->dynindx != -1)
    h->dynindx = ++(*count);
    h->dynindx = ++(*count);
Line 741... Line 739...
elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h,
elf_link_renumber_local_hash_table_dynsyms (struct elf_link_hash_entry *h,
                                            void *data)
                                            void *data)
{
{
  size_t *count = (size_t *) data;
  size_t *count = (size_t *) data;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  if (!h->forced_local)
  if (!h->forced_local)
    return TRUE;
    return TRUE;
 
 
  if (h->dynindx != -1)
  if (h->dynindx != -1)
    h->dynindx = ++(*count);
    h->dynindx = ++(*count);
Line 1809... Line 1804...
static bfd_boolean
static bfd_boolean
_bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
_bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
{
{
  struct elf_info_failed *eif = (struct elf_info_failed *) data;
  struct elf_info_failed *eif = (struct elf_info_failed *) data;
 
 
  /* Ignore this if we won't export it.  */
 
  if (!eif->info->export_dynamic && !h->dynamic)
 
    return TRUE;
 
 
 
  /* Ignore indirect symbols.  These are added by the versioning code.  */
  /* Ignore indirect symbols.  These are added by the versioning code.  */
  if (h->root.type == bfd_link_hash_indirect)
  if (h->root.type == bfd_link_hash_indirect)
    return TRUE;
    return TRUE;
 
 
  if (h->root.type == bfd_link_hash_warning)
  /* Ignore this if we won't export it.  */
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
  if (!eif->info->export_dynamic && !h->dynamic)
 
    return TRUE;
 
 
  if (h->dynindx == -1
  if (h->dynindx == -1
      && (h->def_regular
      && (h->def_regular
          || h->ref_regular))
          || h->ref_regular))
    {
    {
Line 1855... Line 1847...
  struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data;
  struct elf_find_verdep_info *rinfo = (struct elf_find_verdep_info *) data;
  Elf_Internal_Verneed *t;
  Elf_Internal_Verneed *t;
  Elf_Internal_Vernaux *a;
  Elf_Internal_Vernaux *a;
  bfd_size_type amt;
  bfd_size_type amt;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  /* We only care about symbols defined in shared objects with version
  /* We only care about symbols defined in shared objects with version
     information.  */
     information.  */
  if (!h->def_dynamic
  if (!h->def_dynamic
      || h->def_regular
      || h->def_regular
      || h->dynindx == -1
      || h->dynindx == -1
Line 1943... Line 1932...
  bfd_size_type amt;
  bfd_size_type amt;
 
 
  sinfo = (struct elf_info_failed *) data;
  sinfo = (struct elf_info_failed *) data;
  info = sinfo->info;
  info = sinfo->info;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  /* Fix the symbol flags.  */
  /* Fix the symbol flags.  */
  eif.failed = FALSE;
  eif.failed = FALSE;
  eif.info = info;
  eif.info = info;
  if (! _bfd_elf_fix_symbol_flags (h, &eif))
  if (! _bfd_elf_fix_symbol_flags (h, &eif))
    {
    {
Line 2561... Line 2547...
  const struct elf_backend_data *bed;
  const struct elf_backend_data *bed;
 
 
  if (! is_elf_hash_table (eif->info->hash))
  if (! is_elf_hash_table (eif->info->hash))
    return FALSE;
    return FALSE;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    {
 
      h->got = elf_hash_table (eif->info)->init_got_offset;
 
      h->plt = elf_hash_table (eif->info)->init_plt_offset;
 
 
 
      /* When warning symbols are created, they **replace** the "real"
 
         entry in the hash table, thus we never get to see the real
 
         symbol in a hash traversal.  So look at it now.  */
 
      h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
    }
 
 
 
  /* Ignore indirect symbols.  These are added by the versioning code.  */
  /* Ignore indirect symbols.  These are added by the versioning code.  */
  if (h->root.type == bfd_link_hash_indirect)
  if (h->root.type == bfd_link_hash_indirect)
    return TRUE;
    return TRUE;
 
 
  /* Fix the symbol flags.  */
  /* Fix the symbol flags.  */
Line 2727... Line 2702...
static bfd_boolean
static bfd_boolean
_bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data)
_bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data)
{
{
  asection *sec;
  asection *sec;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  if ((h->root.type == bfd_link_hash_defined
  if ((h->root.type == bfd_link_hash_defined
       || h->root.type == bfd_link_hash_defweak)
       || h->root.type == bfd_link_hash_defweak)
      && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
      && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
      && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
      && sec->sec_info_type == ELF_INFO_TYPE_MERGE)
    {
    {
Line 3177... Line 3149...
static bfd_boolean
static bfd_boolean
elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *data)
elf_adjust_dynstr_offsets (struct elf_link_hash_entry *h, void *data)
{
{
  struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
  struct elf_strtab_hash *dynstr = (struct elf_strtab_hash *) data;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  if (h->dynindx != -1)
  if (h->dynindx != -1)
    h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
    h->dynstr_index = _bfd_elf_strtab_offset (dynstr, h->dynstr_index);
  return TRUE;
  return TRUE;
}
}
 
 
Line 4909... Line 4878...
{
{
  struct elf_link_hash_entry *h;
  struct elf_link_hash_entry *h;
  char *p, *copy;
  char *p, *copy;
  size_t len, first;
  size_t len, first;
 
 
  h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, FALSE);
  h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE, TRUE);
  if (h != NULL)
  if (h != NULL)
    return h;
    return h;
 
 
  /* If this is a default version (the name contains @@), look up the
  /* If this is a default version (the name contains @@), look up the
     symbol again with only one `@' as well as without the version.
     symbol again with only one `@' as well as without the version.
Line 4932... Line 4901...
 
 
  first = p - name + 1;
  first = p - name + 1;
  memcpy (copy, name, first);
  memcpy (copy, name, first);
  memcpy (copy + first, name + first + 1, len - first);
  memcpy (copy + first, name + first + 1, len - first);
 
 
  h = elf_link_hash_lookup (elf_hash_table (info), copy, FALSE, FALSE, FALSE);
  h = elf_link_hash_lookup (elf_hash_table (info), copy, FALSE, FALSE, TRUE);
  if (h == NULL)
  if (h == NULL)
    {
    {
      /* We also need to check references to the symbol without the
      /* We also need to check references to the symbol without the
         version.  */
         version.  */
      copy[first - 1] = '\0';
      copy[first - 1] = '\0';
      h = elf_link_hash_lookup (elf_hash_table (info), copy,
      h = elf_link_hash_lookup (elf_hash_table (info), copy,
                                FALSE, FALSE, FALSE);
                                FALSE, FALSE, TRUE);
    }
    }
 
 
  bfd_release (abfd, copy);
  bfd_release (abfd, copy);
  return h;
  return h;
}
}
Line 5172... Line 5141...
  const char *name;
  const char *name;
  char *p;
  char *p;
  unsigned long ha;
  unsigned long ha;
  char *alc = NULL;
  char *alc = NULL;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  /* Ignore indirect symbols.  These are added by the versioning code.  */
  /* Ignore indirect symbols.  These are added by the versioning code.  */
  if (h->dynindx == -1)
  if (h->dynindx == -1)
    return TRUE;
    return TRUE;
 
 
  name = h->root.root.string;
  name = h->root.root.string;
Line 5243... Line 5209...
  const char *name;
  const char *name;
  char *p;
  char *p;
  unsigned long ha;
  unsigned long ha;
  char *alc = NULL;
  char *alc = NULL;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  /* Ignore indirect symbols.  These are added by the versioning code.  */
  /* Ignore indirect symbols.  These are added by the versioning code.  */
  if (h->dynindx == -1)
  if (h->dynindx == -1)
    return TRUE;
    return TRUE;
 
 
  /* Ignore also local symbols and undefined symbols.  */
  /* Ignore also local symbols and undefined symbols.  */
Line 5296... Line 5259...
{
{
  struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data;
  struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data;
  unsigned long int bucket;
  unsigned long int bucket;
  unsigned long int val;
  unsigned long int val;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  /* Ignore indirect symbols.  */
  /* Ignore indirect symbols.  */
  if (h->dynindx == -1)
  if (h->dynindx == -1)
    return TRUE;
    return TRUE;
 
 
  /* Ignore also local symbols and undefined symbols.  */
  /* Ignore also local symbols and undefined symbols.  */
Line 8602... Line 8562...
   anything that might have been forced to local scope in a version
   anything that might have been forced to local scope in a version
   script.  The second time we output the symbols that are still
   script.  The second time we output the symbols that are still
   global symbols.  */
   global symbols.  */
 
 
static bfd_boolean
static bfd_boolean
elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
{
{
 
  struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) bh;
  struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
  struct elf_outext_info *eoinfo = (struct elf_outext_info *) data;
  struct elf_final_link_info *finfo = eoinfo->finfo;
  struct elf_final_link_info *finfo = eoinfo->finfo;
  bfd_boolean strip;
  bfd_boolean strip;
  Elf_Internal_Sym sym;
  Elf_Internal_Sym sym;
  asection *input_sec;
  asection *input_sec;
Line 10819... Line 10780...
     some global symbols were, in fact, converted to become local.
     some global symbols were, in fact, converted to become local.
     FIXME: Will this work correctly with the Irix 5 linker?  */
     FIXME: Will this work correctly with the Irix 5 linker?  */
  eoinfo.failed = FALSE;
  eoinfo.failed = FALSE;
  eoinfo.finfo = &finfo;
  eoinfo.finfo = &finfo;
  eoinfo.localsyms = TRUE;
  eoinfo.localsyms = TRUE;
  elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
  bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo);
                          &eoinfo);
 
  if (eoinfo.failed)
  if (eoinfo.failed)
    return FALSE;
    return FALSE;
 
 
  /* If backend needs to output some local symbols not present in the hash
  /* If backend needs to output some local symbols not present in the hash
     table, do it now.  */
     table, do it now.  */
Line 10929... Line 10889...
 
 
  /* We get the global symbols from the hash table.  */
  /* We get the global symbols from the hash table.  */
  eoinfo.failed = FALSE;
  eoinfo.failed = FALSE;
  eoinfo.localsyms = FALSE;
  eoinfo.localsyms = FALSE;
  eoinfo.finfo = &finfo;
  eoinfo.finfo = &finfo;
  elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
  bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo);
                          &eoinfo);
 
  if (eoinfo.failed)
  if (eoinfo.failed)
    return FALSE;
    return FALSE;
 
 
  /* If backend needs to output some symbols not present in the hash
  /* If backend needs to output some symbols not present in the hash
     table, do it now.  */
     table, do it now.  */
Line 11146... Line 11105...
                {
                {
                  (*_bfd_error_handler)
                  (*_bfd_error_handler)
                    (_("%B: could not find output section %s"), abfd, name);
                    (_("%B: could not find output section %s"), abfd, name);
                  goto error_return;
                  goto error_return;
                }
                }
 
              if (elf_section_data (o->output_section)->this_hdr.sh_type == SHT_NOTE)
 
                {
 
                  (*_bfd_error_handler)
 
                    (_("warning: section '%s' is being made into a note"), name);
 
                  bfd_set_error (bfd_error_nonrepresentable_section);
 
                  goto error_return;
 
                }
              dyn.d_un.d_ptr = o->vma;
              dyn.d_un.d_ptr = o->vma;
              break;
              break;
 
 
            case DT_REL:
            case DT_REL:
            case DT_RELA:
            case DT_RELA:
Line 11233... Line 11199...
            continue;
            continue;
          if (elf_hash_table (info)->eh_info.hdr_sec == o)
          if (elf_hash_table (info)->eh_info.hdr_sec == o)
            continue;
            continue;
          if ((elf_section_data (o->output_section)->this_hdr.sh_type
          if ((elf_section_data (o->output_section)->this_hdr.sh_type
               != SHT_STRTAB)
               != SHT_STRTAB)
              || strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0)
              && (strcmp (bfd_get_section_name (abfd, o), ".dynstr") != 0))
            {
            {
              /* FIXME: octets_per_byte.  */
              /* FIXME: octets_per_byte.  */
              if (! bfd_set_section_contents (abfd, o->output_section,
              if (! bfd_set_section_contents (abfd, o->output_section,
                                              o->contents,
                                              o->contents,
                                              (file_ptr) o->output_offset,
                                              (file_ptr) o->output_offset,
Line 11677... Line 11643...
};
};
 
 
static bfd_boolean
static bfd_boolean
elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
{
{
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  if ((h->root.type == bfd_link_hash_defined
  if ((h->root.type == bfd_link_hash_defined
       || h->root.type == bfd_link_hash_defweak)
       || h->root.type == bfd_link_hash_defweak)
      && !h->root.u.def.section->gc_mark
      && !h->root.u.def.section->gc_mark
      && !(h->root.u.def.section->owner->flags & DYNAMIC))
      && !(h->root.u.def.section->owner->flags & DYNAMIC))
    {
    {
Line 11726... Line 11689...
            {
            {
              asection *first = elf_next_in_group (o);
              asection *first = elf_next_in_group (o);
              o->gc_mark = first->gc_mark;
              o->gc_mark = first->gc_mark;
            }
            }
          else if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0
          else if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0
                   || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0
                   || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0)
                   || elf_section_data (o)->this_hdr.sh_type == SHT_NOTE)
 
            {
            {
              /* Keep debug, special and SHT_NOTE sections.  */
              /* Keep debug and special sections.  */
              o->gc_mark = 1;
              o->gc_mark = 1;
            }
            }
 
 
          if (o->gc_mark)
          if (o->gc_mark)
            continue;
            continue;
Line 11792... Line 11754...
   elf_link_hash_traverse.  */
   elf_link_hash_traverse.  */
 
 
static bfd_boolean
static bfd_boolean
elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
{
{
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  /* Those that are not vtables.  */
  /* Those that are not vtables.  */
  if (h->vtable == NULL || h->vtable->parent == NULL)
  if (h->vtable == NULL || h->vtable->parent == NULL)
    return TRUE;
    return TRUE;
 
 
  /* Those vtables that do not have parents, we cannot merge.  */
  /* Those vtables that do not have parents, we cannot merge.  */
Line 11856... Line 11815...
  bfd_vma hstart, hend;
  bfd_vma hstart, hend;
  Elf_Internal_Rela *relstart, *relend, *rel;
  Elf_Internal_Rela *relstart, *relend, *rel;
  const struct elf_backend_data *bed;
  const struct elf_backend_data *bed;
  unsigned int log_file_align;
  unsigned int log_file_align;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  /* Take care of both those symbols that do not describe vtables as
  /* Take care of both those symbols that do not describe vtables as
     well as those that are not loaded.  */
     well as those that are not loaded.  */
  if (h->vtable == NULL || h->vtable->parent == NULL)
  if (h->vtable == NULL || h->vtable->parent == NULL)
    return TRUE;
    return TRUE;
 
 
Line 11906... Line 11862...
bfd_boolean
bfd_boolean
bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
{
{
  struct bfd_link_info *info = (struct bfd_link_info *) inf;
  struct bfd_link_info *info = (struct bfd_link_info *) inf;
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  if ((h->root.type == bfd_link_hash_defined
  if ((h->root.type == bfd_link_hash_defined
       || h->root.type == bfd_link_hash_defweak)
       || h->root.type == bfd_link_hash_defweak)
      && (h->ref_dynamic
      && (h->ref_dynamic
          || (!info->executable
          || (!info->executable
              && h->def_regular
              && h->def_regular
Line 12011... Line 11964...
      asection *o;
      asection *o;
 
 
      if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
      if (bfd_get_flavour (sub) != bfd_target_elf_flavour)
        continue;
        continue;
 
 
 
      /* Also keep SHT_NOTE sections.  */
      for (o = sub->sections; o != NULL; o = o->next)
      for (o = sub->sections; o != NULL; o = o->next)
        if ((o->flags & (SEC_EXCLUDE | SEC_KEEP)) == SEC_KEEP && !o->gc_mark)
        if ((o->flags & SEC_EXCLUDE) == 0
 
            && ((o->flags & SEC_KEEP) != 0
 
                || elf_section_data (o)->this_hdr.sh_type == SHT_NOTE)
 
            && !o->gc_mark)
          if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
          if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
            return FALSE;
            return FALSE;
    }
    }
 
 
  /* Allow the backend to mark additional target specific sections.  */
  /* Allow the backend to mark additional target specific sections.  */
Line 12177... Line 12134...
{
{
  struct alloc_got_off_arg *gofarg = (struct alloc_got_off_arg *) arg;
  struct alloc_got_off_arg *gofarg = (struct alloc_got_off_arg *) arg;
  bfd *obfd = gofarg->info->output_bfd;
  bfd *obfd = gofarg->info->output_bfd;
  const struct elf_backend_data *bed = get_elf_backend_data (obfd);
  const struct elf_backend_data *bed = get_elf_backend_data (obfd);
 
 
  if (h->root.type == bfd_link_hash_warning)
 
    h = (struct elf_link_hash_entry *) h->root.u.i.link;
 
 
 
  if (h->got.refcount > 0)
  if (h->got.refcount > 0)
    {
    {
      h->got.offset = gofarg->gotoff;
      h->got.offset = gofarg->gotoff;
      gofarg->gotoff += bed->got_elt_size (obfd, gofarg->info, h, NULL, 0);
      gofarg->gotoff += bed->got_elt_size (obfd, gofarg->info, h, NULL, 0);
    }
    }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.