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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [bfd/] [aoutx.h] - Diff between revs 157 and 225

Show entire file | Details | Blame | View Log

Rev 157 Rev 225
Line 1... Line 1...
/* BFD semi-generic back-end for a.out binaries.
/* BFD semi-generic back-end for a.out binaries.
   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
   Free Software Foundation, Inc.
   Free Software Foundation, Inc.
   Written by Cygnus Support.
   Written by Cygnus Support.
 
 
   This file is part of BFD, the Binary File Descriptor library.
   This file is part of BFD, the Binary File Descriptor library.
 
 
Line 462... Line 462...
{
{
  struct aout_data_struct *rawptr, *oldrawptr;
  struct aout_data_struct *rawptr, *oldrawptr;
  const bfd_target *result;
  const bfd_target *result;
  bfd_size_type amt = sizeof (* rawptr);
  bfd_size_type amt = sizeof (* rawptr);
 
 
  rawptr = bfd_zalloc (abfd, amt);
  rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
  if (rawptr == NULL)
  if (rawptr == NULL)
    return NULL;
    return NULL;
 
 
  oldrawptr = abfd->tdata.aout_data;
  oldrawptr = abfd->tdata.aout_data;
  abfd->tdata.aout_data = rawptr;
  abfd->tdata.aout_data = rawptr;
Line 677... Line 677...
  struct aout_data_struct *rawptr;
  struct aout_data_struct *rawptr;
  bfd_size_type amt = sizeof (* rawptr);
  bfd_size_type amt = sizeof (* rawptr);
 
 
  bfd_set_error (bfd_error_system_call);
  bfd_set_error (bfd_error_system_call);
 
 
  rawptr = bfd_zalloc (abfd, amt);
  rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
  if (rawptr == NULL)
  if (rawptr == NULL)
    return FALSE;
    return FALSE;
 
 
  abfd->tdata.aout_data = rawptr;
  abfd->tdata.aout_data = rawptr;
  exec_hdr (abfd) = &(rawptr->e);
  exec_hdr (abfd) = &(rawptr->e);
Line 784... Line 784...
        case bfd_mach_mips4650:
        case bfd_mach_mips4650:
        case bfd_mach_mips8000:
        case bfd_mach_mips8000:
        case bfd_mach_mips9000:
        case bfd_mach_mips9000:
        case bfd_mach_mips10000:
        case bfd_mach_mips10000:
        case bfd_mach_mips12000:
        case bfd_mach_mips12000:
 
        case bfd_mach_mips14000:
 
        case bfd_mach_mips16000:
        case bfd_mach_mips16:
        case bfd_mach_mips16:
        case bfd_mach_mipsisa32:
        case bfd_mach_mipsisa32:
        case bfd_mach_mipsisa32r2:
        case bfd_mach_mipsisa32r2:
        case bfd_mach_mips5:
        case bfd_mach_mips5:
        case bfd_mach_mipsisa64:
        case bfd_mach_mipsisa64:
        case bfd_mach_mipsisa64r2:
        case bfd_mach_mipsisa64r2:
        case bfd_mach_mips_sb1:
        case bfd_mach_mips_sb1:
 
        case bfd_mach_mips_xlr:
          /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc.  */
          /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc.  */
          arch_flags = M_MIPS2;
          arch_flags = M_MIPS2;
          break;
          break;
        default:
        default:
          arch_flags = M_UNKNOWN;
          arch_flags = M_UNKNOWN;
Line 1289... Line 1292...
{
{
  if (obj_aout_external_syms (abfd) == NULL)
  if (obj_aout_external_syms (abfd) == NULL)
    {
    {
      bfd_size_type count;
      bfd_size_type count;
      struct external_nlist *syms;
      struct external_nlist *syms;
      bfd_size_type amt;
 
 
 
      count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
      count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
      if (count == 0)
      if (count == 0)
        return TRUE;            /* Nothing to do.  */
        return TRUE;            /* Nothing to do.  */
 
 
Line 1305... Line 1307...
      syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
      syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
#else
#else
      /* We allocate using malloc to make the values easy to free
      /* We allocate using malloc to make the values easy to free
         later on.  If we put them on the objalloc it might not be
         later on.  If we put them on the objalloc it might not be
         possible to free them.  */
         possible to free them.  */
      syms = bfd_malloc (count * EXTERNAL_NLIST_SIZE);
      syms = (struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE);
      if (syms == NULL)
      if (syms == NULL)
        return FALSE;
        return FALSE;
 
 
 
      {
 
        bfd_size_type amt;
      amt = exec_hdr (abfd)->a_syms;
      amt = exec_hdr (abfd)->a_syms;
      if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
      if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
          || bfd_bread (syms, amt, abfd) != amt)
          || bfd_bread (syms, amt, abfd) != amt)
        {
        {
          free (syms);
          free (syms);
          return FALSE;
          return FALSE;
        }
        }
 
      }
#endif
#endif
 
 
      obj_aout_external_syms (abfd) = syms;
      obj_aout_external_syms (abfd) = syms;
      obj_aout_external_sym_count (abfd) = count;
      obj_aout_external_sym_count (abfd) = count;
    }
    }
Line 1342... Line 1347...
      if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
      if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
                                 &obj_aout_string_window (abfd), TRUE))
                                 &obj_aout_string_window (abfd), TRUE))
        return FALSE;
        return FALSE;
      strings = (char *) obj_aout_string_window (abfd).data;
      strings = (char *) obj_aout_string_window (abfd).data;
#else
#else
      strings = bfd_malloc (stringsize + 1);
      strings = (char *) bfd_malloc (stringsize + 1);
      if (strings == NULL)
      if (strings == NULL)
        return FALSE;
        return FALSE;
 
 
      /* Skip space for the string count in the buffer for convenience
      /* Skip space for the string count in the buffer for convenience
         when using indexes.  */
         when using indexes.  */
Line 1661... Line 1666...
asymbol *
asymbol *
NAME (aout, make_empty_symbol) (bfd *abfd)
NAME (aout, make_empty_symbol) (bfd *abfd)
{
{
  bfd_size_type amt = sizeof (aout_symbol_type);
  bfd_size_type amt = sizeof (aout_symbol_type);
 
 
  aout_symbol_type *new = bfd_zalloc (abfd, amt);
  aout_symbol_type *new_symbol = (aout_symbol_type *) bfd_zalloc (abfd, amt);
  if (!new)
  if (!new_symbol)
    return NULL;
    return NULL;
  new->symbol.the_bfd = abfd;
  new_symbol->symbol.the_bfd = abfd;
 
 
  return &new->symbol;
  return &new_symbol->symbol;
}
}
 
 
/* Translate a set of internal symbols into external symbols.  */
/* Translate a set of internal symbols into external symbols.  */
 
 
bfd_boolean
bfd_boolean
Line 1743... Line 1748...
  cached_size = obj_aout_external_sym_count (abfd);
  cached_size = obj_aout_external_sym_count (abfd);
  if (cached_size == 0)
  if (cached_size == 0)
    return TRUE;                /* Nothing to do.  */
    return TRUE;                /* Nothing to do.  */
 
 
  cached_size *= sizeof (aout_symbol_type);
  cached_size *= sizeof (aout_symbol_type);
  cached = bfd_zmalloc (cached_size);
  cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
  if (cached == NULL)
  if (cached == NULL)
    return FALSE;
    return FALSE;
 
 
  /* Convert from external symbol information to internal.  */
  /* Convert from external symbol information to internal.  */
  if (! (NAME (aout, translate_symbol_table)
  if (! (NAME (aout, translate_symbol_table)
Line 2304... Line 2309...
  count = reloc_size / each_size;
  count = reloc_size / each_size;
  if (count == 0)
  if (count == 0)
    return TRUE;                /* Nothing to be done.  */
    return TRUE;                /* Nothing to be done.  */
 
 
  amt = count * sizeof (arelent);
  amt = count * sizeof (arelent);
  reloc_cache = bfd_zmalloc (amt);
  reloc_cache = (arelent *) bfd_zmalloc (amt);
  if (reloc_cache == NULL)
  if (reloc_cache == NULL)
    return FALSE;
    return FALSE;
 
 
  relocs = bfd_malloc (reloc_size);
  relocs = bfd_malloc (reloc_size);
  if (relocs == NULL)
  if (relocs == NULL)
Line 2365... Line 2370...
  if (count == 0 || section->orelocation == NULL)
  if (count == 0 || section->orelocation == NULL)
    return TRUE;
    return TRUE;
 
 
  each_size = obj_reloc_entry_size (abfd);
  each_size = obj_reloc_entry_size (abfd);
  natsize = (bfd_size_type) each_size * count;
  natsize = (bfd_size_type) each_size * count;
  native = bfd_zalloc (abfd, natsize);
  native = (unsigned char *) bfd_zalloc (abfd, natsize);
  if (!native)
  if (!native)
    return FALSE;
    return FALSE;
 
 
  generic = section->orelocation;
  generic = section->orelocation;
 
 
Line 2779... Line 2784...
 
 
  if (filelen + funclen == 0)
  if (filelen + funclen == 0)
    adata (abfd).line_buf = buf = NULL;
    adata (abfd).line_buf = buf = NULL;
  else
  else
    {
    {
      buf = bfd_malloc (filelen + funclen + 3);
      buf = (char *) bfd_malloc (filelen + funclen + 3);
      adata (abfd).line_buf = buf;
      adata (abfd).line_buf = buf;
      if (buf == NULL)
      if (buf == NULL)
        return FALSE;
        return FALSE;
    }
    }
 
 
Line 2873... Line 2878...
  struct aout_link_hash_entry *ret = (struct aout_link_hash_entry *) entry;
  struct aout_link_hash_entry *ret = (struct aout_link_hash_entry *) entry;
 
 
  /* Allocate the structure if it has not already been allocated by a
  /* Allocate the structure if it has not already been allocated by a
     subclass.  */
     subclass.  */
  if (ret == NULL)
  if (ret == NULL)
    ret = bfd_hash_allocate (table, sizeof (* ret));
    ret = (struct aout_link_hash_entry *) bfd_hash_allocate (table,
 
                                                             sizeof (* ret));
  if (ret == NULL)
  if (ret == NULL)
    return NULL;
    return NULL;
 
 
  /* Call the allocation method of the superclass.  */
  /* Call the allocation method of the superclass.  */
  ret = ((struct aout_link_hash_entry *)
  ret = ((struct aout_link_hash_entry *)
Line 2912... Line 2918...
NAME (aout, link_hash_table_create) (bfd *abfd)
NAME (aout, link_hash_table_create) (bfd *abfd)
{
{
  struct aout_link_hash_table *ret;
  struct aout_link_hash_table *ret;
  bfd_size_type amt = sizeof (* ret);
  bfd_size_type amt = sizeof (* ret);
 
 
  ret = bfd_malloc (amt);
  ret = (struct aout_link_hash_table *) bfd_malloc (amt);
  if (ret == NULL)
  if (ret == NULL)
    return NULL;
    return NULL;
 
 
  if (!NAME (aout, link_hash_table_init) (ret, abfd,
  if (!NAME (aout, link_hash_table_init) (ret, abfd,
                                          NAME (aout, link_hash_newfunc),
                                          NAME (aout, link_hash_newfunc),
Line 2967... Line 2973...
  /* We keep a list of the linker hash table entries that correspond
  /* We keep a list of the linker hash table entries that correspond
     to particular symbols.  We could just look them up in the hash
     to particular symbols.  We could just look them up in the hash
     table, but keeping the list is more efficient.  Perhaps this
     table, but keeping the list is more efficient.  Perhaps this
     should be conditional on info->keep_memory.  */
     should be conditional on info->keep_memory.  */
  amt = sym_count * sizeof (struct aout_link_hash_entry *);
  amt = sym_count * sizeof (struct aout_link_hash_entry *);
  sym_hash = bfd_alloc (abfd, amt);
  sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt);
  if (sym_hash == NULL)
  if (sym_hash == NULL)
    return FALSE;
    return FALSE;
  obj_aout_sym_hashes (abfd) = sym_hash;
  obj_aout_sym_hashes (abfd) = sym_hash;
 
 
  add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
  add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
Line 3331... Line 3337...
                      return TRUE;
                      return TRUE;
                    }
                    }
                  /* Turn the current link symbol into a common
                  /* Turn the current link symbol into a common
                     symbol.  It is already on the undefs list.  */
                     symbol.  It is already on the undefs list.  */
                  h->type = bfd_link_hash_common;
                  h->type = bfd_link_hash_common;
                  h->u.c.p = bfd_hash_allocate (&info->hash->table,
                  h->u.c.p = (struct bfd_link_hash_common_entry *)
 
                      bfd_hash_allocate (&info->hash->table,
                                                sizeof (struct bfd_link_hash_common_entry));
                                                sizeof (struct bfd_link_hash_common_entry));
                  if (h->u.c.p == NULL)
                  if (h->u.c.p == NULL)
                    return FALSE;
                    return FALSE;
 
 
                  h->u.c.size = value;
                  h->u.c.size = value;
Line 3502... Line 3509...
    (struct aout_link_includes_entry *) entry;
    (struct aout_link_includes_entry *) entry;
 
 
  /* Allocate the structure if it has not already been allocated by a
  /* Allocate the structure if it has not already been allocated by a
     subclass.  */
     subclass.  */
  if (ret == NULL)
  if (ret == NULL)
    ret = bfd_hash_allocate (table, sizeof (* ret));
    ret = (struct aout_link_includes_entry *)
 
        bfd_hash_allocate (table, sizeof (* ret));
  if (ret == NULL)
  if (ret == NULL)
    return NULL;
    return NULL;
 
 
  /* Call the allocation method of the superclass.  */
  /* Call the allocation method of the superclass.  */
  ret = ((struct aout_link_includes_entry *)
  ret = ((struct aout_link_includes_entry *)
Line 3779... Line 3787...
          bfd_reloc_status_type r;
          bfd_reloc_status_type r;
          bfd_byte *buf;
          bfd_byte *buf;
          bfd_boolean ok;
          bfd_boolean ok;
 
 
          size = bfd_get_reloc_size (howto);
          size = bfd_get_reloc_size (howto);
          buf = bfd_zmalloc (size);
          buf = (bfd_byte *) bfd_zmalloc (size);
          if (buf == NULL)
          if (buf == NULL)
            return FALSE;
            return FALSE;
          r = MY_relocate_contents (howto, finfo->output_bfd,
          r = MY_relocate_contents (howto, finfo->output_bfd,
                                    (bfd_vma) pr->addend, buf);
                                    (bfd_vma) pr->addend, buf);
          switch (r)
          switch (r)
Line 5129... Line 5137...
                  break;
                  break;
              if (t == NULL)
              if (t == NULL)
                {
                {
                  /* This is the first time we have seen this header
                  /* This is the first time we have seen this header
                     file with this set of stabs strings.  */
                     file with this set of stabs strings.  */
                  t = bfd_hash_allocate (&finfo->includes.root,
                  t = (struct aout_link_includes_totals *)
 
                      bfd_hash_allocate (&finfo->includes.root,
                                         sizeof *t);
                                         sizeof *t);
                  if (t == NULL)
                  if (t == NULL)
                    return FALSE;
                    return FALSE;
                  t->total = val;
                  t->total = val;
                  t->next = incl_entry->totals;
                  t->next = incl_entry->totals;
Line 5420... Line 5429...
  aout_info.strtab = _bfd_stringtab_init ();
  aout_info.strtab = _bfd_stringtab_init ();
  if (aout_info.strtab == NULL)
  if (aout_info.strtab == NULL)
    goto error_return;
    goto error_return;
 
 
  /* Allocate buffers to hold section contents and relocs.  */
  /* Allocate buffers to hold section contents and relocs.  */
  aout_info.contents = bfd_malloc (max_contents_size);
  aout_info.contents = (bfd_byte *) bfd_malloc (max_contents_size);
  aout_info.relocs = bfd_malloc (max_relocs_size);
  aout_info.relocs = bfd_malloc (max_relocs_size);
  aout_info.symbol_map = bfd_malloc (max_sym_count * sizeof (int *));
  aout_info.symbol_map = (int *) bfd_malloc (max_sym_count * sizeof (int *));
  aout_info.output_syms = bfd_malloc ((max_sym_count + 1)
  aout_info.output_syms = (struct external_nlist *)
                                      * sizeof (struct external_nlist));
      bfd_malloc ((max_sym_count + 1) * sizeof (struct external_nlist));
  if ((aout_info.contents == NULL && max_contents_size != 0)
  if ((aout_info.contents == NULL && max_contents_size != 0)
      || (aout_info.relocs == NULL && max_relocs_size != 0)
      || (aout_info.relocs == NULL && max_relocs_size != 0)
      || (aout_info.symbol_map == NULL && max_sym_count != 0)
      || (aout_info.symbol_map == NULL && max_sym_count != 0)
      || aout_info.output_syms == NULL)
      || aout_info.output_syms == NULL)
    goto error_return;
    goto error_return;

powered by: WebSVN 2.1.0

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