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

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Generic ECOFF (Extended-COFF) routines.
    2    Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
    3    Free Software Foundation, Inc.
     2   Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
     3   2002, 2003 Free Software Foundation, Inc.
    44   Original version by Per Bothner.
    55   Full support added by Ian Lance Taylor, ian@cygnus.com.
    66
    7 This file is part of BFD, the Binary File Descriptor library.
    8 
    9 This program is free software; you can redistribute it and/or modify
    10 it under the terms of the GNU General Public License as published by
    11 the Free Software Foundation; either version 2 of the License, or
    12 (at your option) any later version.
    13 
    14 This program is distributed in the hope that it will be useful,
    15 but WITHOUT ANY WARRANTY; without even the implied warranty of
    16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    17 GNU General Public License for more details.
    18 
    19 You should have received a copy of the GNU General Public License
    20 along with this program; if not, write to the Free Software
    21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     7   This file is part of BFD, the Binary File Descriptor library.
     8
     9   This program is free software; you can redistribute it and/or modify
     10   it under the terms of the GNU General Public License as published by
     11   the Free Software Foundation; either version 2 of the License, or
     12   (at your option) any later version.
     13
     14   This program is distributed in the hope that it will be useful,
     15   but WITHOUT ANY WARRANTY; without even the implied warranty of
     16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     17   GNU General Public License for more details.
     18
     19   You should have received a copy of the GNU General Public License
     20   along with this program; if not, write to the Free Software
     21   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    2222
    2323#include "bfd.h"
     
    4848/* Prototypes for static functions.  */
    4949
    50 static int ecoff_get_magic PARAMS ((bfd *abfd));
    51 static long ecoff_sec_to_styp_flags PARAMS ((const char *name,
    52                                              flagword flags));
    53 static boolean ecoff_slurp_symbolic_header PARAMS ((bfd *abfd));
    54 static boolean ecoff_set_symbol_info PARAMS ((bfd *abfd, SYMR *ecoff_sym,
    55                                            asymbol *asym, int ext, int weak));
    56 static void ecoff_emit_aggregate PARAMS ((bfd *abfd, FDR *fdr,
    57                                           char *string,
    58                                           RNDXR *rndx, long isym,
    59                                           const char *which));
    60 static char *ecoff_type_to_string PARAMS ((bfd *abfd, FDR *fdr,
    61                                            unsigned int indx));
    62 static boolean ecoff_slurp_reloc_table PARAMS ((bfd *abfd, asection *section,
    63                                                 asymbol **symbols));
    64 static int ecoff_sort_hdrs PARAMS ((const PTR, const PTR));
    65 static boolean ecoff_compute_section_file_positions PARAMS ((bfd *abfd));
    66 static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *abfd));
    67 static boolean ecoff_get_extr PARAMS ((asymbol *, EXTR *));
    68 static void ecoff_set_index PARAMS ((asymbol *, bfd_size_type));
    69 static unsigned int ecoff_armap_hash PARAMS ((CONST char *s,
    70                                               unsigned int *rehash,
    71                                               unsigned int size,
    72                                               unsigned int hlog));
     50static int ecoff_get_magic
     51  PARAMS ((bfd *));
     52static long ecoff_sec_to_styp_flags
     53  PARAMS ((const char *, flagword));
     54static bfd_boolean ecoff_slurp_symbolic_header
     55  PARAMS ((bfd *));
     56static bfd_boolean ecoff_set_symbol_info
     57  PARAMS ((bfd *, SYMR *, asymbol *, int, int));
     58static void ecoff_emit_aggregate
     59  PARAMS ((bfd *, FDR *, char *, RNDXR *, long, const char *));
     60static char *ecoff_type_to_string
     61  PARAMS ((bfd *, FDR *, unsigned int));
     62static bfd_boolean ecoff_slurp_reloc_table
     63  PARAMS ((bfd *, asection *, asymbol **));
     64static int ecoff_sort_hdrs
     65  PARAMS ((const PTR, const PTR));
     66static bfd_boolean ecoff_compute_section_file_positions
     67  PARAMS ((bfd *));
     68static bfd_size_type ecoff_compute_reloc_file_positions
     69  PARAMS ((bfd *));
     70static bfd_boolean ecoff_get_extr
     71  PARAMS ((asymbol *, EXTR *));
     72static void ecoff_set_index
     73  PARAMS ((asymbol *, bfd_size_type));
     74static unsigned int ecoff_armap_hash
     75  PARAMS ((const char *, unsigned int *, unsigned int, unsigned int));
    7376
    7477
     
    8184  /* linker_mark, linker_has_input, gc_mark, segment_mark,         */
    8285     0,           0,                0,       0,
    83   /* vma, lma, _cooked_size, _raw_size,                            */
     86  /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12,     */
     87     0,             0,          0,             0,      0,
     88  /* flag13, flag14, flag15, flag16, flag20, flag24,               */
     89     0,      0,      0,      0,      0,      0,
     90  /* vma, lma, _cooked_size, _raw_size,                            */
    8491     0,   0,   0,            0,
    8592  /* output_offset, output_section, alignment_power,               */
     
    8996  /* line_filepos, userdata, contents, lineno, lineno_count,       */
    9097     0,            NULL,     NULL,     NULL,   0,
    91   /* comdat, kept_section, moving_line_filepos,                    */
    92      NULL,   NULL,         0,
     98  /* entsize, comdat, moving_line_filepos,                         */
     99     0,       NULL,   0,
    93100  /* target_index, used_by_bfd, constructor_chain, owner,          */
    94101     0,            NULL,        NULL,              NULL,
     
    103110/* Create an ECOFF object.  */
    104111
    105 boolean
     112bfd_boolean
    106113_bfd_ecoff_mkobject (abfd)
    107114     bfd *abfd;
    108115{
    109   abfd->tdata.ecoff_obj_data = ((struct ecoff_tdata *)
    110                                 bfd_zalloc (abfd, sizeof (ecoff_data_type)));
     116  bfd_size_type amt = sizeof (ecoff_data_type);
     117
     118  abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt);
    111119  if (abfd->tdata.ecoff_obj_data == NULL)
    112     return false;
    113 
    114   return true;
     120    return FALSE;
     121
     122  return TRUE;
    115123}
    116124
     
    128136  ecoff_data_type *ecoff;
    129137
    130   if (_bfd_ecoff_mkobject (abfd) == false)
     138  if (! _bfd_ecoff_mkobject (abfd))
    131139    return NULL;
    132140
     
    163171/* Initialize a new section.  */
    164172
    165 boolean
     173bfd_boolean
    166174_bfd_ecoff_new_section_hook (abfd, section)
    167175     bfd *abfd ATTRIBUTE_UNUSED;
     
    187195    section->flags |= SEC_ALLOC;
    188196  else if (strcmp (section->name, _LIB) == 0)
    189     {
    190       /* An Irix 4 shared libary.  */
    191       section->flags |= SEC_COFF_SHARED_LIBRARY;
    192     }
     197    /* An Irix 4 shared libary.  */
     198    section->flags |= SEC_COFF_SHARED_LIBRARY;
    193199
    194200  /* Probably any other section name is SEC_NEVER_LOAD, but I'm
     
    196202     libraries work.  */
    197203
    198   return true;
     204  return TRUE;
    199205}
    200206
     
    204210   for each target, but there aren't all that many ECOFF targets.  */
    205211
    206 boolean
     212bfd_boolean
    207213_bfd_ecoff_set_arch_mach_hook (abfd, filehdr)
    208214     bfd *abfd;
     
    219225    case MIPS_MAGIC_BIG:
    220226      arch = bfd_arch_mips;
    221       mach = 3000;
     227      mach = bfd_mach_mips3000;
    222228      break;
    223229
    224230    case MIPS_MAGIC_LITTLE2:
    225231    case MIPS_MAGIC_BIG2:
    226       /* MIPS ISA level 2: the r6000 */
     232      /* MIPS ISA level 2: the r6000. */
    227233      arch = bfd_arch_mips;
    228       mach = 6000;
     234      mach = bfd_mach_mips6000;
    229235      break;
    230236
    231237    case MIPS_MAGIC_LITTLE3:
    232238    case MIPS_MAGIC_BIG3:
    233       /* MIPS ISA level 3: the r4000 */
     239      /* MIPS ISA level 3: the r4000. */
    234240      arch = bfd_arch_mips;
    235       mach = 4000;
     241      mach = bfd_mach_mips4000;
    236242      break;
    237243
     
    266272        default:
    267273        case 0:
    268         case 3000:
     274        case bfd_mach_mips3000:
    269275          big = MIPS_MAGIC_BIG;
    270276          little = MIPS_MAGIC_LITTLE;
    271277          break;
    272278
    273         case 6000:
     279        case bfd_mach_mips6000:
    274280          big = MIPS_MAGIC_BIG2;
    275281          little = MIPS_MAGIC_LITTLE2;
    276282          break;
    277283
    278         case 4000:
     284        case bfd_mach_mips4000:
    279285          big = MIPS_MAGIC_BIG3;
    280286          little = MIPS_MAGIC_LITTLE3;
     
    374380/* Get the BFD flags to use for a section.  */
    375381
    376 flagword
    377 _bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section)
     382bfd_boolean
     383_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
    378384     bfd *abfd ATTRIBUTE_UNUSED;
    379385     PTR hdr;
    380386     const char *name ATTRIBUTE_UNUSED;
    381387     asection *section ATTRIBUTE_UNUSED;
     388     flagword * flags_ptr;
    382389{
    383390  struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
    384391  long styp_flags = internal_s->s_flags;
    385   flagword sec_flags=0;
     392  flagword sec_flags = 0;
    386393
    387394  if (styp_flags & STYP_NOLOAD)
     
    425432  else if ((styp_flags & STYP_BSS)
    426433           || (styp_flags & STYP_SBSS))
    427     {
    428       sec_flags |= SEC_ALLOC;
    429     }
     434    sec_flags |= SEC_ALLOC;
    430435  else if ((styp_flags & STYP_INFO) || styp_flags == STYP_COMMENT)
    431     {
    432       sec_flags |= SEC_NEVER_LOAD;
    433     }
     436    sec_flags |= SEC_NEVER_LOAD;
    434437  else if ((styp_flags & STYP_LITA)
    435438           || (styp_flags & STYP_LIT8)
    436439           || (styp_flags & STYP_LIT4))
    437     {
    438       sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
    439     }
     440    sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY;
    440441  else if (styp_flags & STYP_ECOFF_LIB)
    441     {
    442       sec_flags |= SEC_COFF_SHARED_LIBRARY;
    443     }
     442    sec_flags |= SEC_COFF_SHARED_LIBRARY;
    444443  else
    445     {
    446       sec_flags |= SEC_ALLOC | SEC_LOAD;
    447     }
    448 
    449   return sec_flags;
     444    sec_flags |= SEC_ALLOC | SEC_LOAD;
     445
     446  * flags_ptr = sec_flags;
     447  return TRUE;
    450448}
    451449
     
    453451/* Read in the symbolic header for an ECOFF object file.  */
    454452
    455 static boolean
     453static bfd_boolean
    456454ecoff_slurp_symbolic_header (abfd)
    457455     bfd *abfd;
     
    465463  if (ecoff_data (abfd)->debug_info.symbolic_header.magic ==
    466464      backend->debug_swap.sym_magic)
    467     return true;
     465    return TRUE;
    468466
    469467  /* See whether there is a symbolic header.  */
     
    471469    {
    472470      bfd_get_symcount (abfd) = 0;
    473       return true;
     471      return TRUE;
    474472    }
    475473
     
    482480    {
    483481      bfd_set_error (bfd_error_bad_value);
    484       return false;
     482      return FALSE;
    485483    }
    486484
    487485  /* Read the symbolic information header.  */
    488   raw = (PTR) bfd_malloc ((size_t) external_hdr_size);
     486  raw = (PTR) bfd_malloc (external_hdr_size);
    489487  if (raw == NULL)
    490488    goto error_return;
    491489
    492   if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) == -1
    493       || (bfd_read (raw, external_hdr_size, 1, abfd)
    494           != external_hdr_size))
     490  if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) != 0
     491      || bfd_bread (raw, external_hdr_size, abfd) != external_hdr_size)
    495492    goto error_return;
    496493  internal_symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
     
    509506  if (raw != NULL)
    510507    free (raw);
    511   return true;
     508  return TRUE;
    512509 error_return:
    513510  if (raw != NULL)
    514511    free (raw);
    515   return false;
     512  return FALSE;
    516513}
    517514
     
    520517   point in the backend structure.  */
    521518
    522 boolean
     519bfd_boolean
    523520_bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
    524521     bfd *abfd;
     
    537534  bfd_size_type raw_end;
    538535  bfd_size_type cb_end;
     536  bfd_size_type amt;
     537  file_ptr pos;
    539538
    540539  BFD_ASSERT (debug == &ecoff_data (abfd)->debug_info);
     
    543542     get.  */
    544543  if (ecoff_data (abfd)->raw_syments != (PTR) NULL)
    545     return true;
     544    return TRUE;
    546545  if (ecoff_data (abfd)->sym_filepos == 0)
    547546    {
    548547      bfd_get_symcount (abfd) = 0;
    549       return true;
     548      return TRUE;
    550549    }
    551550
    552551  if (! ecoff_slurp_symbolic_header (abfd))
    553     return false;
     552    return FALSE;
    554553
    555554  internal_symhdr = &debug->symbolic_header;
     
    564563     statically and dynamically linked executables.
    565564     If bfd supports SEEK_END someday, this code could be simplified.  */
    566 
    567565  raw_end = 0;
    568566
     
    576574  UPDATE_RAW_END (cbPdOffset, ipdMax, backend->debug_swap.external_pdr_size);
    577575  UPDATE_RAW_END (cbSymOffset, isymMax, backend->debug_swap.external_sym_size);
    578   UPDATE_RAW_END (cbOptOffset, ioptMax, backend->debug_swap.external_opt_size);
     576  /* eraxxon@alumni.rice.edu: ioptMax refers to the size of the
     577     optimization symtab, not the number of entries */
     578  UPDATE_RAW_END (cbOptOffset, ioptMax, sizeof (char));
    579579  UPDATE_RAW_END (cbAuxOffset, iauxMax, sizeof (union aux_ext));
    580580  UPDATE_RAW_END (cbSsOffset, issMax, sizeof (char));
     
    590590    {
    591591      ecoff_data (abfd)->sym_filepos = 0;
    592       return true;
     592      return TRUE;
    593593    }
    594594  raw = (PTR) bfd_alloc (abfd, raw_size);
    595595  if (raw == NULL)
    596     return false;
    597   if (bfd_seek (abfd,
    598                 (ecoff_data (abfd)->sym_filepos
    599                  + backend->debug_swap.external_hdr_size),
    600                 SEEK_SET) != 0
    601       || bfd_read (raw, raw_size, 1, abfd) != raw_size)
     596    return FALSE;
     597
     598  pos = ecoff_data (abfd)->sym_filepos;
     599  pos += backend->debug_swap.external_hdr_size;
     600  if (bfd_seek (abfd, pos, SEEK_SET) != 0
     601      || bfd_bread (raw, raw_size, abfd) != raw_size)
    602602    {
    603603      bfd_release (abfd, raw);
    604       return false;
     604      return FALSE;
    605605    }
    606606
     
    615615                          + (internal_symhdr->off1 \
    616616                             - raw_base))
     617
    617618  FIX (cbLineOffset, line, unsigned char *);
    618619  FIX (cbDnOffset, external_dnr, PTR);
     
    636637     We need to look at the fdr to deal with a lot of information in
    637638     the symbols, so we swap them here.  */
    638   debug->fdr = (struct fdr *) bfd_alloc (abfd,
    639                                          (internal_symhdr->ifdMax *
    640                                           sizeof (struct fdr)));
     639  amt = internal_symhdr->ifdMax;
     640  amt *= sizeof (struct fdr);
     641  debug->fdr = (struct fdr *) bfd_alloc (abfd, amt);
    641642  if (debug->fdr == NULL)
    642     return false;
     643    return FALSE;
    643644  external_fdr_size = backend->debug_swap.external_fdr_size;
    644645  fdr_ptr = debug->fdr;
     
    648649    (*backend->debug_swap.swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr);
    649650
    650   return true;
     651  return TRUE;
    651652}
    652653
     
    671672{
    672673  ecoff_symbol_type *new;
    673 
    674   new = (ecoff_symbol_type *) bfd_alloc (abfd, sizeof (ecoff_symbol_type));
     674  bfd_size_type amt = sizeof (ecoff_symbol_type);
     675
     676  new = (ecoff_symbol_type *) bfd_zalloc (abfd, amt);
    675677  if (new == (ecoff_symbol_type *) NULL)
    676678    return (asymbol *) NULL;
    677   memset ((PTR) new, 0, sizeof *new);
    678679  new->symbol.section = (asection *) NULL;
    679680  new->fdr = (FDR *) NULL;
    680   new->local = false;
     681  new->local = FALSE;
    681682  new->native = NULL;
    682683  new->symbol.the_bfd = abfd;
     
    686687/* Set the BFD flags and section for an ECOFF symbol.  */
    687688
    688 static boolean
     689static bfd_boolean
    689690ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
    690691     bfd *abfd;
     
    712713        {
    713714          asym->flags = BSF_DEBUGGING;
    714           return true;
     715          return TRUE;
    715716        }
    716717      break;
    717718    default:
    718719      asym->flags = BSF_DEBUGGING;
    719       return true;
     720      return TRUE;
    720721    }
    721722
     
    738739        asym->flags |= BSF_DEBUGGING;
    739740    }
     741
     742  if (ecoff_sym->st == stProc || ecoff_sym->st == stStaticProc)
     743    asym->flags |= BSF_FUNCTION;
     744
    740745  switch (ecoff_sym->sc)
    741746    {
     
    871876            arelent_chain *reloc_chain;
    872877            unsigned int bitsize;
     878            bfd_size_type amt;
    873879
    874880            /* Get a section with the same name as the symbol (usually
     
    890896                char *copy;
    891897
    892                 copy = (char *) bfd_alloc (abfd, strlen (name) + 1);
     898                amt = strlen (name) + 1;
     899                copy = (char *) bfd_alloc (abfd, amt);
    893900                if (!copy)
    894                   return false;
     901                  return FALSE;
    895902                strcpy (copy, name);
    896903                section = bfd_make_section (abfd, copy);
     
    898905
    899906            /* Build a reloc pointing to this constructor.  */
    900             reloc_chain =
    901               (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain));
     907            amt = sizeof (arelent_chain);
     908            reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt);
    902909            if (!reloc_chain)
    903               return false;
     910              return FALSE;
    904911            reloc_chain->relent.sym_ptr_ptr =
    905912              bfd_get_section (asym)->symbol_ptr_ptr;
     
    934941        }
    935942    }
    936   return true;
     943  return TRUE;
    937944}
    938945
    939946/* Read an ECOFF symbol table.  */
    940947
    941 boolean
     948bfd_boolean
    942949_bfd_ecoff_slurp_symbol_table (abfd)
    943950     bfd *abfd;
     
    962969  /* If we've already read in the symbol table, do nothing.  */
    963970  if (ecoff_data (abfd)->canonical_symbols != NULL)
    964     return true;
     971    return TRUE;
    965972
    966973  /* Get the symbolic information.  */
    967974  if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
    968975                                        &ecoff_data (abfd)->debug_info))
    969     return false;
     976    return FALSE;
    970977  if (bfd_get_symcount (abfd) == 0)
    971     return true;
    972 
    973   internal_size = bfd_get_symcount (abfd) * sizeof (ecoff_symbol_type);
     978    return TRUE;
     979
     980  internal_size = bfd_get_symcount (abfd);
     981  internal_size *= sizeof (ecoff_symbol_type);
    974982  internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size);
    975983  if (internal == NULL)
    976     return false;
     984    return FALSE;
    977985
    978986  internal_ptr = internal;
     
    991999                                  &internal_ptr->symbol, 1,
    9921000                                  internal_esym.weakext))
    993         return false;
     1001        return FALSE;
    9941002      /* The alpha uses a negative ifd field for section symbols.  */
    9951003      if (internal_esym.ifd >= 0)
     
    9981006      else
    9991007        internal_ptr->fdr = NULL;
    1000       internal_ptr->local = false;
     1008      internal_ptr->local = FALSE;
    10011009      internal_ptr->native = (PTR) eraw_src;
    10021010    }
     
    10261034          if (!ecoff_set_symbol_info (abfd, &internal_sym,
    10271035                                      &internal_ptr->symbol, 0, 0))
    1028             return false;
     1036            return FALSE;
    10291037          internal_ptr->fdr = fdr_ptr;
    1030           internal_ptr->local = true;
     1038          internal_ptr->local = TRUE;
    10311039          internal_ptr->native = (PTR) lraw_src;
    10321040        }
     
    10351043  ecoff_data (abfd)->canonical_symbols = internal;
    10361044
    1037   return true;
     1045  return TRUE;
    10381046}
    10391047
     
    10651073  ecoff_symbol_type **location = (ecoff_symbol_type **) alocation;
    10661074
    1067   if (_bfd_ecoff_slurp_symbol_table (abfd) == false)
     1075  if (! _bfd_ecoff_slurp_symbol_table (abfd))
    10681076    return -1;
    10691077  if (bfd_get_symcount (abfd) == 0)
     
    11951203  qualifiers[6].type = tqNil;
    11961204
    1197   /*
    1198    * Go get the basic type.
    1199    */
     1205  /* Go get the basic type.  */
    12001206  switch (basic_type)
    12011207    {
    1202     case btNil:                 /* undefined */
     1208    case btNil:                 /* Undefined. */
    12031209      strcpy (p1, "nil");
    12041210      break;
    12051211
    1206     case btAdr:                 /* address - integer same size as pointer */
     1212    case btAdr:                 /* Address - integer same size as pointer. */
    12071213      strcpy (p1, "address");
    12081214      break;
    12091215
    1210     case btChar:                /* character */
     1216    case btChar:                /* Character. */
    12111217      strcpy (p1, "char");
    12121218      break;
    12131219
    1214     case btUChar:               /* unsigned character */
     1220    case btUChar:               /* Unsigned character. */
    12151221      strcpy (p1, "unsigned char");
    12161222      break;
    12171223
    1218     case btShort:               /* short */
     1224    case btShort:               /* Short. */
    12191225      strcpy (p1, "short");
    12201226      break;
    12211227
    1222     case btUShort:              /* unsigned short */
     1228    case btUShort:              /* Unsigned short. */
    12231229      strcpy (p1, "unsigned short");
    12241230      break;
    12251231
    1226     case btInt:                 /* int */
     1232    case btInt:                 /* Int. */
    12271233      strcpy (p1, "int");
    12281234      break;
    12291235
    1230     case btUInt:                /* unsigned int */
     1236    case btUInt:                /* Unsigned int. */
    12311237      strcpy (p1, "unsigned int");
    12321238      break;
    12331239
    1234     case btLong:                /* long */
     1240    case btLong:                /* Long. */
    12351241      strcpy (p1, "long");
    12361242      break;
    12371243
    1238     case btULong:               /* unsigned long */
     1244    case btULong:               /* Unsigned long. */
    12391245      strcpy (p1, "unsigned long");
    12401246      break;
    12411247
    1242     case btFloat:               /* float (real) */
     1248    case btFloat:               /* Float (real). */
    12431249      strcpy (p1, "float");
    12441250      break;
    12451251
    1246     case btDouble:              /* Double (real) */
     1252    case btDouble:              /* Double (real). */
    12471253      strcpy (p1, "double");
    12481254      break;
     
    12521258         2nd word is file index if 1st word rfd is ST_RFDESCAPE.  */
    12531259
    1254     case btStruct:              /* Structure (Record) */
     1260    case btStruct:              /* Structure (Record). */
    12551261      _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
    12561262      ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
    12571263                            (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
    12581264                            "struct");
    1259       indx++;                   /* skip aux words */
     1265      indx++;                   /* Skip aux words. */
    12601266      break;
    12611267
     
    12641270         2nd word is file index if 1st word rfd is ST_RFDESCAPE.  */
    12651271
    1266     case btUnion:               /* Union */
     1272    case btUnion:               /* Union. */
    12671273      _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
    12681274      ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
    12691275                            (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
    12701276                            "union");
    1271       indx++;                   /* skip aux words */
     1277      indx++;                   /* Skip aux words. */
    12721278      break;
    12731279
     
    12761282         2nd word is file index if 1st word rfd is ST_RFDESCAPE.  */
    12771283
    1278     case btEnum:                /* Enumeration */
     1284    case btEnum:                /* Enumeration. */
    12791285      _bfd_ecoff_swap_rndx_in (bigendian, &aux_ptr[indx].a_rndx, &rndx);
    12801286      ecoff_emit_aggregate (abfd, fdr, p1, &rndx,
    12811287                            (long) AUX_GET_ISYM (bigendian, &aux_ptr[indx+1]),
    12821288                            "enum");
    1283       indx++;                   /* skip aux words */
    1284       break;
    1285 
    1286     case btTypedef:             /* defined via a typedef, isymRef points */
     1289      indx++;                   /* Skip aux words. */
     1290      break;
     1291
     1292    case btTypedef:             /* Defined via a typedef, isymRef points. */
    12871293      strcpy (p1, "typedef");
    12881294      break;
    12891295
    1290     case btRange:               /* subrange of int */
     1296    case btRange:               /* Subrange of int. */
    12911297      strcpy (p1, "subrange");
    12921298      break;
    12931299
    1294     case btSet:                 /* pascal sets */
     1300    case btSet:                 /* Pascal sets. */
    12951301      strcpy (p1, "set");
    12961302      break;
    12971303
    1298     case btComplex:             /* fortran complex */
     1304    case btComplex:             /* Fortran complex. */
    12991305      strcpy (p1, "complex");
    13001306      break;
    13011307
    1302     case btDComplex:            /* fortran double complex */
     1308    case btDComplex:            /* Fortran double complex. */
    13031309      strcpy (p1, "double complex");
    13041310      break;
    13051311
    1306     case btIndirect:            /* forward or unnamed typedef */
     1312    case btIndirect:            /* Forward or unnamed typedef. */
    13071313      strcpy (p1, "forward/unamed typedef");
    13081314      break;
    13091315
    1310     case btFixedDec:            /* Fixed Decimal */
     1316    case btFixedDec:            /* Fixed Decimal. */
    13111317      strcpy (p1, "fixed decimal");
    13121318      break;
    13131319
    1314     case btFloatDec:            /* Float Decimal */
     1320    case btFloatDec:            /* Float Decimal. */
    13151321      strcpy (p1, "float decimal");
    13161322      break;
    13171323
    1318     case btString:              /* Varying Length Character String */
     1324    case btString:              /* Varying Length Character String. */
    13191325      strcpy (p1, "string");
    13201326      break;
    13211327
    1322     case btBit:                 /* Aligned Bit String */
     1328    case btBit:                 /* Aligned Bit String. */
    13231329      strcpy (p1, "bit");
    13241330      break;
    13251331
    1326     case btPicture:             /* Picture */
     1332    case btPicture:             /* Picture. */
    13271333      strcpy (p1, "picture");
    13281334      break;
    13291335
    1330     case btVoid:                /* Void */
     1336    case btVoid:                /* Void. */
    13311337      strcpy (p1, "void");
    13321338      break;
     
    13391345  p1 += strlen (buffer1);
    13401346
    1341   /*
    1342    * If this is a bitfield, get the bitsize.
    1343    */
     1347  /* If this is a bitfield, get the bitsize.  */
    13441348  if (u.ti.fBitfield)
    13451349    {
     
    13511355    }
    13521356
    1353   /*
    1354    * Deal with any qualifiers.
    1355    */
     1357  /* Deal with any qualifiers.  */
    13561358  if (qualifiers[0].type != tqNil)
    13571359    {
    1358       /*
    1359        * Snarf up any array bounds in the correct order.  Arrays
    1360        * store 5 successive words in the aux. table:
    1361        *        word 0  RNDXR to type of the bounds (ie, int)
    1362        *        word 1  Current file descriptor index
    1363        *        word 2  low bound
    1364        *        word 3  high bound (or -1 if [])
    1365        *        word 4  stride size in bits
    1366        */
     1360      /* Snarf up any array bounds in the correct order.  Arrays
     1361         store 5 successive words in the aux. table:
     1362                word 0  RNDXR to type of the bounds (ie, int)
     1363                word 1  Current file descriptor index
     1364                word 2  low bound
     1365                word 3  high bound (or -1 if [])
     1366                word 4  stride size in bits.  */
    13671367      for (i = 0; i < 7; i++)
    13681368        {
     
    13791379        }
    13801380
    1381       /*
    1382        * Now print out the qualifiers.
    1383        */
     1381      /* Now print out the qualifiers.  */
    13841382      for (i = 0; i < 6; i++)
    13851383        {
     
    14171415                /* Print array bounds reversed (ie, in the order the C
    14181416                   programmer writes them).  C is such a fun language....  */
    1419 
    14201417                while (i < 5 && qualifiers[i+1].type == tqArray)
    14211418                  i++;
     
    14681465/* Return whether this is a local label.  */
    14691466
    1470 boolean
     1467bfd_boolean
    14711468_bfd_ecoff_bfd_is_local_label_name (abfd, name)
    14721469     bfd *abfd ATTRIBUTE_UNUSED;
     
    15191516      break;
    15201517    case bfd_print_symbol_all:
    1521       /* Print out the symbols in a reasonable way */
     1518      /* Print out the symbols in a reasonable way. */
    15221519      {
    15231520        char type;
     
    15931590            bigendian = fdr->fBigendian;
    15941591
    1595             /* This switch is basically from gcc/mips-tdump.c  */
     1592            /* This switch is basically from gcc/mips-tdump.c.  */
    15961593            switch (ecoff_ext.asym.st)
    15971594              {
     
    16681665/* Read in the relocs for a section.  */
    16691666
    1670 static boolean
     1667static bfd_boolean
    16711668ecoff_slurp_reloc_table (abfd, section, symbols)
    16721669     bfd *abfd;
     
    16771674  arelent *internal_relocs;
    16781675  bfd_size_type external_reloc_size;
    1679   bfd_size_type external_relocs_size;
     1676  bfd_size_type amt;
    16801677  char *external_relocs;
    16811678  arelent *rptr;
     
    16851682      || section->reloc_count == 0
    16861683      || (section->flags & SEC_CONSTRUCTOR) != 0)
    1687     return true;
    1688 
    1689   if (_bfd_ecoff_slurp_symbol_table (abfd) == false)
    1690     return false;
    1691 
    1692   internal_relocs = (arelent *) bfd_alloc (abfd,
    1693                                            (sizeof (arelent)
    1694                                             * section->reloc_count));
     1684    return TRUE;
     1685
     1686  if (! _bfd_ecoff_slurp_symbol_table (abfd))
     1687    return FALSE;
     1688
     1689  amt = section->reloc_count;
     1690  amt *= sizeof (arelent);
     1691  internal_relocs = (arelent *) bfd_alloc (abfd, amt);
     1692
    16951693  external_reloc_size = backend->external_reloc_size;
    1696   external_relocs_size = external_reloc_size * section->reloc_count;
    1697   external_relocs = (char *) bfd_alloc (abfd, external_relocs_size);
     1694  amt = external_reloc_size * section->reloc_count;
     1695  external_relocs = (char *) bfd_alloc (abfd, amt);
    16981696  if (internal_relocs == (arelent *) NULL
    16991697      || external_relocs == (char *) NULL)
    1700     return false;
     1698    return FALSE;
    17011699  if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0)
    1702     return false;
    1703   if (bfd_read (external_relocs, 1, external_relocs_size, abfd)
    1704       != external_relocs_size)
    1705     return false;
     1700    return FALSE;
     1701  if (bfd_bread (external_relocs, amt, abfd) != amt)
     1702    return FALSE;
    17061703
    17071704  for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++)
     
    17311728      else
    17321729        {
    1733           CONST char *sec_name;
     1730          const char *sec_name;
    17341731          asection *sec;
    17351732
     
    17731770  section->relocation = internal_relocs;
    17741771
    1775   return true;
     1772  return TRUE;
    17761773}
    17771774
     
    18031800      arelent *tblptr;
    18041801
    1805       if (ecoff_slurp_reloc_table (abfd, section, symbols) == false)
     1802      if (! ecoff_slurp_reloc_table (abfd, section, symbols))
    18061803        return -1;
    18071804
     
    18221819   wanted location.  */
    18231820
    1824 boolean
     1821bfd_boolean
    18251822_bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
    18261823                              filename_ptr, functionname_ptr, retline_ptr)
     
    18291826     asymbol **ignore_symbols ATTRIBUTE_UNUSED;
    18301827     bfd_vma offset;
    1831      CONST char **filename_ptr;
    1832      CONST char **functionname_ptr;
     1828     const char **filename_ptr;
     1829     const char **functionname_ptr;
    18331830     unsigned int *retline_ptr;
    18341831{
     
    18411838  if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, debug_info)
    18421839      || bfd_get_symcount (abfd) == 0)
    1843     return false;
     1840    return FALSE;
    18441841
    18451842  if (ecoff_data (abfd)->find_line_info == NULL)
    18461843    {
    1847       ecoff_data (abfd)->find_line_info =
    1848         ((struct ecoff_find_line *)
    1849          bfd_zalloc (abfd, sizeof (struct ecoff_find_line)));
     1844      bfd_size_type amt = sizeof (struct ecoff_find_line);
     1845      ecoff_data (abfd)->find_line_info
     1846        = (struct ecoff_find_line *) bfd_zalloc (abfd, amt);
    18501847      if (ecoff_data (abfd)->find_line_info == NULL)
    1851         return false;
     1848        return FALSE;
    18521849    }
    18531850  line_info = ecoff_data (abfd)->find_line_info;
     
    18721869   information.  */
    18731870
    1874 boolean
     1871bfd_boolean
    18751872_bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
    18761873     bfd *ibfd;
     
    18821879  asymbol **sym_ptr_ptr;
    18831880  size_t c;
    1884   boolean local;
     1881  bfd_boolean local;
    18851882
    18861883  /* We only want to copy information over if both BFD's use ECOFF
     
    18881885  if (bfd_get_flavour (ibfd) != bfd_target_ecoff_flavour
    18891886      || bfd_get_flavour (obfd) != bfd_target_ecoff_flavour)
    1890     return true;
     1887    return TRUE;
    18911888
    18921889  /* Copy the GP value and the register masks.  */
     
    19041901  sym_ptr_ptr = bfd_get_outsymbols (obfd);
    19051902  if (c == 0 || sym_ptr_ptr == (asymbol **) NULL)
    1906     return true;
     1903    return TRUE;
    19071904
    19081905  /* See if there are any local symbols.  */
    1909   local = false;
     1906  local = FALSE;
    19101907  for (; c > 0; c--, sym_ptr_ptr++)
    19111908    {
    19121909      if (ecoffsymbol (*sym_ptr_ptr)->local)
    19131910        {
    1914           local = true;
     1911          local = TRUE;
    19151912          break;
    19161913        }
     
    19751972    }
    19761973
    1977   return true;
     1974  return TRUE;
    19781975}
    19791976
     
    19831980   callers ignore the return value.  */
    19841981
    1985 boolean
     1982bfd_boolean
    19861983_bfd_ecoff_set_arch_mach (abfd, arch, machine)
    19871984     bfd *abfd;
     
    19981995_bfd_ecoff_sizeof_headers (abfd, reloc)
    19991996     bfd *abfd;
    2000      boolean reloc ATTRIBUTE_UNUSED;
     1997     bfd_boolean reloc ATTRIBUTE_UNUSED;
    20011998{
    20021999  asection *current;
     
    20182015/* Get the contents of a section.  */
    20192016
    2020 boolean
     2017bfd_boolean
    20212018_bfd_ecoff_get_section_contents (abfd, section, location, offset, count)
    20222019     bfd *abfd;
     
    20622059   reloc_filepos.  */
    20632060
    2064 static boolean
     2061static bfd_boolean
    20652062ecoff_compute_section_file_positions (abfd)
    20662063     bfd *abfd;
     
    20712068  unsigned int i;
    20722069  file_ptr old_sofar;
    2073   boolean rdata_in_text;
    2074   boolean first_data, first_nonalloc;
     2070  bfd_boolean rdata_in_text;
     2071  bfd_boolean first_data, first_nonalloc;
    20752072  const bfd_vma round = ecoff_backend (abfd)->round;
    2076 
    2077   sofar = _bfd_ecoff_sizeof_headers (abfd, false);
     2073  bfd_size_type amt;
     2074
     2075  sofar = _bfd_ecoff_sizeof_headers (abfd, FALSE);
    20782076  file_sofar = sofar;
    20792077
    20802078  /* Sort the sections by VMA.  */
    2081   sorted_hdrs = (asection **) bfd_malloc (abfd->section_count
    2082                                           * sizeof (asection *));
     2079  amt = abfd->section_count;
     2080  amt *= sizeof (asection *);
     2081  sorted_hdrs = (asection **) bfd_malloc (amt);
    20832082  if (sorted_hdrs == NULL)
    2084     return false;
     2083    return FALSE;
    20852084  for (current = abfd->sections, i = 0;
    20862085       current != NULL;
     
    21062105              && strcmp (current->name, _RCONST) != 0)
    21072106            {
    2108               rdata_in_text = false;
     2107              rdata_in_text = FALSE;
    21092108              break;
    21102109            }
     
    21132112  ecoff_data (abfd)->rdata_in_text = rdata_in_text;
    21142113
    2115   first_data = true;
    2116   first_nonalloc = true;
     2114  first_data = TRUE;
     2115  first_nonalloc = TRUE;
    21172116  for (i = 0; i < abfd->section_count; i++)
    21182117    {
     
    21472146          sofar = (sofar + round - 1) &~ (round - 1);
    21482147          file_sofar = (file_sofar + round - 1) &~ (round - 1);
    2149           first_data = false;
     2148          first_data = FALSE;
    21502149        }
    21512150      else if (strcmp (current->name, _LIB) == 0)
     
    21652164             as the .comment section on the Alpha.  This leaves room
    21662165             for the .bss section.  */
    2167           first_nonalloc = false;
     2166          first_nonalloc = FALSE;
    21682167          sofar = (sofar + round - 1) &~ (round - 1);
    21692168          file_sofar = (file_sofar + round - 1) &~ (round - 1);
     
    21912190        file_sofar += current->_raw_size;
    21922191
    2193       /* make sure that this section is of the right size too */
     2192      /* Make sure that this section is of the right size too. */
    21942193      old_sofar = sofar;
    21952194      sofar = BFD_ALIGN (sofar, 1 << alignment_power);
     
    22042203  ecoff_data (abfd)->reloc_filepos = file_sofar;
    22052204
    2206   return true;
     2205  return TRUE;
    22072206}
    22082207
     
    22262225      if (! ecoff_compute_section_file_positions (abfd))
    22272226        abort ();
    2228       abfd->output_has_begun = true;
     2227      abfd->output_has_begun = TRUE;
    22292228    }
    22302229
     
    22662265/* Set the contents of a section.  */
    22672266
    2268 boolean
     2267bfd_boolean
    22692268_bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
    22702269     bfd *abfd;
     
    22742273     bfd_size_type count;
    22752274{
     2275  file_ptr pos;
     2276
    22762277  /* This must be done first, because bfd_set_section_contents is
    2277      going to set output_has_begun to true.  */
    2278   if (abfd->output_has_begun == false)
     2278     going to set output_has_begun to TRUE.  */
     2279  if (! abfd->output_has_begun)
    22792280    {
    22802281      if (! ecoff_compute_section_file_positions (abfd))
    2281         return false;
     2282        return FALSE;
    22822283    }
    22832284
     
    23002301
    23012302  if (count == 0)
    2302     return true;
    2303 
    2304   if (bfd_seek (abfd, (file_ptr) (section->filepos + offset), SEEK_SET) != 0
    2305       || bfd_write (location, 1, count, abfd) != count)
    2306     return false;
    2307 
    2308   return true;
     2303    return TRUE;
     2304
     2305  pos = section->filepos + offset;
     2306  if (bfd_seek (abfd, pos, SEEK_SET) != 0
     2307      || bfd_bwrite (location, count, abfd) != count)
     2308    return FALSE;
     2309
     2310  return TRUE;
    23092311}
    23102312
     
    23292331   assembler.  */
    23302332
    2331 boolean
     2333bfd_boolean
    23322334bfd_ecoff_set_gp_value (abfd, gp_value)
    23332335     bfd *abfd;
     
    23382340    {
    23392341      bfd_set_error (bfd_error_invalid_operation);
    2340       return false;
     2342      return FALSE;
    23412343    }
    23422344
    23432345  ecoff_data (abfd)->gp = gp_value;
    23442346
    2345   return true;
     2347  return TRUE;
    23462348}
    23472349
     
    23492351   the assembler.  */
    23502352
    2351 boolean
     2353bfd_boolean
    23522354bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
    23532355     bfd *abfd;
     
    23622364    {
    23632365      bfd_set_error (bfd_error_invalid_operation);
    2364       return false;
     2366      return FALSE;
    23652367    }
    23662368
     
    23702372  if (cprmask != (unsigned long *) NULL)
    23712373    {
    2372       register int i;
     2374      int i;
    23732375
    23742376      for (i = 0; i < 3; i++)
     
    23762378    }
    23772379
    2378   return true;
     2380  return TRUE;
    23792381}
    23802382
     
    23822384   is passed to bfd_ecoff_debug_externals.  */
    23832385
    2384 static boolean
     2386static bfd_boolean
    23852387ecoff_get_extr (sym, esym)
    23862388     asymbol *sym;
     
    23972399          || (sym->flags & BSF_LOCAL) != 0
    23982400          || (sym->flags & BSF_SECTION_SYM) != 0)
    2399         return false;
     2401        return FALSE;
    24002402
    24012403      esym->jmptbl = 0;
     
    24092411      esym->asym.reserved = 0;
    24102412      esym->asym.index = indexNil;
    2411       return true;
     2413      return TRUE;
    24122414    }
    24132415
     
    24152417
    24162418  if (ecoff_sym_ptr->local)
    2417     return false;
     2419    return FALSE;
    24182420
    24192421  input_bfd = bfd_asymbol_bfd (sym);
     
    24412443    }
    24422444
    2443   return true;
     2445  return TRUE;
    24442446}
    24452447
     
    24572459/* Write out an ECOFF file.  */
    24582460
    2459 boolean
     2461bfd_boolean
    24602462_bfd_ecoff_write_object_contents (abfd)
    24612463     bfd *abfd;
     
    24692471    = backend->debug_swap.external_hdr_size;
    24702472  const bfd_size_type external_reloc_size = backend->external_reloc_size;
    2471   void (* const adjust_reloc_out) PARAMS ((bfd *,
    2472                                            const arelent *,
    2473                                            struct internal_reloc *))
     2473  void (* const adjust_reloc_out)
     2474  PARAMS ((bfd *, const arelent *, struct internal_reloc *))
    24742475    = backend->adjust_reloc_out;
    2475   void (* const swap_reloc_out) PARAMS ((bfd *,
    2476                                          const struct internal_reloc *,
    2477                                          PTR))
     2476  void (* const swap_reloc_out)
     2477  PARAMS ((bfd *, const struct internal_reloc *, PTR))
    24782478    = backend->swap_reloc_out;
    24792479  struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info;
     
    24842484  bfd_size_type text_size;
    24852485  bfd_vma text_start;
    2486   boolean set_text_start;
     2486  bfd_boolean set_text_start;
    24872487  bfd_size_type data_size;
    24882488  bfd_vma data_start;
    2489   boolean set_data_start;
     2489  bfd_boolean set_data_start;
    24902490  bfd_size_type bss_size;
    24912491  PTR buff = NULL;
     
    25092509
    25102510  if ((abfd->flags & D_PAGED) != 0)
    2511     text_size = _bfd_ecoff_sizeof_headers (abfd, false);
     2511    text_size = _bfd_ecoff_sizeof_headers (abfd, FALSE);
    25122512  else
    25132513    text_size = 0;
    25142514  text_start = 0;
    2515   set_text_start = false;
     2515  set_text_start = FALSE;
    25162516  data_size = 0;
    25172517  data_start = 0;
    2518   set_data_start = false;
     2518  set_data_start = FALSE;
    25192519  bss_size = 0;
    25202520
     
    25302530    if (siz < aoutsz)
    25312531      siz = aoutsz;
    2532     buff = (PTR) bfd_malloc ((size_t) siz);
     2532    buff = (PTR) bfd_malloc (siz);
    25332533    if (buff == NULL)
    25342534      goto error_return;
     
    25902590
    25912591      if (bfd_coff_swap_scnhdr_out (abfd, (PTR) &section, buff) == 0
    2592           || bfd_write (buff, 1, scnhsz, abfd) != scnhsz)
     2592          || bfd_bwrite (buff, scnhsz, abfd) != scnhsz)
    25932593        goto error_return;
    25942594
     
    26122612            {
    26132613              text_start = vma;
    2614               set_text_start = true;
     2614              set_text_start = TRUE;
    26152615            }
    26162616        }
     
    26282628            {
    26292629              data_start = vma;
    2630               set_data_start = true;
     2630              set_data_start = TRUE;
    26312631            }
    26322632        }
     
    26372637               || (section.s_flags & STYP_ECOFF_LIB) != 0
    26382638               || section.s_flags == STYP_COMMENT)
    2639         /* Do nothing */ ;
     2639        /* Do nothing. */ ;
    26402640      else
    26412641        abort ();
     
    26432643
    26442644  /* Set up the file header.  */
    2645 
    26462645  internal_f.f_magic = ecoff_get_magic (abfd);
    26472646
     
    27362735
    27372736  /* Write out the file header and the optional header.  */
    2738 
    27392737  if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
    27402738    goto error_return;
    27412739
    27422740  bfd_coff_swap_filehdr_out (abfd, (PTR) &internal_f, buff);
    2743   if (bfd_write (buff, 1, filhsz, abfd) != filhsz)
     2741  if (bfd_bwrite (buff, filhsz, abfd) != filhsz)
    27442742    goto error_return;
    27452743
    27462744  bfd_coff_swap_aouthdr_out (abfd, (PTR) &internal_a, buff);
    2747   if (bfd_write (buff, 1, aoutsz, abfd) != aoutsz)
     2745  if (bfd_bwrite (buff, aoutsz, abfd) != aoutsz)
    27482746    goto error_return;
    27492747
     
    27582756      debug->external_ext = debug->external_ext_end = NULL;
    27592757      debug->ssext = debug->ssext_end = NULL;
    2760       if (bfd_ecoff_debug_externals (abfd, debug, &backend->debug_swap,
    2761                                      (((abfd->flags & EXEC_P) == 0)
    2762                                       ? true : false),
    2763                                      ecoff_get_extr, ecoff_set_index)
    2764           == false)
     2758      if (! bfd_ecoff_debug_externals (abfd, debug, &backend->debug_swap,
     2759                                       (abfd->flags & EXEC_P) == 0,
     2760                                       ecoff_get_extr, ecoff_set_index))
    27652761        goto error_return;
    27662762
     
    27732769          arelent **reloc_end;
    27742770          char *out_ptr;
     2771          bfd_size_type amt;
    27752772
    27762773          if (current->reloc_count == 0)
    27772774            continue;
    27782775
    2779           reloc_buff =
    2780             bfd_alloc (abfd, current->reloc_count * external_reloc_size);
     2776          amt = current->reloc_count * external_reloc_size;
     2777          reloc_buff = bfd_alloc (abfd, amt);
    27812778          if (reloc_buff == NULL)
    27822779            goto error_return;
     
    28092806              else
    28102807                {
    2811                   CONST char *name;
     2808                  const char *name;
    28122809
    28132810                  name = bfd_get_section_name (abfd, bfd_get_section (sym));
     
    28542851          if (bfd_seek (abfd, current->rel_filepos, SEEK_SET) != 0)
    28552852            goto error_return;
    2856           if (bfd_write (reloc_buff,
    2857                          external_reloc_size, current->reloc_count, abfd)
    2858               != external_reloc_size * current->reloc_count)
     2853          amt = current->reloc_count * external_reloc_size;
     2854          if (bfd_bwrite (reloc_buff, amt, abfd) != amt)
    28592855            goto error_return;
    28602856          bfd_release (abfd, reloc_buff);
     
    28662862        {
    28672863          /* Write out the debugging information.  */
    2868           if (bfd_ecoff_write_debug (abfd, debug, &backend->debug_swap,
    2869                                      ecoff_data (abfd)->sym_filepos)
    2870               == false)
     2864          if (! bfd_ecoff_write_debug (abfd, debug, &backend->debug_swap,
     2865                                       ecoff_data (abfd)->sym_filepos))
    28712866            goto error_return;
    28722867        }
     
    28862881                    SEEK_SET) != 0)
    28872882        goto error_return;
    2888       if (bfd_read (&c, 1, 1, abfd) == 0)
     2883      if (bfd_bread (&c, (bfd_size_type) 1, abfd) == 0)
    28892884        c = 0;
    28902885      if (bfd_seek (abfd, (file_ptr) ecoff_data (abfd)->sym_filepos - 1,
    28912886                    SEEK_SET) != 0)
    28922887        goto error_return;
    2893       if (bfd_write (&c, 1, 1, abfd) != 1)
     2888      if (bfd_bwrite (&c, (bfd_size_type) 1, abfd) != 1)
    28942889        goto error_return;
    28952890    }
     
    28992894  if (buff != NULL)
    29002895    free (buff);
    2901   return true;
     2896  return TRUE;
    29022897 error_return:
    29032898  if (reloc_buff != NULL)
     
    29052900  if (buff != NULL)
    29062901    free (buff);
    2907   return false;
     2902  return FALSE;
    29082903}
    29092904
     
    29602955static unsigned int
    29612956ecoff_armap_hash (s, rehash, size, hlog)
    2962      CONST char *s;
     2957     const char *s;
    29632958     unsigned int *rehash;
    29642959     unsigned int size;
     
    29792974/* Read in the armap.  */
    29802975
    2981 boolean
     2976bfd_boolean
    29822977_bfd_ecoff_slurp_armap (abfd)
    29832978     bfd *abfd;
     
    29932988  struct symdef *symdef_ptr;
    29942989  char *stringbase;
     2990  bfd_size_type amt;
    29952991
    29962992  /* Get the name of the first element.  */
    2997   i = bfd_read ((PTR) nextname, 1, 16, abfd);
     2993  i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
    29982994  if (i == 0)
    2999       return true;
     2995      return TRUE;
    30002996  if (i != 16)
    3001       return false;
     2997      return FALSE;
    30022998
    30032999  if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
    3004     return false;
     3000    return FALSE;
    30053001
    30063002  /* Irix 4.0.5F apparently can use either an ECOFF armap or a
     
    30243020                  ARMAP_END, sizeof ARMAP_END - 1) != 0)
    30253021    {
    3026       bfd_has_map (abfd) = false;
    3027       return true;
     3022      bfd_has_map (abfd) = FALSE;
     3023      return TRUE;
    30283024    }
    30293025
     
    30353031    {
    30363032      bfd_set_error (bfd_error_wrong_format);
    3037       return false;
     3033      return FALSE;
    30383034    }
    30393035
     
    30423038  mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
    30433039  if (mapdata == (struct areltdata *) NULL)
    3044     return false;
     3040    return FALSE;
    30453041  parsed_size = mapdata->parsed_size;
    30463042  bfd_release (abfd, (PTR) mapdata);
     
    30483044  raw_armap = (char *) bfd_alloc (abfd, parsed_size);
    30493045  if (raw_armap == (char *) NULL)
    3050     return false;
    3051 
    3052   if (bfd_read ((PTR) raw_armap, 1, parsed_size, abfd) != parsed_size)
     3046    return FALSE;
     3047
     3048  if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size)
    30533049    {
    30543050      if (bfd_get_error () != bfd_error_system_call)
    30553051        bfd_set_error (bfd_error_malformed_archive);
    30563052      bfd_release (abfd, (PTR) raw_armap);
    3057       return false;
     3053      return FALSE;
    30583054    }
    30593055
    30603056  ardata->tdata = (PTR) raw_armap;
    30613057
    3062   count = bfd_h_get_32 (abfd, (PTR) raw_armap);
     3058  count = H_GET_32 (abfd, raw_armap);
    30633059
    30643060  ardata->symdef_count = 0;
     
    30673063  /* This code used to overlay the symdefs over the raw archive data,
    30683064     but that doesn't work on a 64 bit host.  */
    3069 
    30703065  stringbase = raw_armap + count * 8 + 8;
    30713066
     
    30873082        unsigned int hash, rehash, srch;
    30883083
    3089         name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr);
    3090         file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4));
     3084        name_offset = H_GET_32 (abfd, raw_ptr);
     3085        file_offset = H_GET_32 (abfd, (raw_ptr + 4));
    30913086        if (file_offset == 0)
    30923087          continue;
     
    31003095             srch != hash && srch != i;
    31013096             srch = (srch + rehash) & (count - 1))
    3102           BFD_ASSERT (bfd_h_get_32 (abfd, (PTR) (raw_armap + 8 + srch * 8))
    3103                       != 0);
     3097          BFD_ASSERT (H_GET_32 (abfd, (raw_armap + 8 + srch * 8)) != 0);
    31043098        BFD_ASSERT (srch == i);
    31053099      }
     
    31103104  raw_ptr = raw_armap + 4;
    31113105  for (i = 0; i < count; i++, raw_ptr += 8)
    3112     if (bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4)) != 0)
     3106    if (H_GET_32 (abfd, (raw_ptr + 4)) != 0)
    31133107      ++ardata->symdef_count;
    31143108
    3115   symdef_ptr = ((struct symdef *)
    3116                 bfd_alloc (abfd,
    3117                            ardata->symdef_count * sizeof (struct symdef)));
     3109  amt = ardata->symdef_count;
     3110  amt *= sizeof (struct symdef);
     3111  symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt);
    31183112  if (!symdef_ptr)
    3119     return false;
     3113    return FALSE;
    31203114
    31213115  ardata->symdefs = (carsym *) symdef_ptr;
     
    31263120      unsigned int name_offset, file_offset;
    31273121
    3128       file_offset = bfd_h_get_32 (abfd, (PTR) (raw_ptr + 4));
     3122      file_offset = H_GET_32 (abfd, (raw_ptr + 4));
    31293123      if (file_offset == 0)
    31303124        continue;
    3131       name_offset = bfd_h_get_32 (abfd, (PTR) raw_ptr);
     3125      name_offset = H_GET_32 (abfd, raw_ptr);
    31323126      symdef_ptr->s.name = stringbase + name_offset;
    31333127      symdef_ptr->file_offset = file_offset;
     
    31393133  ardata->first_file_filepos += ardata->first_file_filepos % 2;
    31403134
    3141   bfd_has_map (abfd) = true;
    3142 
    3143   return true;
     3135  bfd_has_map (abfd) = TRUE;
     3136
     3137  return TRUE;
    31443138}
    31453139
    31463140/* Write out an armap.  */
    31473141
    3148 boolean
     3142bfd_boolean
    31493143_bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
    31503144     bfd *abfd;
     
    31553149{
    31563150  unsigned int hashsize, hashlog;
    3157   unsigned int symdefsize;
     3151  bfd_size_type symdefsize;
    31583152  int padit;
    31593153  unsigned int stringsize;
     
    32283222     (((char *) (&hdr))[i]) = ' ';
    32293223
    3230   if (bfd_write ((PTR) &hdr, 1, sizeof (struct ar_hdr), abfd)
     3224  if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd)
    32313225      != sizeof (struct ar_hdr))
    3232     return false;
    3233 
    3234   bfd_h_put_32 (abfd, (bfd_vma) hashsize, temp);
    3235   if (bfd_write ((PTR) temp, 1, 4, abfd) != 4)
    3236     return false;
     3226    return FALSE;
     3227
     3228  H_PUT_32 (abfd, hashsize, temp);
     3229  if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
     3230    return FALSE;
    32373231
    32383232  hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
    32393233  if (!hashtable)
    3240     return false;
     3234    return FALSE;
    32413235
    32423236  current = abfd->archive_head;
     
    32483242      /* Advance firstreal to the file position of this archive
    32493243         element.  */
    3250       if (((bfd *) map[i].pos) != last_elt)
     3244      if (map[i].u.abfd != last_elt)
    32513245        {
    32523246          do
     
    32563250              current = current->next;
    32573251            }
    3258           while (current != (bfd *) map[i].pos);
     3252          while (current != map[i].u.abfd);
    32593253        }
    32603254
     
    32623256
    32633257      hash = ecoff_armap_hash (*map[i].name, &rehash, hashsize, hashlog);
    3264       if (bfd_h_get_32 (abfd, (PTR) (hashtable + (hash * 8) + 4)) != 0)
     3258      if (H_GET_32 (abfd, (hashtable + (hash * 8) + 4)) != 0)
    32653259        {
    32663260          unsigned int srch;
     
    32703264               srch != hash;
    32713265               srch = (srch + rehash) & (hashsize - 1))
    3272             if (bfd_h_get_32 (abfd, (PTR) (hashtable + (srch * 8) + 4)) == 0)
     3266            if (H_GET_32 (abfd, (hashtable + (srch * 8) + 4)) == 0)
    32733267              break;
    32743268
     
    32783272        }
    32793273
    3280       bfd_h_put_32 (abfd, (bfd_vma) map[i].namidx,
    3281                     (PTR) (hashtable + hash * 8));
    3282       bfd_h_put_32 (abfd, (bfd_vma) firstreal,
    3283                     (PTR) (hashtable + hash * 8 + 4));
    3284     }
    3285 
    3286   if (bfd_write ((PTR) hashtable, 1, symdefsize, abfd) != symdefsize)
    3287     return false;
     3274      H_PUT_32 (abfd, map[i].namidx, (hashtable + hash * 8));
     3275      H_PUT_32 (abfd, firstreal, (hashtable + hash * 8 + 4));
     3276    }
     3277
     3278  if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize)
     3279    return FALSE;
    32883280
    32893281  bfd_release (abfd, hashtable);
    32903282
    32913283  /* Now write the strings.  */
    3292   bfd_h_put_32 (abfd, (bfd_vma) stringsize, temp);
    3293   if (bfd_write ((PTR) temp, 1, 4, abfd) != 4)
    3294     return false;
     3284  H_PUT_32 (abfd, stringsize, temp);
     3285  if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
     3286    return FALSE;
    32953287  for (i = 0; i < orl_count; i++)
    32963288    {
     
    32983290
    32993291      len = strlen (*map[i].name) + 1;
    3300       if (bfd_write ((PTR) (*map[i].name), 1, len, abfd) != len)
    3301         return false;
     3292      if (bfd_bwrite ((PTR) (*map[i].name), len, abfd) != len)
     3293        return FALSE;
    33023294    }
    33033295
     
    33063298  if (padit)
    33073299    {
    3308       if (bfd_write ("", 1, 1, abfd) != 1)
    3309         return false;
    3310     }
    3311 
    3312   return true;
     3300      if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1)
     3301        return FALSE;
     3302    }
     3303
     3304  return TRUE;
    33133305}
    33143306
     
    33223314  struct artdata *tdata_hold;
    33233315  char armag[SARMAG + 1];
    3324 
    3325   tdata_hold = abfd->tdata.aout_ar_data;
    3326 
    3327   if (bfd_read ((PTR) armag, 1, SARMAG, abfd) != SARMAG)
     3316  bfd_size_type amt;
     3317
     3318  if (bfd_bread ((PTR) armag, (bfd_size_type) SARMAG, abfd) != SARMAG)
    33283319    {
    33293320      if (bfd_get_error () != bfd_error_system_call)
     
    33383329    }
    33393330
    3340   /* We are setting bfd_ardata(abfd) here, but since bfd_ardata
    3341      involves a cast, we can't do it as the left operand of
    3342      assignment.  */
    3343   abfd->tdata.aout_ar_data =
    3344     (struct artdata *) bfd_zalloc (abfd, sizeof (struct artdata));
    3345 
     3331  tdata_hold = bfd_ardata (abfd);
     3332
     3333  amt = sizeof (struct artdata);
     3334  bfd_ardata (abfd) = (struct artdata *) bfd_zalloc (abfd, amt);
    33463335  if (bfd_ardata (abfd) == (struct artdata *) NULL)
    33473336    {
    3348       abfd->tdata.aout_ar_data = tdata_hold;
     3337      bfd_ardata (abfd) = tdata_hold;
    33493338      return (const bfd_target *) NULL;
    33503339    }
     
    33573346  bfd_ardata (abfd)->tdata = NULL;
    33583347
    3359   if (_bfd_ecoff_slurp_armap (abfd) == false
    3360       || _bfd_ecoff_slurp_extended_name_table (abfd) == false)
     3348  if (! _bfd_ecoff_slurp_armap (abfd)
     3349      || ! _bfd_ecoff_slurp_extended_name_table (abfd))
    33613350    {
    33623351      bfd_release (abfd, bfd_ardata (abfd));
    3363       abfd->tdata.aout_ar_data = tdata_hold;
     3352      bfd_ardata (abfd) = tdata_hold;
    33643353      return (const bfd_target *) NULL;
    33653354    }
     
    33793368      if (first != NULL)
    33803369        {
    3381           boolean fail;
    3382 
    3383           first->target_defaulted = false;
    3384           fail = false;
     3370          first->target_defaulted = FALSE;
    33853371          if (bfd_check_format (first, bfd_object)
    33863372              && first->xvec != abfd->xvec)
    33873373            {
     3374#if 0
     3375              /* We ought to close `first' here, but we can't, because
     3376                 we have no way to remove it from the archive cache.
     3377                 It's close to impossible to figure out when we can
     3378                 release bfd_ardata.  FIXME.  */
    33883379              (void) bfd_close (first);
    33893380              bfd_release (abfd, bfd_ardata (abfd));
    3390               abfd->tdata.aout_ar_data = tdata_hold;
    3391               bfd_set_error (bfd_error_wrong_format);
     3381#endif
     3382              bfd_set_error (bfd_error_wrong_object_format);
     3383              bfd_ardata (abfd) = tdata_hold;
    33923384              return NULL;
    33933385            }
    3394 
    3395           /* We ought to close first here, but we can't, because we
    3396              have no way to remove it from the archive cache.  FIXME.  */
     3386          /* And we ought to close `first' here too.  */
    33973387        }
    33983388    }
     
    34083398           struct bfd_hash_table *table,
    34093399           const char *string));
    3410 static boolean ecoff_link_add_archive_symbols
     3400static bfd_boolean ecoff_link_add_archive_symbols
    34113401  PARAMS ((bfd *, struct bfd_link_info *));
    3412 static boolean ecoff_link_check_archive_element
    3413   PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
    3414 static boolean ecoff_link_add_object_symbols
     3402static bfd_boolean ecoff_link_check_archive_element
     3403  PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded));
     3404static bfd_boolean ecoff_link_add_object_symbols
    34153405  PARAMS ((bfd *, struct bfd_link_info *));
    3416 static boolean ecoff_link_add_externals
     3406static bfd_boolean ecoff_link_add_externals
    34173407  PARAMS ((bfd *, struct bfd_link_info *, PTR, char *));
    34183408
     
    34603450{
    34613451  struct ecoff_link_hash_table *ret;
    3462 
    3463   ret = ((struct ecoff_link_hash_table *)
    3464          bfd_alloc (abfd, sizeof (struct ecoff_link_hash_table)));
     3452  bfd_size_type amt = sizeof (struct ecoff_link_hash_table);
     3453
     3454  ret = (struct ecoff_link_hash_table *) bfd_malloc (amt);
    34653455  if (ret == NULL)
    34663456    return NULL;
     
    34853475  (bfd_link_hash_traverse                                               \
    34863476   (&(table)->root,                                                     \
    3487     (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),  \
     3477    (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
    34883478    (info)))
    34893479
     
    34963486   appropriate.  */
    34973487
    3498 boolean
     3488bfd_boolean
    34993489_bfd_ecoff_bfd_link_add_symbols (abfd, info)
    35003490     bfd *abfd;
     
    35093499    default:
    35103500      bfd_set_error (bfd_error_wrong_format);
    3511       return false;
     3501      return FALSE;
    35123502    }
    35133503}
     
    35203510   another one.  */
    35213511
    3522 static boolean
     3512static bfd_boolean
    35233513ecoff_link_add_archive_symbols (abfd, info)
    35243514     bfd *abfd;
     
    35383528      /* An empty archive is a special case.  */
    35393529      if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
    3540         return true;
     3530        return TRUE;
    35413531      bfd_set_error (bfd_error_no_armap);
    3542       return false;
     3532      return FALSE;
    35433533    }
    35443534
     
    35523542            (abfd, info, ecoff_link_check_archive_element));
    35533543
    3554   armap_count = bfd_h_get_32 (abfd, raw_armap);
     3544  armap_count = H_GET_32 (abfd, raw_armap);
    35553545
    35563546  armap_log = 0;
     
    36053595                               armap_log);
    36063596
    3607       file_offset = bfd_h_get_32 (abfd, hashtable + (hash * 8) + 4);
     3597      file_offset = H_GET_32 (abfd, hashtable + (hash * 8) + 4);
    36083598      if (file_offset == 0)
    36093599        {
     
    36133603        }
    36143604
    3615       name = stringbase + bfd_h_get_32 (abfd, hashtable + (hash * 8));
     3605      name = stringbase + H_GET_32 (abfd, hashtable + (hash * 8));
    36163606      if (name[0] != h->root.string[0]
    36173607          || strcmp (name, h->root.string) != 0)
    36183608        {
    36193609          unsigned int srch;
    3620           boolean found;
     3610          bfd_boolean found;
    36213611
    36223612          /* That was the wrong symbol.  Try rehashing.  */
    3623           found = false;
     3613          found = FALSE;
    36243614          for (srch = (hash + rehash) & (armap_count - 1);
    36253615               srch != hash;
    36263616               srch = (srch + rehash) & (armap_count - 1))
    36273617            {
    3628               file_offset = bfd_h_get_32 (abfd, hashtable + (srch * 8) + 4);
     3618              file_offset = H_GET_32 (abfd, hashtable + (srch * 8) + 4);
    36293619              if (file_offset == 0)
    36303620                break;
    3631               name = stringbase + bfd_h_get_32 (abfd, hashtable + (srch * 8));
     3621              name = stringbase + H_GET_32 (abfd, hashtable + (srch * 8));
    36323622              if (name[0] == h->root.string[0]
    36333623                  && strcmp (name, h->root.string) == 0)
    36343624                {
    3635                   found = true;
     3625                  found = TRUE;
    36363626                  break;
    36373627                }
     
    36473637        }
    36483638
    3649       element = (*backend->get_elt_at_filepos) (abfd, file_offset);
     3639      element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset);
    36503640      if (element == (bfd *) NULL)
    3651         return false;
     3641        return FALSE;
    36523642
    36533643      if (! bfd_check_format (element, bfd_object))
    3654         return false;
     3644        return FALSE;
    36553645
    36563646      /* Unlike the generic linker, we know that this element provides
     
    36583648         to include it.  We don't need to check anything.  */
    36593649      if (! (*info->callbacks->add_archive_element) (info, element, name))
    3660         return false;
     3650        return FALSE;
    36613651      if (! ecoff_link_add_object_symbols (element, info))
    3662         return false;
     3652        return FALSE;
    36633653
    36643654      pundef = &(*pundef)->next;
    36653655    }
    36663656
    3667   return true;
     3657  return TRUE;
    36683658}
    36693659
     
    36713661   because we were not dealing with an ECOFF archive.  */
    36723662
    3673 static boolean
     3663static bfd_boolean
    36743664ecoff_link_check_archive_element (abfd, info, pneeded)
    36753665     bfd *abfd;
    36763666     struct bfd_link_info *info;
    3677      boolean *pneeded;
     3667     bfd_boolean *pneeded;
    36783668{
    36793669  const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
     
    36833673  bfd_size_type external_ext_size;
    36843674  PTR external_ext = NULL;
    3685   size_t esize;
     3675  bfd_size_type esize;
    36863676  char *ssext = NULL;
    36873677  char *ext_ptr;
    36883678  char *ext_end;
    36893679
    3690   *pneeded = false;
     3680  *pneeded = FALSE;
    36913681
    36923682  if (! ecoff_slurp_symbolic_header (abfd))
     
    37063696    goto error_return;
    37073697
    3708   if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0
    3709       || bfd_read (external_ext, 1, esize, abfd) != esize)
     3698  if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0
     3699      || bfd_bread (external_ext, esize, abfd) != esize)
    37103700    goto error_return;
    37113701
    3712   ssext = (char *) bfd_malloc (symhdr->issExtMax);
     3702  ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax);
    37133703  if (ssext == NULL && symhdr->issExtMax != 0)
    37143704    goto error_return;
    37153705
    3716   if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0
    3717       || (bfd_read (ssext, 1, symhdr->issExtMax, abfd) !=
    3718           (bfd_size_type) symhdr->issExtMax))
     3706  if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0
     3707      || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd)
     3708          != (bfd_size_type) symhdr->issExtMax))
    37193709    goto error_return;
    37203710
     
    37263716    {
    37273717      EXTR esym;
    3728       boolean def;
     3718      bfd_boolean def;
    37293719      const char *name;
    37303720      struct bfd_link_hash_entry *h;
     
    37523742        case scFini:
    37533743        case scRConst:
    3754           def = true;
     3744          def = TRUE;
    37553745          break;
    37563746        default:
    3757           def = false;
     3747          def = FALSE;
    37583748          break;
    37593749        }
     
    37633753
    37643754      name = ssext + esym.asym.iss;
    3765       h = bfd_link_hash_lookup (info->hash, name, false, false, true);
     3755      h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
    37663756
    37673757      /* Unlike the generic linker, we do not pull in elements because
     
    37773767        goto error_return;
    37783768
    3779       *pneeded = true;
     3769      *pneeded = TRUE;
    37803770      goto successful_return;
    37813771    }
     
    37863776  if (ssext != NULL)
    37873777    free (ssext);
    3788   return true;
     3778  return TRUE;
    37893779 error_return:
    37903780  if (external_ext != NULL)
     
    37923782  if (ssext != NULL)
    37933783    free (ssext);
    3794   return false;
     3784  return FALSE;
    37953785}
    37963786
     
    37983788   table.  */
    37993789
    3800 static boolean
     3790static bfd_boolean
    38013791ecoff_link_add_object_symbols (abfd, info)
    38023792     bfd *abfd;
     
    38063796  bfd_size_type external_ext_size;
    38073797  PTR external_ext = NULL;
    3808   size_t esize;
     3798  bfd_size_type esize;
    38093799  char *ssext = NULL;
    3810   boolean result;
     3800  bfd_boolean result;
    38113801
    38123802  if (! ecoff_slurp_symbolic_header (abfd))
    3813     return false;
     3803    return FALSE;
    38143804
    38153805  /* If there are no symbols, we don't want it.  */
    38163806  if (bfd_get_symcount (abfd) == 0)
    3817     return true;
     3807    return TRUE;
    38183808
    38193809  symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
     
    38263816    goto error_return;
    38273817
    3828   if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0
    3829       || bfd_read (external_ext, 1, esize, abfd) != esize)
     3818  if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0
     3819      || bfd_bread (external_ext, esize, abfd) != esize)
    38303820    goto error_return;
    38313821
    3832   ssext = (char *) bfd_malloc (symhdr->issExtMax);
     3822  ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax);
    38333823  if (ssext == NULL && symhdr->issExtMax != 0)
    38343824    goto error_return;
    38353825
    3836   if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0
    3837       || (bfd_read (ssext, 1, symhdr->issExtMax, abfd)
     3826  if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0
     3827      || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd)
    38383828          != (bfd_size_type) symhdr->issExtMax))
    38393829    goto error_return;
     
    38523842  if (external_ext != NULL)
    38533843    free (external_ext);
    3854   return false;
     3844  return FALSE;
    38553845}
    38563846
     
    38613851   We do not want to read the external symbol information again.  */
    38623852
    3863 static boolean
     3853static bfd_boolean
    38643854ecoff_link_add_externals (abfd, info, external_ext, ssext)
    38653855     bfd *abfd;
     
    38733863  bfd_size_type external_ext_size = backend->debug_swap.external_ext_size;
    38743864  unsigned long ext_count;
    3875   struct ecoff_link_hash_entry **sym_hash;
     3865  struct bfd_link_hash_entry **sym_hash;
    38763866  char *ext_ptr;
    38773867  char *ext_end;
     3868  bfd_size_type amt;
    38783869
    38793870  ext_count = ecoff_data (abfd)->debug_info.symbolic_header.iextMax;
    38803871
    3881   sym_hash = ((struct ecoff_link_hash_entry **)
    3882               bfd_alloc (abfd,
    3883                          ext_count * sizeof (struct bfd_link_hash_entry *)));
     3872  amt = ext_count;
     3873  amt *= sizeof (struct bfd_link_hash_entry *);
     3874  sym_hash = (struct bfd_link_hash_entry **) bfd_alloc (abfd, amt);
    38843875  if (!sym_hash)
    3885     return false;
    3886   ecoff_data (abfd)->sym_hashes = sym_hash;
     3876    return FALSE;
     3877  ecoff_data (abfd)->sym_hashes = (struct ecoff_link_hash_entry **) sym_hash;
    38873878
    38883879  ext_ptr = (char *) external_ext;
     
    38913882    {
    38923883      EXTR esym;
    3893       boolean skip;
     3884      bfd_boolean skip;
    38943885      bfd_vma value;
    38953886      asection *section;
     
    39023893
    39033894      /* Skip debugging symbols.  */
    3904       skip = false;
     3895      skip = FALSE;
    39053896      switch (esym.asym.st)
    39063897        {
     
    39123903          break;
    39133904        default:
    3914           skip = true;
     3905          skip = TRUE;
    39153906          break;
    39163907        }
     
    40154006      name = ssext + esym.asym.iss;
    40164007
    4017       h = NULL;
    40184008      if (! (_bfd_generic_link_add_one_symbol
    40194009             (info, abfd, name,
    4020               esym.weakext ? BSF_WEAK : BSF_GLOBAL,
    4021               section, value, (const char *) NULL, true, true,
    4022               (struct bfd_link_hash_entry **) &h)))
    4023         return false;
    4024 
    4025       *sym_hash = h;
     4010              (flagword) (esym.weakext ? BSF_WEAK : BSF_GLOBAL),
     4011              section, value, (const char *) NULL, TRUE, TRUE, sym_hash)))
     4012        return FALSE;
     4013
     4014      h = (struct ecoff_link_hash_entry *) *sym_hash;
    40264015
    40274016      /* If we are building an ECOFF hash table, save the external
     
    40614050    }
    40624051
    4063   return true;
     4052  return TRUE;
    40644053}
    40654054
     
    40674056/* ECOFF final link routines.  */
    40684057
    4069 static boolean ecoff_final_link_debug_accumulate
     4058static bfd_boolean ecoff_final_link_debug_accumulate
    40704059  PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
    40714060           PTR handle));
    4072 static boolean ecoff_link_write_external
     4061static bfd_boolean ecoff_link_write_external
    40734062  PARAMS ((struct ecoff_link_hash_entry *, PTR));
    4074 static boolean ecoff_indirect_link_order
     4063static bfd_boolean ecoff_indirect_link_order
    40754064  PARAMS ((bfd *, struct bfd_link_info *, asection *,
    40764065           struct bfd_link_order *));
    4077 static boolean ecoff_reloc_link_order
     4066static bfd_boolean ecoff_reloc_link_order
    40784067  PARAMS ((bfd *, struct bfd_link_info *, asection *,
    40794068           struct bfd_link_order *));
     
    40924081   close and reopen some input BFDs; I'll see how bad this is.  */
    40934082
    4094 boolean
     4083bfd_boolean
    40954084_bfd_ecoff_bfd_final_link (abfd, info)
    40964085     bfd *abfd;
     
    41394128  handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info);
    41404129  if (handle == (PTR) NULL)
    4141     return false;
     4130    return FALSE;
    41424131
    41434132  /* Accumulate the debugging symbols from each input BFD.  */
     
    41464135       input_bfd = input_bfd->link_next)
    41474136    {
    4148       boolean ret;
     4137      bfd_boolean ret;
    41494138
    41504139      if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour)
     
    41634152                                                input_bfd, info);
    41644153      if (! ret)
    4165         return false;
     4154        return FALSE;
    41664155
    41674156      /* Combine the register masks.  */
     
    42074196                                           &backend->debug_swap, info,
    42084197                                           ecoff_data (abfd)->sym_filepos))
    4209     return false;
     4198    return FALSE;
    42104199
    42114200  bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info);
     
    42254214      struct bfd_link_hash_entry *h;
    42264215
    4227       h = bfd_link_hash_lookup (info->hash, "_gp", false, false, true);
     4216      h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE);
    42284217      if (h != (struct bfd_link_hash_entry *) NULL
    42294218          && h->type == bfd_link_hash_defined)
     
    42684257            {
    42694258              if (! ecoff_indirect_link_order (abfd, info, o, p))
    4270                 return false;
     4259                return FALSE;
    42714260            }
    42724261          else if (p->type == bfd_section_reloc_link_order
     
    42744263            {
    42754264              if (! ecoff_reloc_link_order (abfd, info, o, p))
    4276                 return false;
     4265                return FALSE;
    42774266            }
    42784267          else
    42794268            {
    42804269              if (! _bfd_default_link_order (abfd, info, o, p))
    4281                 return false;
     4270                return FALSE;
    42824271            }
    42834272        }
     
    42864275  bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax;
    42874276
    4288   ecoff_data (abfd)->linker = true;
    4289 
    4290   return true;
     4277  ecoff_data (abfd)->linker = TRUE;
     4278
     4279  return TRUE;
    42914280}
    42924281
     
    42954284   input BFD.  */
    42964285
    4297 static boolean
     4286static bfd_boolean
    42984287ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
    42994288     bfd *output_bfd;
     
    43064295    &ecoff_backend (input_bfd)->debug_swap;
    43074296  HDRR *symhdr = &debug->symbolic_header;
    4308   boolean ret;
    4309 
    4310 #define READ(ptr, offset, count, size, type)                            \
    4311   if (symhdr->count == 0)                                               \
    4312     debug->ptr = NULL;                                                  \
    4313   else                                                                  \
    4314     {                                                                   \
    4315       debug->ptr = (type) bfd_malloc ((size_t) (size * symhdr->count)); \
    4316       if (debug->ptr == NULL)                                           \
    4317         {                                                               \
    4318           ret = false;                                                  \
    4319           goto return_something;                                        \
    4320         }                                                               \
    4321       if ((bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET)    \
    4322            != 0)                                                        \
    4323           || (bfd_read (debug->ptr, size, symhdr->count,                \
    4324                         input_bfd) != size * symhdr->count))            \
    4325         {                                                               \
    4326           ret = false;                                                  \
    4327           goto return_something;                                        \
    4328         }                                                               \
     4297  bfd_boolean ret;
     4298
     4299#define READ(ptr, offset, count, size, type)                             \
     4300  if (symhdr->count == 0)                                                \
     4301    debug->ptr = NULL;                                                   \
     4302  else                                                                   \
     4303    {                                                                    \
     4304      bfd_size_type amt = (bfd_size_type) size * symhdr->count;          \
     4305      debug->ptr = (type) bfd_malloc (amt);                              \
     4306      if (debug->ptr == NULL)                                            \
     4307        {                                                                \
     4308          ret = FALSE;                                                   \
     4309          goto return_something;                                         \
     4310        }                                                                \
     4311      if (bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \
     4312          || bfd_bread (debug->ptr, amt, input_bfd) != amt)              \
     4313        {                                                                \
     4314          ret = FALSE;                                                   \
     4315          goto return_something;                                         \
     4316        }                                                                \
    43294317    }
    43304318
     
    43954383   the hash table.  */
    43964384
    4397 static boolean
     4385static bfd_boolean
    43984386ecoff_link_write_external (h, data)
    43994387     struct ecoff_link_hash_entry *h;
     
    44024390  struct extsym_info *einfo = (struct extsym_info *) data;
    44034391  bfd *output_bfd = einfo->abfd;
    4404   boolean strip;
     4392  bfd_boolean strip;
     4393
     4394  if (h->root.type == bfd_link_hash_warning)
     4395    {
     4396      h = (struct ecoff_link_hash_entry *) h->root.u.i.link;
     4397      if (h->root.type == bfd_link_hash_new)
     4398        return TRUE;
     4399    }
    44054400
    44064401  /* We need to check if this symbol is being stripped.  */
    44074402  if (h->root.type == bfd_link_hash_undefined
    44084403      || h->root.type == bfd_link_hash_undefweak)
    4409     strip = false;
     4404    strip = FALSE;
    44104405  else if (einfo->info->strip == strip_all
    44114406           || (einfo->info->strip == strip_some
    44124407               && bfd_hash_lookup (einfo->info->keep_hash,
    44134408                                   h->root.root.string,
    4414                                    false, false) == NULL))
    4415     strip = true;
     4409                                   FALSE, FALSE) == NULL))
     4410    strip = TRUE;
    44164411  else
    4417     strip = false;
     4412    strip = FALSE;
    44184413
    44194414  if (strip || h->written)
    4420     return true;
     4415    return TRUE;
    44214416
    44224417  if (h->abfd == (bfd *) NULL)
     
    44854480    {
    44864481    default:
     4482    case bfd_link_hash_warning:
    44874483    case bfd_link_hash_new:
    44884484      abort ();
     
    45134509      break;
    45144510    case bfd_link_hash_indirect:
    4515     case bfd_link_hash_warning:
    4516       /* FIXME: Ignore these for now.  The circumstances under which
    4517          they should be written out are not clear to me.  */
    4518       return true;
     4511      /* We ignore these symbols, since the indirected symbol is
     4512         already in the hash table.  */
     4513      return TRUE;
    45194514    }
    45204515
     
    45324527/* Relocate and write an ECOFF section into an ECOFF output file.  */
    45334528
    4534 static boolean
     4529static bfd_boolean
    45354530ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
    45364531     bfd *output_bfd;
     
    45484543  bfd_size_type external_relocs_size;
    45494544  PTR external_relocs = NULL;
     4545  bfd_size_type amt;
    45504546
    45514547  BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
    45524548
    45534549  if (link_order->size == 0)
    4554     return true;
     4550    return TRUE;
    45554551
    45564552  input_section = link_order->u.indirect.section;
     
    45694565  /* Get the section contents.  We allocate memory for the larger of
    45704566     the size before relocating and the size after relocating.  */
    4571   contents = (bfd_byte *) bfd_malloc (raw_size >= cooked_size
    4572                                       ? (size_t) raw_size
    4573                                       : (size_t) cooked_size);
    4574   if (contents == NULL && raw_size != 0)
     4567  amt = raw_size >= cooked_size ? raw_size : cooked_size;
     4568  contents = (bfd_byte *) bfd_malloc (amt);
     4569  if (contents == NULL && amt != 0)
    45754570    goto error_return;
    45764571
     
    45994594  else
    46004595    {
    4601       external_relocs = (PTR) bfd_malloc ((size_t) external_relocs_size);
     4596      external_relocs = (PTR) bfd_malloc (external_relocs_size);
    46024597      if (external_relocs == NULL && external_relocs_size != 0)
    46034598        goto error_return;
    46044599
    46054600      if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
    4606           || (bfd_read (external_relocs, 1, external_relocs_size, input_bfd)
     4601          || (bfd_bread (external_relocs, external_relocs_size, input_bfd)
    46074602              != external_relocs_size))
    46084603        goto error_return;
     
    46194614                                  output_section,
    46204615                                  (PTR) contents,
    4621                                   input_section->output_offset,
     4616                                  (file_ptr) input_section->output_offset,
    46224617                                  cooked_size))
    46234618    goto error_return;
     
    46294624  if (info->relocateable)
    46304625    {
    4631       if (bfd_seek (output_bfd,
    4632                     (output_section->rel_filepos +
    4633                      output_section->reloc_count * external_reloc_size),
    4634                     SEEK_SET) != 0
    4635           || (bfd_write (external_relocs, 1, external_relocs_size, output_bfd)
     4626      file_ptr pos = (output_section->rel_filepos
     4627                      + output_section->reloc_count * external_reloc_size);
     4628      if (bfd_seek (output_bfd, pos, SEEK_SET) != 0
     4629          || (bfd_bwrite (external_relocs, external_relocs_size, output_bfd)
    46364630              != external_relocs_size))
    46374631        goto error_return;
     
    46434637  if (external_relocs != NULL && section_tdata == NULL)
    46444638    free (external_relocs);
    4645   return true;
     4639  return TRUE;
    46464640
    46474641 error_return:
     
    46504644  if (external_relocs != NULL && section_tdata == NULL)
    46514645    free (external_relocs);
    4652   return false;
     4646  return FALSE;
    46534647}
    46544648
     
    46584652   with -Ur.  */
    46594653
    4660 static boolean
     4654static bfd_boolean
    46614655ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
    46624656     bfd *output_bfd;
     
    46724666  bfd_size_type external_reloc_size;
    46734667  bfd_byte *rbuf;
    4674   boolean ok;
     4668  bfd_boolean ok;
     4669  file_ptr pos;
    46754670
    46764671  type = link_order->type;
     
    46864681    {
    46874682      bfd_set_error (bfd_error_bad_value);
    4688       return false;
     4683      return FALSE;
    46894684    }
    46904685
     
    47024697      h = bfd_wrapped_link_hash_lookup (output_bfd, info,
    47034698                                        link_order->u.reloc.p->u.name,
    4704                                         false, false, false);
     4699                                        FALSE, FALSE, FALSE);
    47054700      if (h != NULL
    47064701          && (h->type == bfd_link_hash_defined
     
    47324727      bfd_reloc_status_type rstat;
    47334728      bfd_byte *buf;
    4734       boolean ok;
    47354729
    47364730      size = bfd_get_reloc_size (rel.howto);
    47374731      buf = (bfd_byte *) bfd_zmalloc (size);
    47384732      if (buf == (bfd_byte *) NULL)
    4739         return false;
    4740       rstat = _bfd_relocate_contents (rel.howto, output_bfd, addend, buf);
     4733        return FALSE;
     4734      rstat = _bfd_relocate_contents (rel.howto, output_bfd,
     4735                                      (bfd_vma) addend, buf);
    47414736      switch (rstat)
    47424737        {
     
    47564751            {
    47574752              free (buf);
    4758               return false;
     4753              return FALSE;
    47594754            }
    47604755          break;
     
    47644759      free (buf);
    47654760      if (! ok)
    4766         return false;
     4761        return FALSE;
    47674762    }
    47684763
    47694764  rel.addend = 0;
    47704765
    4771   /* Move the information into a internal_reloc structure.  */
     4766  /* Move the information into an internal_reloc structure.  */
    47724767  in.r_vaddr = (rel.address
    47734768                + bfd_get_section_vma (output_bfd, output_section));
     
    47814776           bfd_wrapped_link_hash_lookup (output_bfd, info,
    47824777                                         link_order->u.reloc.p->u.name,
    4783                                          false, false, true));
     4778                                         FALSE, FALSE, TRUE));
    47844779      if (h != (struct ecoff_link_hash_entry *) NULL
    47854780          && h->indx != -1)
     
    47904785                 (info, link_order->u.reloc.p->u.name, (bfd *) NULL,
    47914786                  (asection *) NULL, (bfd_vma) 0)))
    4792             return false;
     4787            return FALSE;
    47934788          in.r_symndx = 0;
    47944789        }
     
    47974792  else
    47984793    {
    4799       CONST char *name;
     4794      const char *name;
    48004795
    48014796      name = bfd_get_section_name (output_bfd, section);
     
    48404835  /* Get some memory and swap out the reloc.  */
    48414836  external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size;
    4842   rbuf = (bfd_byte *) bfd_malloc ((size_t) external_reloc_size);
     4837  rbuf = (bfd_byte *) bfd_malloc (external_reloc_size);
    48434838  if (rbuf == (bfd_byte *) NULL)
    4844     return false;
     4839    return FALSE;
    48454840
    48464841  (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf);
    48474842
    4848   ok = (bfd_seek (output_bfd,
    4849                   (output_section->rel_filepos +
    4850                    output_section->reloc_count * external_reloc_size),
    4851                   SEEK_SET) == 0
    4852         && (bfd_write ((PTR) rbuf, 1, external_reloc_size, output_bfd)
     4843  pos = (output_section->rel_filepos
     4844         + output_section->reloc_count * external_reloc_size);
     4845  ok = (bfd_seek (output_bfd, pos, SEEK_SET) == 0
     4846        && (bfd_bwrite ((PTR) rbuf, external_reloc_size, output_bfd)
    48534847            == external_reloc_size));
    48544848
Note: See TracChangeset for help on using the changeset viewer.