Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/bfd/ppcboot.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* BFD back-end for PPCbug boot records.
    2    Copyright 1996, 1997, 1998, 1999, 2000, 2001
     2   Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
    33   Free Software Foundation, Inc.
    44   Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
     
    3333   address to zero by default.  */
    3434
    35 #include <ctype.h>
    36 
     35#include "safe-ctype.h"
    3736#include "bfd.h"
    3837#include "sysdep.h"
     
    8988#define PPCBOOT_SYMS 3
    9089
    91 static boolean ppcboot_mkobject PARAMS ((bfd *));
     90static bfd_boolean ppcboot_mkobject PARAMS ((bfd *));
    9291static const bfd_target *ppcboot_object_p PARAMS ((bfd *));
    93 static boolean ppcboot_set_arch_mach
     92static bfd_boolean ppcboot_set_arch_mach
    9493  PARAMS ((bfd *, enum bfd_architecture, unsigned long));
    95 static boolean ppcboot_get_section_contents
     94static bfd_boolean ppcboot_get_section_contents
    9695  PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
    9796static long ppcboot_get_symtab_upper_bound PARAMS ((bfd *));
    9897static char *mangle_name PARAMS ((bfd *, char *));
    9998static long ppcboot_get_symtab PARAMS ((bfd *, asymbol **));
    100 static asymbol *ppcboot_make_empty_symbol PARAMS ((bfd *));
    10199static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
    102 static boolean ppcboot_set_section_contents
     100static bfd_boolean ppcboot_set_section_contents
    103101  PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
    104 static int ppcboot_sizeof_headers PARAMS ((bfd *, boolean));
    105 static boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR));
     102static int ppcboot_sizeof_headers PARAMS ((bfd *, bfd_boolean));
     103static bfd_boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR));
    106104
    107105#define ppcboot_set_tdata(abfd, ptr) ((abfd)->tdata.any = (PTR) (ptr))
     
    111109/* Create a ppcboot object.  Invoked via bfd_set_format.  */
    112110
    113 static boolean
     111static bfd_boolean
    114112ppcboot_mkobject (abfd)
    115113     bfd *abfd;
    116114{
    117115  if (!ppcboot_get_tdata (abfd))
    118     ppcboot_set_tdata (abfd, bfd_zalloc (abfd, sizeof (ppcboot_data_t)));
    119 
    120   return true;
     116    {
     117      bfd_size_type amt = sizeof (ppcboot_data_t);
     118      ppcboot_set_tdata (abfd, bfd_zalloc (abfd, amt));
     119    }
     120
     121  return TRUE;
    121122}
    122123
     
    124125
    125126/* Set the architecture to PowerPC */
    126 static boolean
     127static bfd_boolean
    127128ppcboot_set_arch_mach (abfd, arch, machine)
    128129     bfd *abfd;
     
    134135
    135136  else if (arch != bfd_arch_powerpc)
    136     return false;
     137    return FALSE;
    137138
    138139  return bfd_default_set_arch_mach (abfd, arch, machine);
     
    176177    }
    177178
    178   if (bfd_read ((PTR) &hdr, sizeof (hdr), 1, abfd) != sizeof (hdr))
     179  if (bfd_bread ((PTR) &hdr, (bfd_size_type) sizeof (hdr), abfd)
     180      != sizeof (hdr))
    179181    {
    180182      if (bfd_get_error () != bfd_error_system_call)
     
    220222  memcpy ((PTR) &tdata->header, (PTR) &hdr, sizeof (ppcboot_hdr_t));
    221223
    222   ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0);
     224  ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0L);
    223225  return abfd->xvec;
    224226}
     
    232234/* Get contents of the only section.  */
    233235
    234 static boolean
     236static bfd_boolean
    235237ppcboot_get_section_contents (abfd, section, location, offset, count)
    236238     bfd *abfd;
     
    240242     bfd_size_type count;
    241243{
    242   if (bfd_seek (abfd, offset + sizeof (ppcboot_hdr_t), SEEK_SET) != 0
    243       || bfd_read (location, 1, count, abfd) != count)
    244     return false;
    245   return true;
     244  if (bfd_seek (abfd, offset + (file_ptr) sizeof (ppcboot_hdr_t), SEEK_SET) != 0
     245      || bfd_bread (location, count, abfd) != count)
     246    return FALSE;
     247  return TRUE;
    246248}
    247249
     
    266268     char *suffix;
    267269{
    268   int size;
     270  bfd_size_type size;
    269271  char *buf;
    270272  char *p;
     
    282284  /* Change any non-alphanumeric characters to underscores.  */
    283285  for (p = buf; *p; p++)
    284     if (! isalnum ((unsigned char) *p))
     286    if (! ISALNUM (*p))
    285287      *p = '_';
    286288
     
    300302  asymbol *syms;
    301303  unsigned int i;
    302 
    303   syms = (asymbol *) bfd_alloc (abfd, PPCBOOT_SYMS * sizeof (asymbol));
     304  bfd_size_type amt = PPCBOOT_SYMS * sizeof (asymbol);
     305
     306  syms = (asymbol *) bfd_alloc (abfd, amt);
    304307  if (syms == NULL)
    305     return false;
     308    return FALSE;
    306309
    307310  /* Start symbol.  */
     
    336339}
    337340
    338 
    339 
    340 /* Make an empty symbol.  */
    341 
    342 static asymbol *
    343 ppcboot_make_empty_symbol (abfd)
    344      bfd *abfd;
    345 {
    346   return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
    347 }
    348 
    349 
    350 
     341#define ppcboot_make_empty_symbol _bfd_generic_make_empty_symbol
    351342#define ppcboot_print_symbol _bfd_nosymbols_print_symbol
    352343
     
    378369/* Write section contents of a ppcboot file.  */
    379370
    380 static boolean
     371static bfd_boolean
    381372ppcboot_set_section_contents (abfd, sec, data, offset, size)
    382373     bfd *abfd;
     
    402393        s->filepos = s->vma - low;
    403394
    404       abfd->output_has_begun = true;
     395      abfd->output_has_begun = TRUE;
    405396    }
    406397
     
    413404ppcboot_sizeof_headers (abfd, exec)
    414405     bfd *abfd ATTRIBUTE_UNUSED;
    415      boolean exec ATTRIBUTE_UNUSED;
     406     bfd_boolean exec ATTRIBUTE_UNUSED;
    416407{
    417408  return sizeof (ppcboot_hdr_t);
     
    422413/* Print out the program headers.  */
    423414
    424 static boolean
     415static bfd_boolean
    425416ppcboot_bfd_print_private_bfd_data (abfd, farg)
    426417     bfd *abfd;
     
    480471
    481472  fprintf (f, "\n");
    482   return true;
     473  return TRUE;
    483474}
    484475
     
    489480#define ppcboot_bfd_relax_section bfd_generic_relax_section
    490481#define ppcboot_bfd_gc_sections bfd_generic_gc_sections
     482#define ppcboot_bfd_merge_sections bfd_generic_merge_sections
     483#define ppcboot_bfd_discard_group bfd_generic_discard_group
    491484#define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
     485#define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
    492486#define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols
     487#define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms
    493488#define ppcboot_bfd_final_link _bfd_generic_final_link
    494489#define ppcboot_bfd_link_split_section _bfd_generic_link_split_section
Note: See TracChangeset for help on using the changeset viewer.