Back to index

cell-binutils  2.17cvs20070401
Defines | Functions | Variables
xcoff-target.h File Reference
#include "coffcode.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define RS6000COFF_C   1
#define SELECT_RELOC(internal, howto)
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER   3
#define COFF_LONG_FILENAMES
#define NO_COFF_SYMBOLS
#define RTYPE2HOWTO(cache_ptr, dst)   _bfd_xcoff_rtype2howto (cache_ptr, dst)
#define coff_mkobject   _bfd_xcoff_mkobject
#define coff_bfd_copy_private_bfd_data   _bfd_xcoff_copy_private_bfd_data
#define coff_bfd_is_local_label_name   _bfd_xcoff_is_local_label_name
#define coff_bfd_is_target_special_symbol   ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
#define coff_bfd_reloc_type_lookup   _bfd_xcoff_reloc_type_lookup
#define coff_relocate_section   _bfd_ppc_xcoff_relocate_section
#define coff_core_file_failing_command   _bfd_nocore_core_file_failing_command
#define coff_core_file_failing_signal   _bfd_nocore_core_file_failing_signal
#define coff_core_file_matches_executable_p   _bfd_nocore_core_file_matches_executable_p
#define _bfd_xcoff_bfd_get_relocated_section_contents   coff_bfd_get_relocated_section_contents
#define _bfd_xcoff_bfd_relax_section   coff_bfd_relax_section
#define _bfd_xcoff_bfd_gc_sections   coff_bfd_gc_sections
#define _bfd_xcoff_bfd_merge_sections   coff_bfd_merge_sections
#define _bfd_xcoff_bfd_discard_group   bfd_generic_discard_group
#define _bfd_xcoff_section_already_linked   _bfd_generic_section_already_linked
#define _bfd_xcoff_bfd_link_split_section   coff_bfd_link_split_section
#define CORE_FILE_P   _bfd_dummy_target
#define _bfd_xcoff_slurp_extended_name_table   bfd_false
#define _bfd_xcoff_construct_extended_name_table   ((bfd_boolean (*) (bfd *, char **, bfd_size_type *, const char **)) bfd_false)
#define _bfd_xcoff_truncate_arname   bfd_dont_truncate_arname
#define _bfd_xcoff_get_elt_at_index   _bfd_generic_get_elt_at_index
#define _bfd_xcoff_update_armap_timestamp   bfd_true
#define coff_SWAP_sym_in   _bfd_xcoff_swap_sym_in
#define coff_SWAP_sym_out   _bfd_xcoff_swap_sym_out
#define coff_SWAP_aux_in   _bfd_xcoff_swap_aux_in
#define coff_SWAP_aux_out   _bfd_xcoff_swap_aux_out

Functions

bfd_boolean _bfd_xcoff_mkobject (bfd *)
bfd_boolean _bfd_xcoff_copy_private_bfd_data (bfd *, bfd *)
bfd_boolean _bfd_xcoff_is_local_label_name (bfd *, const char *)
void _bfd_xcoff_rtype2howto (arelent *, struct internal_reloc *)
bfd_boolean _bfd_xcoff_slurp_armap (bfd *)
void * _bfd_xcoff_read_ar_hdr (bfd *)
bfd_bfd_xcoff_openr_next_archived_file (bfd *, bfd *)
int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *)
bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int)
bfd_boolean _bfd_xcoff_write_archive_contents (bfd *)
int _bfd_xcoff_sizeof_headers (bfd *, struct bfd_link_info *)
void _bfd_xcoff_swap_sym_in (bfd *, void *, void *)
unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *)
void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *)
unsigned int _bfd_xcoff_swap_aux_out (bfd *, void *, int, int, int, int, void *)
reloc_howto_type * _bfd_xcoff_reloc_type_lookup (bfd *, bfd_reloc_code_real_type)
const bfd_target_bfd_xcoff_archive_p (bfd *)

Variables

const bfd_target TARGET_SYM

Define Documentation

Definition at line 56 of file xcoff-target.h.

Definition at line 54 of file xcoff-target.h.

Definition at line 52 of file xcoff-target.h.

Definition at line 58 of file xcoff-target.h.

Definition at line 55 of file xcoff-target.h.

Definition at line 53 of file xcoff-target.h.

Definition at line 106 of file xcoff-target.h.

Definition at line 112 of file xcoff-target.h.

Definition at line 57 of file xcoff-target.h.

Definition at line 105 of file xcoff-target.h.

Definition at line 108 of file xcoff-target.h.

Definition at line 116 of file xcoff-target.h.

Definition at line 44 of file xcoff-target.h.

Definition at line 45 of file xcoff-target.h.

Definition at line 46 of file xcoff-target.h.

Definition at line 47 of file xcoff-target.h.

Definition at line 49 of file xcoff-target.h.

Definition at line 50 of file xcoff-target.h.

Definition at line 51 of file xcoff-target.h.

Definition at line 35 of file xcoff-target.h.

Definition at line 37 of file xcoff-target.h.

Definition at line 43 of file xcoff-target.h.

Definition at line 48 of file xcoff-target.h.

Definition at line 139 of file xcoff-target.h.

Definition at line 140 of file xcoff-target.h.

Definition at line 137 of file xcoff-target.h.

Definition at line 138 of file xcoff-target.h.

Definition at line 60 of file xcoff-target.h.

#define NO_COFF_SYMBOLS

Definition at line 39 of file xcoff-target.h.

#define RS6000COFF_C   1

Definition at line 23 of file xcoff-target.h.

#define RTYPE2HOWTO (   cache_ptr,
  dst 
)    _bfd_xcoff_rtype2howto (cache_ptr, dst)

Definition at line 41 of file xcoff-target.h.

#define SELECT_RELOC (   internal,
  howto 
)
Value:
{                                                              \
    internal.r_type = howto->type;                             \
    internal.r_size =                                                 \
      ((howto->complain_on_overflow == complain_overflow_signed              \
       ? 0x80                                                  \
       : 0)                                                    \
       | (howto->bitsize - 1));                                       \
  }

Definition at line 25 of file xcoff-target.h.


Function Documentation

Definition at line 1285 of file coff-rs6000.c.

{
  struct artdata *tdata_hold;
  char magic[SXCOFFARMAG];
  bfd_size_type amt = SXCOFFARMAG;

  if (bfd_bread ((PTR) magic, amt, abfd) != amt)
    {
      if (bfd_get_error () != bfd_error_system_call)
       bfd_set_error (bfd_error_wrong_format);
      return NULL;
    }

  if (strncmp (magic, XCOFFARMAG, SXCOFFARMAG) != 0
      && strncmp (magic, XCOFFARMAGBIG, SXCOFFARMAG) != 0)
    {
      bfd_set_error (bfd_error_wrong_format);
      return NULL;
    }

  tdata_hold = bfd_ardata (abfd);

  amt = sizeof (struct artdata);
  bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
  if (bfd_ardata (abfd) == (struct artdata *) NULL)
    goto error_ret_restore;

  /* Cleared by bfd_zalloc above.
     bfd_ardata (abfd)->cache = NULL;
     bfd_ardata (abfd)->archive_head = NULL;
     bfd_ardata (abfd)->symdefs = NULL;
     bfd_ardata (abfd)->extended_names = NULL;
     bfd_ardata (abfd)->extended_names_size = 0;  */

  /* Now handle the two formats.  */
  if (magic[1] != 'b')
    {
      /* This is the old format.  */
      struct xcoff_ar_file_hdr hdr;

      /* Copy over the magic string.  */
      memcpy (hdr.magic, magic, SXCOFFARMAG);

      /* Now read the rest of the file header.  */
      amt = SIZEOF_AR_FILE_HDR - SXCOFFARMAG;
      if (bfd_bread ((PTR) &hdr.memoff, amt, abfd) != amt)
       {
         if (bfd_get_error () != bfd_error_system_call)
           bfd_set_error (bfd_error_wrong_format);
         goto error_ret;
       }

      bfd_ardata (abfd)->first_file_filepos = strtol (hdr.firstmemoff,
                                                (char **) NULL, 10);

      amt = SIZEOF_AR_FILE_HDR;
      bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt);
      if (bfd_ardata (abfd)->tdata == NULL)
       goto error_ret;

      memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR);
    }
  else
    {
      /* This is the new format.  */
      struct xcoff_ar_file_hdr_big hdr;

      /* Copy over the magic string.  */
      memcpy (hdr.magic, magic, SXCOFFARMAG);

      /* Now read the rest of the file header.  */
      amt = SIZEOF_AR_FILE_HDR_BIG - SXCOFFARMAG;
      if (bfd_bread ((PTR) &hdr.memoff, amt, abfd) != amt)
       {
         if (bfd_get_error () != bfd_error_system_call)
           bfd_set_error (bfd_error_wrong_format);
         goto error_ret;
       }

      bfd_ardata (abfd)->first_file_filepos = bfd_scan_vma (hdr.firstmemoff,
                                                     (const char **) 0,
                                                     10);

      amt = SIZEOF_AR_FILE_HDR_BIG;
      bfd_ardata (abfd)->tdata = bfd_zalloc (abfd, amt);
      if (bfd_ardata (abfd)->tdata == NULL)
       goto error_ret;

      memcpy (bfd_ardata (abfd)->tdata, &hdr, SIZEOF_AR_FILE_HDR_BIG);
    }

  if (! _bfd_xcoff_slurp_armap (abfd))
    {
    error_ret:
      bfd_release (abfd, bfd_ardata (abfd));
    error_ret_restore:
      bfd_ardata (abfd) = tdata_hold;
      return NULL;
    }

  return abfd->xvec;
}

Here is the call graph for this function:

Definition at line 278 of file coff-rs6000.c.

{
  struct xcoff_tdata *ix, *ox;
  asection *sec;

  if (ibfd->xvec != obfd->xvec)
    return TRUE;
  ix = xcoff_data (ibfd);
  ox = xcoff_data (obfd);
  ox->full_aouthdr = ix->full_aouthdr;
  ox->toc = ix->toc;
  if (ix->sntoc == 0)
    ox->sntoc = 0;
  else
    {
      sec = coff_section_from_bfd_index (ibfd, ix->sntoc);
      if (sec == NULL)
       ox->sntoc = 0;
      else
       ox->sntoc = sec->output_section->target_index;
    }
  if (ix->snentry == 0)
    ox->snentry = 0;
  else
    {
      sec = coff_section_from_bfd_index (ibfd, ix->snentry);
      if (sec == NULL)
       ox->snentry = 0;
      else
       ox->snentry = sec->output_section->target_index;
    }
  bfd_xcoff_text_align_power (obfd) = bfd_xcoff_text_align_power (ibfd);
  bfd_xcoff_data_align_power (obfd) = bfd_xcoff_data_align_power (ibfd);
  ox->modtype = ix->modtype;
  ox->cputype = ix->cputype;
  ox->maxdata = ix->maxdata;
  ox->maxstack = ix->maxstack;
  return TRUE;
}

Here is the call graph for this function:

Definition at line 245 of file coff-rs6000.c.

{
  coff_data_type *coff;
  bfd_size_type amt = sizeof (struct xcoff_tdata);

  abfd->tdata.xcoff_obj_data = (struct xcoff_tdata *) bfd_zalloc (abfd, amt);
  if (abfd->tdata.xcoff_obj_data == NULL)
    return FALSE;
  coff = coff_data (abfd);
  coff->symbols = (coff_symbol_type *) NULL;
  coff->conversion_table = (unsigned int *) NULL;
  coff->raw_syments = (struct coff_ptr_struct *) NULL;
  coff->relocbase = 0;

  xcoff_data (abfd)->modtype = ('1' << 8) | 'L';

  /* We set cputype to -1 to indicate that it has not been
     initialized.  */
  xcoff_data (abfd)->cputype = -1;

  xcoff_data (abfd)->csects = NULL;
  xcoff_data (abfd)->debug_indices = NULL;

  /* text section alignment is different than the default */
  bfd_xcoff_text_align_power (abfd) = 2;

  return TRUE;
}

Here is the call graph for this function:

Definition at line 1481 of file coff-rs6000.c.

{
  file_ptr filestart;

  if (xcoff_ardata (archive) == NULL)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return NULL;
    }

  if (! xcoff_big_format_p (archive))
    {
      if (last_file == NULL)
       filestart = bfd_ardata (archive)->first_file_filepos;
      else
       filestart = strtol (arch_xhdr (last_file)->nextoff, (char **) NULL,
                         10);

      if (filestart == 0
         || filestart == strtol (xcoff_ardata (archive)->memoff,
                              (char **) NULL, 10)
         || filestart == strtol (xcoff_ardata (archive)->symoff,
                              (char **) NULL, 10))
       {
         bfd_set_error (bfd_error_no_more_archived_files);
         return NULL;
       }
    }
  else
    {
      if (last_file == NULL)
       filestart = bfd_ardata (archive)->first_file_filepos;
      else
       /* XXX These actually have to be a calls to strtoll (at least
          on 32-bit machines) since the fields's width is 20 and
          there numbers with more than 32 bits can be represented.  */
       filestart = strtol (arch_xhdr_big (last_file)->nextoff, (char **) NULL,
                         10);

      /* XXX These actually have to be calls to strtoll (at least on 32-bit
        machines) since the fields's width is 20 and there numbers with more
        than 32 bits can be represented.  */
      if (filestart == 0
         || filestart == strtol (xcoff_ardata_big (archive)->memoff,
                              (char **) NULL, 10)
         || filestart == strtol (xcoff_ardata_big (archive)->symoff,
                              (char **) NULL, 10))
       {
         bfd_set_error (bfd_error_no_more_archived_files);
         return NULL;
       }
    }

  return _bfd_get_elt_at_filepos (archive, filestart);
}

Here is the call graph for this function:

void* _bfd_xcoff_read_ar_hdr ( bfd )

Definition at line 1392 of file coff-rs6000.c.

{
  bfd_size_type namlen;
  struct areltdata *ret;
  bfd_size_type amt = sizeof (struct areltdata);

  ret = (struct areltdata *) bfd_alloc (abfd, amt);
  if (ret == NULL)
    return NULL;

  if (! xcoff_big_format_p (abfd))
    {
      struct xcoff_ar_hdr hdr;
      struct xcoff_ar_hdr *hdrp;

      if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
         != SIZEOF_AR_HDR)
       {
         free (ret);
         return NULL;
       }

      namlen = strtol (hdr.namlen, (char **) NULL, 10);
      amt = SIZEOF_AR_HDR + namlen + 1;
      hdrp = (struct xcoff_ar_hdr *) bfd_alloc (abfd, amt);
      if (hdrp == NULL)
       {
         free (ret);
         return NULL;
       }
      memcpy (hdrp, &hdr, SIZEOF_AR_HDR);
      if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR, namlen, abfd) != namlen)
       {
         free (ret);
         return NULL;
       }
      ((char *) hdrp)[SIZEOF_AR_HDR + namlen] = '\0';

      ret->arch_header = (char *) hdrp;
      ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
      ret->filename = (char *) hdrp + SIZEOF_AR_HDR;
    }
  else
    {
      struct xcoff_ar_hdr_big hdr;
      struct xcoff_ar_hdr_big *hdrp;

      if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
         != SIZEOF_AR_HDR_BIG)
       {
         free (ret);
         return NULL;
       }

      namlen = strtol (hdr.namlen, (char **) NULL, 10);
      amt = SIZEOF_AR_HDR_BIG + namlen + 1;
      hdrp = (struct xcoff_ar_hdr_big *) bfd_alloc (abfd, amt);
      if (hdrp == NULL)
       {
         free (ret);
         return NULL;
       }
      memcpy (hdrp, &hdr, SIZEOF_AR_HDR_BIG);
      if (bfd_bread ((char *) hdrp + SIZEOF_AR_HDR_BIG, namlen, abfd) != namlen)
       {
         free (ret);
         return NULL;
       }
      ((char *) hdrp)[SIZEOF_AR_HDR_BIG + namlen] = '\0';

      ret->arch_header = (char *) hdrp;
      /* XXX This actually has to be a call to strtoll (at least on 32-bit
        machines) since the field width is 20 and there numbers with more
        than 32 bits can be represented.  */
      ret->parsed_size = strtol (hdr.size, (char **) NULL, 10);
      ret->filename = (char *) hdrp + SIZEOF_AR_HDR_BIG;
    }

  /* Skip over the XCOFFARFMAG at the end of the file name.  */
  if (bfd_seek (abfd, (file_ptr) ((namlen & 1) + SXCOFFARFMAG), SEEK_CUR) != 0)
    return NULL;

  return (PTR) ret;
}

Here is the call graph for this function:

reloc_howto_type* _bfd_xcoff_reloc_type_lookup ( bfd ,
bfd_reloc_code_real_type   
)

Definition at line 1131 of file coff-rs6000.c.

{
  file_ptr off;
  size_t namlen;
  bfd_size_type sz;
  bfd_byte *contents, *cend;
  bfd_vma c, i;
  carsym *arsym;
  bfd_byte *p;

  if (xcoff_ardata (abfd) == NULL)
    {
      bfd_has_map (abfd) = FALSE;
      return TRUE;
    }

  if (! xcoff_big_format_p (abfd))
    {
      /* This is for the old format.  */
      struct xcoff_ar_hdr hdr;

      off = strtol (xcoff_ardata (abfd)->symoff, (char **) NULL, 10);
      if (off == 0)
       {
         bfd_has_map (abfd) = FALSE;
         return TRUE;
       }

      if (bfd_seek (abfd, off, SEEK_SET) != 0)
       return FALSE;

      /* The symbol table starts with a normal archive header.  */
      if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR, abfd)
         != SIZEOF_AR_HDR)
       return FALSE;

      /* Skip the name (normally empty).  */
      namlen = strtol (hdr.namlen, (char **) NULL, 10);
      off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG;
      if (bfd_seek (abfd, off, SEEK_CUR) != 0)
       return FALSE;

      sz = strtol (hdr.size, (char **) NULL, 10);

      /* Read in the entire symbol table.  */
      contents = (bfd_byte *) bfd_alloc (abfd, sz);
      if (contents == NULL)
       return FALSE;
      if (bfd_bread ((PTR) contents, sz, abfd) != sz)
       return FALSE;

      /* The symbol table starts with a four byte count.  */
      c = H_GET_32 (abfd, contents);

      if (c * 4 >= sz)
       {
         bfd_set_error (bfd_error_bad_value);
         return FALSE;
       }

      bfd_ardata (abfd)->symdefs =
       ((carsym *) bfd_alloc (abfd, c * sizeof (carsym)));
      if (bfd_ardata (abfd)->symdefs == NULL)
       return FALSE;

      /* After the count comes a list of four byte file offsets.  */
      for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 4;
          i < c;
          ++i, ++arsym, p += 4)
       arsym->file_offset = H_GET_32 (abfd, p);
    }
  else
    {
      /* This is for the new format.  */
      struct xcoff_ar_hdr_big hdr;

      off = strtol (xcoff_ardata_big (abfd)->symoff, (char **) NULL, 10);
      if (off == 0)
       {
         bfd_has_map (abfd) = FALSE;
         return TRUE;
       }

      if (bfd_seek (abfd, off, SEEK_SET) != 0)
       return FALSE;

      /* The symbol table starts with a normal archive header.  */
      if (bfd_bread ((PTR) &hdr, (bfd_size_type) SIZEOF_AR_HDR_BIG, abfd)
         != SIZEOF_AR_HDR_BIG)
       return FALSE;

      /* Skip the name (normally empty).  */
      namlen = strtol (hdr.namlen, (char **) NULL, 10);
      off = ((namlen + 1) & ~ (size_t) 1) + SXCOFFARFMAG;
      if (bfd_seek (abfd, off, SEEK_CUR) != 0)
       return FALSE;

      /* XXX This actually has to be a call to strtoll (at least on 32-bit
        machines) since the field width is 20 and there numbers with more
        than 32 bits can be represented.  */
      sz = strtol (hdr.size, (char **) NULL, 10);

      /* Read in the entire symbol table.  */
      contents = (bfd_byte *) bfd_alloc (abfd, sz);
      if (contents == NULL)
       return FALSE;
      if (bfd_bread ((PTR) contents, sz, abfd) != sz)
       return FALSE;

      /* The symbol table starts with an eight byte count.  */
      c = H_GET_64 (abfd, contents);

      if (c * 8 >= sz)
       {
         bfd_set_error (bfd_error_bad_value);
         return FALSE;
       }

      bfd_ardata (abfd)->symdefs =
       ((carsym *) bfd_alloc (abfd, c * sizeof (carsym)));
      if (bfd_ardata (abfd)->symdefs == NULL)
       return FALSE;

      /* After the count comes a list of eight byte file offsets.  */
      for (i = 0, arsym = bfd_ardata (abfd)->symdefs, p = contents + 8;
          i < c;
          ++i, ++arsym, p += 8)
       arsym->file_offset = H_GET_64 (abfd, p);
    }

  /* After the file offsets come null terminated symbol names.  */
  cend = contents + sz;
  for (i = 0, arsym = bfd_ardata (abfd)->symdefs;
       i < c;
       ++i, ++arsym, p += strlen ((char *) p) + 1)
    {
      if (p >= cend)
       {
         bfd_set_error (bfd_error_bad_value);
         return FALSE;
       }
      arsym->name = (char *) p;
    }

  bfd_ardata (abfd)->symdef_count = c;
  bfd_has_map (abfd) = TRUE;

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _bfd_xcoff_swap_aux_in ( bfd ,
void *  ,
int  ,
int  ,
int  ,
int  ,
void *   
)
unsigned int _bfd_xcoff_swap_aux_out ( bfd ,
void *  ,
int  ,
int  ,
int  ,
int  ,
void *   
)
void _bfd_xcoff_swap_sym_in ( bfd ,
void *  ,
void *   
)
unsigned int _bfd_xcoff_swap_sym_out ( bfd ,
void *  ,
void *   
)

Definition at line 2579 of file coff-rs6000.c.

Here is the call graph for this function:

bfd_boolean _bfd_xcoff_write_armap ( bfd ,
unsigned  int,
struct orl ,
unsigned  int,
int   
)

Variable Documentation

Definition at line 147 of file xcoff-target.h.