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/binary.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* BFD back-end for binary objects.
    2    Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
     2   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    33   Free Software Foundation, Inc.
    44   Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
     
    3333   address to zero by default.  */
    3434
    35 #include <ctype.h>
    36 
    3735#include "bfd.h"
    3836#include "sysdep.h"
     37#include "safe-ctype.h"
    3938#include "libbfd.h"
    4039
     
    4342#define BIN_SYMS 3
    4443
    45 static boolean binary_mkobject PARAMS ((bfd *));
     44static bfd_boolean binary_mkobject PARAMS ((bfd *));
    4645static const bfd_target *binary_object_p PARAMS ((bfd *));
    47 static boolean binary_get_section_contents
     46static bfd_boolean binary_get_section_contents
    4847  PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
    4948static long binary_get_symtab_upper_bound PARAMS ((bfd *));
    5049static char *mangle_name PARAMS ((bfd *, char *));
    5150static long binary_get_symtab PARAMS ((bfd *, asymbol **));
    52 static asymbol *binary_make_empty_symbol PARAMS ((bfd *));
    5351static void binary_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
    54 static boolean binary_set_section_contents
     52static bfd_boolean binary_set_section_contents
    5553  PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
    56 static int binary_sizeof_headers PARAMS ((bfd *, boolean));
     54static int binary_sizeof_headers PARAMS ((bfd *, bfd_boolean));
     55
     56/* Set by external programs - specifies the BFD architecture
     57   to use when creating binary BFDs.  */
     58enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
    5759
    5860/* Create a binary object.  Invoked via bfd_set_format.  */
    5961
    60 static boolean
     62static bfd_boolean
    6163binary_mkobject (abfd)
    6264     bfd *abfd ATTRIBUTE_UNUSED;
    6365{
    64   return true;
     66  return TRUE;
    6567}
    6668
     
    102104  abfd->tdata.any = (PTR) sec;
    103105
     106  if (bfd_get_arch_info (abfd) != NULL)
     107    {
     108      if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown)
     109          && (bfd_external_binary_architecture != bfd_arch_unknown))
     110        bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0));
     111    }
     112
    104113  return abfd->xvec;
    105114}
     
    111120/* Get contents of the only section.  */
    112121
    113 static boolean
     122static bfd_boolean
    114123binary_get_section_contents (abfd, section, location, offset, count)
    115124     bfd *abfd;
     
    120129{
    121130  if (bfd_seek (abfd, offset, SEEK_SET) != 0
    122       || bfd_read (location, 1, count, abfd) != count)
    123     return false;
    124   return true;
     131      || bfd_bread (location, count, abfd) != count)
     132    return FALSE;
     133  return TRUE;
    125134}
    126135
     
    141150     char *suffix;
    142151{
    143   int size;
     152  bfd_size_type size;
    144153  char *buf;
    145154  char *p;
     
    157166  /* Change any non-alphanumeric characters to underscores.  */
    158167  for (p = buf; *p; p++)
    159     if (! isalnum ((unsigned char) *p))
     168    if (! ISALNUM (*p))
    160169      *p = '_';
    161170
     
    173182  asymbol *syms;
    174183  unsigned int i;
    175 
    176   syms = (asymbol *) bfd_alloc (abfd, BIN_SYMS * sizeof (asymbol));
     184  bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
     185
     186  syms = (asymbol *) bfd_alloc (abfd, amt);
    177187  if (syms == NULL)
    178     return false;
     188    return 0;
    179189
    180190  /* Start symbol.  */
     
    209219}
    210220
    211 /* Make an empty symbol.  */
    212 
    213 static asymbol *
    214 binary_make_empty_symbol (abfd)
    215      bfd *abfd;
    216 {
    217   return (asymbol *) bfd_alloc (abfd, sizeof (asymbol));
    218 }
    219 
     221#define binary_make_empty_symbol _bfd_generic_make_empty_symbol
    220222#define binary_print_symbol _bfd_nosymbols_print_symbol
    221223
     
    249251/* Write section contents of a binary file.  */
    250252
    251 static boolean
     253static bfd_boolean
    252254binary_set_section_contents (abfd, sec, data, offset, size)
    253255     bfd *abfd;
     
    258260{
    259261  if (size == 0)
    260     return true;
     262    return TRUE;
    261263
    262264  if (! abfd->output_has_begun)
    263265    {
    264       boolean found_low;
     266      bfd_boolean found_low;
    265267      bfd_vma low;
    266268      asection *s;
     
    269271         of the file.  We use this to set the file position of all the
    270272         sections.  */
    271       found_low = false;
     273      found_low = FALSE;
    272274      low = 0;
    273275      for (s = abfd->sections; s != NULL; s = s->next)
     
    279281          {
    280282            low = s->lma;
    281             found_low = true;
     283            found_low = TRUE;
    282284          }
    283285
     
    307309        }
    308310
    309       abfd->output_has_begun = true;
     311      abfd->output_has_begun = TRUE;
    310312    }
    311313
     
    314316     meaningful in the binary format.  */
    315317  if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
    316     return true;
     318    return TRUE;
    317319  if ((sec->flags & SEC_NEVER_LOAD) != 0)
    318     return true;
     320    return TRUE;
    319321
    320322  return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
     
    326328binary_sizeof_headers (abfd, exec)
    327329     bfd *abfd ATTRIBUTE_UNUSED;
    328      boolean exec ATTRIBUTE_UNUSED;
     330     bfd_boolean exec ATTRIBUTE_UNUSED;
    329331{
    330332  return 0;
     
    335337#define binary_bfd_relax_section bfd_generic_relax_section
    336338#define binary_bfd_gc_sections bfd_generic_gc_sections
     339#define binary_bfd_merge_sections bfd_generic_merge_sections
     340#define binary_bfd_discard_group bfd_generic_discard_group
    337341#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
     342#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
     343#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
    338344#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
    339345#define binary_bfd_final_link _bfd_generic_final_link
Note: See TracChangeset for help on using the changeset viewer.