2004-05-05 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / bfd / pdp11.c
index 4f7e4609a8fe1333d64b594a4616b129ef5e014e..95d2ccd30bedcb8c688a5023055087fb73bc524e 100644 (file)
@@ -1,21 +1,21 @@
 /* BFD back-end for PDP-11 a.out binaries.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
 
-This file is part of BFD, the Binary File Descriptor library.
+   This file is part of BFD, the Binary File Descriptor library.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
 
 /* BFD backend for PDP-11, running 2.11BSD in particular.
 
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
    * support for overlay object files (see 2.11 a.out(5))
    * support for old and very old archives
    (see 2.11 ar(5), historical section)
-   
+
    Search for TODO to find other areas needing more work.  */
 
 #define        BYTES_IN_WORD   2
@@ -41,7 +41,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
 #define        DEFAULT_ARCH    bfd_arch_pdp11
 #define        DEFAULT_MID     M_PDP11
 
-#define MY(OP) CAT(pdp11_aout_,OP)
+/* Do not "beautify" the CONCAT* macro args.  Traditional C will not
+   remove whitespace added here, and thus will fail to concatenate
+   the tokens.  */
+#define MY(OP) CONCAT2 (pdp11_aout_,OP)
+
 /* This needs to start with a.out so GDB knows it is an a.out variant.  */
 #define TARGETNAME "a.out-pdp11"
 
@@ -127,12 +131,12 @@ struct pdp11_external_nlist
 #define MY_entry_is_text_address 1
 
 #define MY_write_object_contents MY(write_object_contents)
-static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
+static bfd_boolean MY(write_object_contents) PARAMS ((bfd *abfd));
 #define MY_text_includes_header 1
 
-bfd_vma                bfd_getp32         PARAMS ((const bfd_byte *));
-bfd_signed_vma bfd_getp_signed_32 PARAMS ((const bfd_byte *));
-void           bfd_putp32         PARAMS ((bfd_vma, bfd_byte *));
+static bfd_vma bfd_getp32 (const void *);
+static bfd_signed_vma bfd_getp_signed_32 (const void *);
+static void bfd_putp32 (bfd_vma, void *);
 
 #define MY_BFD_TARGET
 
@@ -176,7 +180,7 @@ const bfd_target MY(vec) =
 
   /* Alternative_target */
   NULL,
-  
+
   (PTR) MY_backend_data,
 };
 
@@ -304,9 +308,9 @@ DESCRIPTION
 #define KEEPIT udata.i
 
 #include <string.h>            /* For strchr and friends */
-#include <ctype.h>
 #include "bfd.h"
 #include "sysdep.h"
+#include "safe-ctype.h"
 #include "bfdlink.h"
 
 #include "libaout.h"
@@ -354,15 +358,21 @@ struct pdp11_aout_reloc_external
 
 #define RINDEX(x)      (((x) & 0xfff0) >> 4)
 
-static boolean aout_get_external_symbols PARAMS ((bfd *));
-static boolean translate_from_native_sym_flags
+static bfd_boolean aout_get_external_symbols PARAMS ((bfd *));
+static bfd_boolean translate_from_native_sym_flags
   PARAMS ((bfd *, aout_symbol_type *));
-static boolean translate_to_native_sym_flags
+static bfd_boolean translate_to_native_sym_flags
   PARAMS ((bfd *, asymbol *, struct external_nlist *));
 static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *));
 static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *));
 static void adjust_n_magic PARAMS ((bfd *, struct internal_exec *));
 
+static int pdp11_aout_write_headers PARAMS ((bfd *, struct internal_exec *));
+void pdp11_aout_swap_reloc_out PARAMS  ((bfd *, arelent *, struct pdp11_aout_reloc_external *));
+void pdp11_aout_swap_reloc_in
+PARAMS ((bfd *, struct pdp11_aout_reloc_external *, arelent *,
+        bfd_size_type, asymbol **, bfd_size_type));
+
 /*
 SUBSECTION
        Relocations
@@ -389,8 +399,8 @@ DESCRIPTION
 reloc_howto_type howto_table_pdp11[] =
 {
   /* type              rs size bsz  pcrel bitpos ovrf                     sf name     part_inpl readmask  setmask    pcdone */
-HOWTO( 0,             0,  1,  16,  false, 0, complain_overflow_signed,0,"16",  true, 0x0000ffff,0x0000ffff, false),
-HOWTO( 1,             0,  1,  16,  true,  0, complain_overflow_signed,0,"DISP16",      true, 0x0000ffff,0x0000ffff, false),
+HOWTO( 0,             0,  1,  16,  FALSE, 0, complain_overflow_signed,0,"16",  TRUE, 0x0000ffff,0x0000ffff, FALSE),
+HOWTO( 1,             0,  1,  16,  TRUE,  0, complain_overflow_signed,0,"DISP16",      TRUE, 0x0000ffff,0x0000ffff, FALSE),
 };
 
 #define TABLE_SIZE(TABLE)      (sizeof(TABLE)/sizeof(TABLE[0]))
@@ -441,45 +451,46 @@ pdp11_aout_write_headers (abfd, execp)
   NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes);
 
   if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
-    return false;
+    return FALSE;
 
-  if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
+  if (bfd_bwrite ((PTR) &exec_bytes, (bfd_size_type) EXEC_BYTES_SIZE, abfd)
       != EXEC_BYTES_SIZE)
-    return false;
+    return FALSE;
 
   /* Now write out reloc info, followed by syms and strings */
 
   if (bfd_get_outsymbols (abfd) != (asymbol **) NULL
       && bfd_get_symcount (abfd) != 0)
     {
-      if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0)
-       return false;
+      if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0)
+       return FALSE;
 
-      if (! NAME(aout,write_syms)(abfd)) return false;
+      if (! NAME(aout,write_syms) (abfd))
+       return FALSE;
     }
 
   if (obj_textsec (abfd)->reloc_count > 0 ||
       obj_datasec (abfd)->reloc_count > 0)
     {
-      if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0)
-       return false;
+      if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0)
+       return FALSE;
       if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd)))
-       return false;
+       return FALSE;
 
-      if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0)
-       return false;
-      if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd)))
-       return false;
+      if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0)
+       return FALSE;
+      if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd)))
+       return FALSE;
     }
 
-  return true;
-}                                                                            
+  return TRUE;
+}
 
 /* Write an object file.
    Section contents have already been written.  We write the
    file header, symbols, and relocation.  */
 
-static boolean
+static bfd_boolean
 MY(write_object_contents) (abfd)
      bfd *abfd;
 {
@@ -611,20 +622,20 @@ NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes)
 
 /* Make all the section for an a.out file.  */
 
-boolean
+bfd_boolean
 NAME(aout,make_sections) (abfd)
      bfd *abfd;
 {
   if (obj_textsec (abfd) == (asection *) NULL
       && bfd_make_section (abfd, ".text") == (asection *) NULL)
-    return false;
+    return FALSE;
   if (obj_datasec (abfd) == (asection *) NULL
       && bfd_make_section (abfd, ".data") == (asection *) NULL)
-    return false;
+    return FALSE;
   if (obj_bsssec (abfd) == (asection *) NULL
       && bfd_make_section (abfd, ".bss") == (asection *) NULL)
-    return false;
-  return true;
+    return FALSE;
+  return TRUE;
 }
 
 /*
@@ -652,8 +663,9 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p)
 {
   struct aout_data_struct *rawptr, *oldrawptr;
   const bfd_target *result;
+  bfd_size_type amt = sizeof (struct aout_data_struct);
 
-  rawptr = (struct aout_data_struct  *) bfd_zalloc (abfd, sizeof (struct aout_data_struct ));
+  rawptr = (struct aout_data_struct  *) bfd_zalloc (abfd, amt);
   if (rawptr == NULL)
     return 0;
 
@@ -857,25 +869,26 @@ FUNCTION
        aout_@var{size}_mkobject
 
 SYNOPSIS
-       boolean aout_@var{size}_mkobject, (bfd *abfd);
+       bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
 
 DESCRIPTION
        Initialize BFD @var{abfd} for use with a.out files.
 */
 
-boolean
+bfd_boolean
 NAME(aout,mkobject) (abfd)
      bfd *abfd;
 {
   struct aout_data_struct  *rawptr;
+  bfd_size_type amt = sizeof (struct aout_data_struct);
 
   bfd_set_error (bfd_error_system_call);
 
   /* Use an intermediate variable for clarity */
-  rawptr = (struct aout_data_struct *)bfd_zalloc (abfd, sizeof (struct aout_data_struct ));
+  rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt);
 
   if (rawptr == NULL)
-    return false;
+    return FALSE;
 
   abfd->tdata.aout_data = rawptr;
   exec_hdr (abfd) = &(rawptr->e);
@@ -884,7 +897,7 @@ NAME(aout,mkobject) (abfd)
   obj_datasec (abfd) = (asection *)NULL;
   obj_bsssec (abfd) = (asection *)NULL;
 
-  return true;
+  return TRUE;
 }
 
 
@@ -911,12 +924,12 @@ enum machine_type
 NAME(aout,machine_type) (arch, machine, unknown)
      enum bfd_architecture arch;
      unsigned long machine;
-     boolean *unknown;
+     bfd_boolean *unknown;
 {
   enum machine_type arch_flags;
 
   arch_flags = M_UNKNOWN;
-  *unknown = true;
+  *unknown = TRUE;
 
   switch (arch)
     {
@@ -934,7 +947,7 @@ NAME(aout,machine_type) (arch, machine, unknown)
       switch (machine)
        {
        case 0:               arch_flags = M_68010; break;
-       case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = false; break;
+       case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = FALSE; break;
        case bfd_mach_m68010: arch_flags = M_68010; break;
        case bfd_mach_m68020: arch_flags = M_68020; break;
        default:              arch_flags = M_UNKNOWN; break;
@@ -942,7 +955,10 @@ NAME(aout,machine_type) (arch, machine, unknown)
       break;
 
     case bfd_arch_i386:
-      if (machine == 0)        arch_flags = M_386;
+      if (machine == 0
+         || machine == bfd_mach_i386_i386
+         || machine == bfd_mach_i386_i386_intel_syntax)
+       arch_flags = M_386;
       break;
 
     case bfd_arch_a29k:
@@ -985,19 +1001,19 @@ NAME(aout,machine_type) (arch, machine, unknown)
 
     case bfd_arch_pdp11:
       /* TODO: arch_flags = M_PDP11; */
-      *unknown = false;
+      *unknown = FALSE;
       break;
 
     case bfd_arch_vax:
-      *unknown = false;
+      *unknown = FALSE;
       break;
+
     default:
       arch_flags = M_UNKNOWN;
     }
 
   if (arch_flags != M_UNKNOWN)
-    *unknown = false;
+    *unknown = FALSE;
 
   return arch_flags;
 }
@@ -1008,7 +1024,7 @@ FUNCTION
        aout_@var{size}_set_arch_mach
 
 SYNOPSIS
-       boolean aout_@var{size}_set_arch_mach,
+       bfd_boolean aout_@var{size}_set_arch_mach,
         (bfd *,
          enum bfd_architecture arch,
          unsigned long machine));
@@ -1019,22 +1035,22 @@ DESCRIPTION
        can support the architecture required.
 */
 
-boolean
+bfd_boolean
 NAME(aout,set_arch_mach) (abfd, arch, machine)
      bfd *abfd;
      enum bfd_architecture arch;
      unsigned long machine;
 {
   if (! bfd_default_set_arch_mach (abfd, arch, machine))
-    return false;
+    return FALSE;
 
   if (arch != bfd_arch_unknown)
     {
-      boolean unknown;
+      bfd_boolean unknown;
 
       NAME(aout,machine_type) (arch, machine, &unknown);
       if (unknown)
-       return false;
+       return FALSE;
     }
 
   obj_reloc_entry_size (abfd) = RELOC_SIZE;
@@ -1091,7 +1107,7 @@ adjust_o_magic (abfd, execp)
     }
   else
     {
-      /* The VMA of the .bss section is set by the the VMA of the
+      /* The VMA of the .bss section is set by the VMA of the
          .data section plus the size of the .data section.  We may
          need to add padding bytes to make this true.  */
       pad = obj_bsssec (abfd)->vma - vma;
@@ -1117,9 +1133,9 @@ adjust_z_magic (abfd, execp)
 {
   bfd_size_type data_pad, text_pad;
   file_ptr text_end;
-  CONST struct aout_backend_data *abdp;
+  const struct aout_backend_data *abdp;
   int ztih;                    /* Nonzero if text includes exec header.  */
-  
+
   abdp = aout_backend_info (abfd);
 
   /* Text.  */
@@ -1188,7 +1204,7 @@ adjust_z_magic (abfd, execp)
     }
   obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos
                                + obj_textsec (abfd)->_raw_size);
-  
+
   /* Fix up exec header while we're at it.  */
   execp->a_text = obj_textsec(abfd)->_raw_size;
   if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted)))
@@ -1233,7 +1249,7 @@ adjust_n_magic (abfd, execp)
   file_ptr pos = adata(abfd).exec_bytes_size;
   bfd_vma vma = 0;
   int pad;
-  
+
   /* Text.  */
   obj_textsec(abfd)->filepos = pos;
   if (!obj_textsec(abfd)->user_set_vma)
@@ -1248,7 +1264,7 @@ adjust_n_magic (abfd, execp)
   if (!obj_datasec(abfd)->user_set_vma)
     obj_datasec(abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size);
   vma = obj_datasec(abfd)->vma;
-  
+
   /* Since BSS follows data immediately, see if it needs alignment.  */
   vma += obj_datasec(abfd)->_raw_size;
   pad = align_power (vma, obj_bsssec(abfd)->alignment_power) - vma;
@@ -1268,7 +1284,7 @@ adjust_n_magic (abfd, execp)
   N_SET_MAGIC (*execp, NMAGIC);
 }
 
-boolean
+bfd_boolean
 NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
      bfd *abfd;
      bfd_size_type *text_size;
@@ -1277,10 +1293,10 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
   struct internal_exec *execp = exec_hdr (abfd);
 
   if (! NAME(aout,make_sections) (abfd))
-    return false;
+    return FALSE;
 
   if (adata(abfd).magic != undecided_magic)
-    return true;
+    return TRUE;
 
   obj_textsec(abfd)->_raw_size =
     align_power(obj_textsec(abfd)->_raw_size,
@@ -1353,7 +1369,7 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
           obj_bsssec(abfd)->vma, obj_bsssec(abfd)->_raw_size);
 #endif
 
-  return true;
+  return TRUE;
 }
 
 /*
@@ -1361,7 +1377,7 @@ FUNCTION
        aout_@var{size}_new_section_hook
 
 SYNOPSIS
-        boolean aout_@var{size}_new_section_hook,
+        bfd_boolean aout_@var{size}_new_section_hook,
           (bfd *abfd,
            asection *newsect));
 
@@ -1369,7 +1385,7 @@ DESCRIPTION
        Called by the BFD in response to a @code{bfd_make_section}
        request.
 */
-boolean
+bfd_boolean
 NAME(aout,new_section_hook) (abfd, newsect)
      bfd *abfd;
      asection *newsect;
@@ -1385,7 +1401,7 @@ NAME(aout,new_section_hook) (abfd, newsect)
        {
          obj_textsec(abfd)= newsect;
          newsect->target_index = N_TEXT;
-         return true;
+         return TRUE;
        }
 
     if (obj_datasec (abfd) == NULL
@@ -1393,7 +1409,7 @@ NAME(aout,new_section_hook) (abfd, newsect)
       {
        obj_datasec (abfd) = newsect;
        newsect->target_index = N_DATA;
-       return true;
+       return TRUE;
       }
 
     if (obj_bsssec (abfd) == NULL
@@ -1401,19 +1417,19 @@ NAME(aout,new_section_hook) (abfd, newsect)
       {
        obj_bsssec (abfd) = newsect;
        newsect->target_index = N_BSS;
-       return true;
+       return TRUE;
       }
   }
 
   /* We allow more than three sections internally */
-  return true;
+  return TRUE;
 }
 
-boolean
+bfd_boolean
 NAME(aout,set_section_contents) (abfd, section, location, offset, count)
      bfd *abfd;
      sec_ptr section;
-     PTR location;
+     const PTR location;
      file_ptr offset;
      bfd_size_type count;
 {
@@ -1423,13 +1439,13 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
   if (! abfd->output_has_begun)
     {
       if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end))
-       return false;
+       return FALSE;
     }
 
   if (section == obj_bsssec (abfd))
     {
       bfd_set_error (bfd_error_no_contents);
-      return false;
+      return FALSE;
     }
 
   if (section != obj_textsec (abfd)
@@ -1439,22 +1455,22 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
        ("%s: can not represent section `%s' in a.out object file format",
         bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
       bfd_set_error (bfd_error_nonrepresentable_section);
-      return false;
+      return FALSE;
     }
 
   if (count != 0)
     {
       if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
-         || bfd_write (location, 1, count, abfd) != count)
-       return false;
+         || bfd_bwrite (location, count, abfd) != count)
+       return FALSE;
     }
 
-  return true;
+  return TRUE;
 }
 \f
 /* Read the external symbols from an a.out file.  */
 
-static boolean
+static bfd_boolean
 aout_get_external_symbols (abfd)
      bfd *abfd;
 {
@@ -1466,33 +1482,32 @@ aout_get_external_symbols (abfd)
       count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE;
 
 #ifdef USE_MMAP
-      if (bfd_get_file_window (abfd,
-                              obj_sym_filepos (abfd), exec_hdr (abfd)->a_syms,
-                              &obj_aout_sym_window (abfd), true) == false)
-       return false;
+      if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd),
+                                exec_hdr (abfd)->a_syms,
+                                &obj_aout_sym_window (abfd), TRUE))
+       return FALSE;
       syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
 #else
       /* We allocate using malloc to make the values easy to free
         later on.  If we put them on the objalloc it might not be
         possible to free them.  */
-      syms = ((struct external_nlist *)
-             bfd_malloc ((size_t) count * EXTERNAL_NLIST_SIZE));
+      syms = (struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE);
       if (syms == (struct external_nlist *) NULL && count != 0)
-       return false;
+       return FALSE;
 
       if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0
-         || (bfd_read (syms, 1, exec_hdr (abfd)->a_syms, abfd)
+         || (bfd_bread (syms, exec_hdr (abfd)->a_syms, abfd)
              != exec_hdr (abfd)->a_syms))
        {
          free (syms);
-         return false;
+         return FALSE;
        }
 #endif
 
       obj_aout_external_syms (abfd) = syms;
       obj_aout_external_sym_count (abfd) = count;
     }
-      
+
   if (obj_aout_external_strings (abfd) == NULL
       && exec_hdr (abfd)->a_syms != 0)
     {
@@ -1502,27 +1517,27 @@ aout_get_external_symbols (abfd)
 
       /* Get the size of the strings.  */
       if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0
-         || (bfd_read ((PTR) string_chars, BYTES_IN_LONG, 1, abfd) !=
-             BYTES_IN_LONG))
-       return false;
-      stringsize = bfd_h_get_32 (abfd, string_chars);
+         || (bfd_bread ((PTR) string_chars, (bfd_size_type) BYTES_IN_LONG,
+                       abfd) != BYTES_IN_LONG))
+       return FALSE;
+      stringsize = H_GET_32 (abfd, string_chars);
 
 #ifdef USE_MMAP
-      if (bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
-                              &obj_aout_string_window (abfd), true) == false)
-       return false;
+      if (bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,
+                                &obj_aout_string_window (abfd), TRUE))
+       return FALSE;
       strings = (char *) obj_aout_string_window (abfd).data;
 #else
-      strings = (char *) bfd_malloc ((size_t) stringsize + 1);
+      strings = (char *) bfd_malloc (stringsize + 1);
       if (strings == NULL)
-       return false;
+       return FALSE;
 
       /* Skip space for the string count in the buffer for convenience
         when using indexes.  */
-      if (bfd_read (strings + 4, 1, stringsize - 4, abfd) != stringsize - 4)
+      if (bfd_bread (strings + 4, stringsize - 4, abfd) != stringsize - 4)
        {
          free (strings);
-         return false;
+         return FALSE;
        }
 #endif
 
@@ -1535,7 +1550,7 @@ aout_get_external_symbols (abfd)
       obj_aout_external_string_size (abfd) = stringsize;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Translate an a.out symbol into a BFD symbol.  The desc, other, type
@@ -1543,7 +1558,7 @@ aout_get_external_symbols (abfd)
    nlist structure.  This function is responsible for setting
    symbol->flags and symbol->section, and adjusting symbol->value.  */
 
-static boolean
+static bfd_boolean
 translate_from_native_sym_flags (abfd, cache_ptr)
      bfd *abfd;
      aout_symbol_type *cache_ptr;
@@ -1580,7 +1595,7 @@ translate_from_native_sym_flags (abfd, cache_ptr)
       cache_ptr->symbol.section = sec;
       cache_ptr->symbol.value -= sec->vma;
 
-      return true;
+      return TRUE;
     }
 
   /* Get the default visibility.  This does not apply to all types, so
@@ -1631,12 +1646,12 @@ translate_from_native_sym_flags (abfd, cache_ptr)
       break;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Set the fields of SYM_POINTER according to CACHE_PTR.  */
 
-static boolean
+static bfd_boolean
 translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
      bfd *abfd;
      asymbol *cache_ptr;
@@ -1659,10 +1674,10 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
         file.  */
       (*_bfd_error_handler)
        ("%s: can not represent section for symbol `%s' in a.out object file format",
-        bfd_get_filename (abfd), 
+        bfd_archive_filename (abfd),
         cache_ptr->name != NULL ? cache_ptr->name : "*unknown*");
       bfd_set_error (bfd_error_nonrepresentable_section);
-      return false;
+      return FALSE;
     }
 
   if (sec->output_section != NULL)
@@ -1687,9 +1702,9 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
     {
       (*_bfd_error_handler)
        ("%s: can not represent section `%s' in a.out object file format",
-        bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
+        bfd_archive_filename (abfd), bfd_get_section_name (abfd, sec));
       bfd_set_error (bfd_error_nonrepresentable_section);
-      return false;
+      return FALSE;
     }
 
   /* Turn the symbol from section relative to absolute again */
@@ -1737,7 +1752,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
 
   PUT_WORD(abfd, value, sym_pointer->e_value);
 
-  return true;
+  return TRUE;
 }
 \f
 /* Native-level interface to symbols. */
@@ -1746,8 +1761,8 @@ asymbol *
 NAME(aout,make_empty_symbol) (abfd)
      bfd *abfd;
 {
-  aout_symbol_type  *new =
-    (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type));
+  bfd_size_type amt = sizeof (aout_symbol_type);
+  aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt);
   if (!new)
     return NULL;
   new->symbol.the_bfd = abfd;
@@ -1757,7 +1772,7 @@ NAME(aout,make_empty_symbol) (abfd)
 
 /* Translate a set of internal symbols into external symbols.  */
 
-boolean
+bfd_boolean
 NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
      bfd *abfd;
      aout_symbol_type *in;
@@ -1765,7 +1780,7 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
      bfd_size_type count;
      char *str;
      bfd_size_type strsize;
-     boolean dynamic;
+     bfd_boolean dynamic;
 {
   struct external_nlist *ext_end;
 
@@ -1787,53 +1802,51 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic)
       else if (x < strsize)
        in->symbol.name = str + x;
       else
-       return false;
+       return FALSE;
 
       in->symbol.value = GET_SWORD (abfd,  ext->e_value);
       /* TODO: is 0 a safe value here? */
       in->desc = 0;
       in->other = 0;
-      in->type = bfd_h_get_8 (abfd,  ext->e_type);
+      in->type = H_GET_8 (abfd,  ext->e_type);
       in->symbol.udata.p = NULL;
 
       if (! translate_from_native_sym_flags (abfd, in))
-       return false;
+       return FALSE;
 
       if (dynamic)
        in->symbol.flags |= BSF_DYNAMIC;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* We read the symbols into a buffer, which is discarded when this
    function exits.  We read the strings into a buffer large enough to
    hold them all plus all the cached symbol entries. */
 
-boolean
+bfd_boolean
 NAME(aout,slurp_symbol_table) (abfd)
      bfd *abfd;
 {
   struct external_nlist *old_external_syms;
   aout_symbol_type *cached;
-  size_t cached_size;
+  bfd_size_type cached_size;
 
   /* If there's no work to be done, don't do any */
   if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL)
-    return true;
+    return TRUE;
 
   old_external_syms = obj_aout_external_syms (abfd);
 
   if (! aout_get_external_symbols (abfd))
-    return false;
+    return FALSE;
 
-  cached_size = (obj_aout_external_sym_count (abfd)
-                * sizeof (aout_symbol_type));
-  cached = (aout_symbol_type *) bfd_malloc (cached_size);
+  cached_size = obj_aout_external_sym_count (abfd);
+  cached_size *= sizeof (aout_symbol_type);
+  cached = (aout_symbol_type *) bfd_zmalloc (cached_size);
   if (cached == NULL && cached_size != 0)
-    return false;
-  if (cached_size != 0)
-    memset (cached, 0, cached_size);
+    return FALSE;
 
   /* Convert from external symbol information to internal.  */
   if (! (NAME(aout,translate_symbol_table)
@@ -1842,10 +1855,10 @@ NAME(aout,slurp_symbol_table) (abfd)
          obj_aout_external_sym_count (abfd),
          obj_aout_external_strings (abfd),
          obj_aout_external_string_size (abfd),
-         false)))
+         FALSE)))
     {
       free (cached);
-      return false;
+      return FALSE;
     }
 
   bfd_get_symcount (abfd) = obj_aout_external_sym_count (abfd);
@@ -1867,7 +1880,7 @@ NAME(aout,slurp_symbol_table) (abfd)
       obj_aout_external_syms (abfd) = NULL;
     }
 
-  return true;
+  return TRUE;
 }
 \f
 /* We use a hash table when writing out symbols so that we only write
@@ -1880,8 +1893,8 @@ NAME(aout,slurp_symbol_table) (abfd)
    if BFD_TRADITIONAL_FORMAT is set.  */
 
 static bfd_size_type add_to_stringtab
-  PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, boolean));
-static boolean emit_stringtab PARAMS ((bfd *, struct bfd_strtab_hash *));
+  PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, bfd_boolean));
+static bfd_boolean emit_stringtab PARAMS ((bfd *, struct bfd_strtab_hash *));
 
 /* Get the index of a string in a strtab, adding it if it is not
    already present.  */
@@ -1891,9 +1904,9 @@ add_to_stringtab (abfd, tab, str, copy)
      bfd *abfd;
      struct bfd_strtab_hash *tab;
      const char *str;
-     boolean copy;
+     bfd_boolean copy;
 {
-  boolean hash;
+  bfd_boolean hash;
   bfd_size_type index;
 
   /* An index of 0 always means the empty string.  */
@@ -1902,9 +1915,9 @@ add_to_stringtab (abfd, tab, str, copy)
 
   /* Don't hash if BFD_TRADITIONAL_FORMAT is set, because SunOS dbx
      doesn't understand a hashed string table.  */
-  hash = true;
+  hash = TRUE;
   if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0)
-    hash = false;
+    hash = FALSE;
 
   index = _bfd_stringtab_add (tab, str, hash, copy);
 
@@ -1921,7 +1934,7 @@ add_to_stringtab (abfd, tab, str, copy)
 /* Write out a strtab.  ABFD is already at the right location in the
    file.  */
 
-static boolean
+static bfd_boolean
 emit_stringtab (abfd, tab)
      register bfd *abfd;
      struct bfd_strtab_hash *tab;
@@ -1929,14 +1942,15 @@ emit_stringtab (abfd, tab)
   bfd_byte buffer[BYTES_IN_LONG];
 
   /* The string table starts with the size.  */
-  bfd_h_put_32 (abfd, _bfd_stringtab_size (tab) + BYTES_IN_LONG, buffer);
-  if (bfd_write ((PTR) buffer, 1, BYTES_IN_LONG, abfd) != BYTES_IN_LONG)
-    return false;
+  H_PUT_32 (abfd, _bfd_stringtab_size (tab) + BYTES_IN_LONG, buffer);
+  if (bfd_bwrite ((PTR) buffer, (bfd_size_type) BYTES_IN_LONG, abfd)
+      != BYTES_IN_LONG)
+    return FALSE;
 
   return _bfd_stringtab_emit (abfd, tab);
 }
 \f
-boolean
+bfd_boolean
 NAME(aout,write_syms) (abfd)
      bfd *abfd;
 {
@@ -1946,7 +1960,7 @@ NAME(aout,write_syms) (abfd)
 
   strtab = _bfd_stringtab_init ();
   if (strtab == NULL)
-    return false;
+    return FALSE;
 
   for (count = 0; count < bfd_get_symcount (abfd); count++)
     {
@@ -1954,24 +1968,24 @@ NAME(aout,write_syms) (abfd)
       bfd_size_type indx;
       struct external_nlist nsp;
 
-      PUT_WORD (abfd, 0, (bfd_byte *)nsp.e_unused);
+      PUT_WORD (abfd, 0, nsp.e_unused);
 
-      indx = add_to_stringtab (abfd, strtab, g->name, false);
+      indx = add_to_stringtab (abfd, strtab, g->name, FALSE);
       if (indx == (bfd_size_type) -1)
        goto error_return;
-      PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx);
+      PUT_WORD (abfd, indx, nsp.e_strx);
 
       if (bfd_asymbol_flavour(g) == abfd->xvec->flavour)
-       bfd_h_put_8 (abfd, aout_symbol(g)->type,  nsp.e_type);
+       H_PUT_8 (abfd, aout_symbol(g)->type,  nsp.e_type);
       else
-       bfd_h_put_8 (abfd, 0, nsp.e_type);
+       H_PUT_8 (abfd, 0, nsp.e_type);
 
       if (! translate_to_native_sym_flags (abfd, g, &nsp))
        goto error_return;
 
-      bfd_h_put_8 (abfd, 0, nsp.e_ovly);
+      H_PUT_8 (abfd, 0, nsp.e_ovly);
 
-      if (bfd_write((PTR)&nsp,1,EXTERNAL_NLIST_SIZE, abfd)
+      if (bfd_bwrite ((PTR)&nsp, (bfd_size_type) EXTERNAL_NLIST_SIZE, abfd)
          != EXTERNAL_NLIST_SIZE)
        goto error_return;
 
@@ -1985,16 +1999,16 @@ NAME(aout,write_syms) (abfd)
 
   _bfd_stringtab_free (strtab);
 
-  return true;
+  return TRUE;
 
 error_return:
   _bfd_stringtab_free (strtab);
-  return false;
+  return FALSE;
 }
 
 \f
 long
-NAME(aout,get_symtab) (abfd, location)
+NAME(aout,canonicalize_symtab) (abfd, location)
      bfd *abfd;
      asymbol **location;
 {
@@ -2129,7 +2143,7 @@ pdp11_aout_swap_reloc_out (abfd, g, natptr)
          cache_ptr->addend = ad;                                       \
          break;                                                        \
        }                                                               \
-    }                                                                  
+    }
 
 void
 pdp11_aout_swap_reloc_in (abfd, bytes, cache_ptr, offset,
@@ -2176,14 +2190,14 @@ pdp11_aout_swap_reloc_in (abfd, bytes, cache_ptr, offset,
 
 /* Read and swap the relocs for a section.  */
 
-boolean
+bfd_boolean
 NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
      bfd *abfd;
      sec_ptr asect;
      asymbol **symbols;
 {
   struct pdp11_aout_reloc_external *rptr;
-  unsigned int count;
+  bfd_size_type count;
   bfd_size_type reloc_size;
   PTR relocs;
   arelent *reloc_cache;
@@ -2192,10 +2206,10 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
   arelent *cache_ptr;
 
   if (asect->relocation)
-    return true;
+    return TRUE;
 
   if (asect->flags & SEC_CONSTRUCTOR)
-    return true;
+    return TRUE;
 
   if (asect == obj_datasec (abfd))
     reloc_size = exec_hdr(abfd)->a_drsize;
@@ -2206,22 +2220,22 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
   else
     {
       bfd_set_error (bfd_error_invalid_operation);
-      return false;
+      return FALSE;
     }
 
   if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
-    return false;
+    return FALSE;
 
   each_size = obj_reloc_entry_size (abfd);
 
-  relocs = bfd_malloc ((size_t) reloc_size);
+  relocs = bfd_malloc (reloc_size);
   if (relocs == NULL && reloc_size != 0)
-    return false;
+    return FALSE;
 
-  if (bfd_read (relocs, 1, reloc_size, abfd) != reloc_size)
+  if (bfd_bread (relocs, reloc_size, abfd) != reloc_size)
     {
       free (relocs);
-      return false;
+      return FALSE;
     }
 
   count = reloc_size / each_size;
@@ -2234,7 +2248,7 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
       {
        int x;
 
-       x = GET_WORD (abfd, relocs + each_size * counter);
+       x = GET_WORD (abfd, (char *) relocs + each_size * counter);
        if (x != 0)
          real_count++;
       }
@@ -2242,10 +2256,9 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
     count = real_count;
   }
 
-  reloc_cache = (arelent *) bfd_malloc ((size_t) (count * sizeof (arelent)));
+  reloc_cache = (arelent *) bfd_zmalloc (count * sizeof (arelent));
   if (reloc_cache == NULL && count != 0)
-    return false;
-  memset (reloc_cache, 0, count * sizeof (arelent));
+    return FALSE;
 
   cache_ptr = reloc_cache;
 
@@ -2258,14 +2271,15 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
        {
          rptr =
            (struct pdp11_aout_reloc_external *)
-           ((char *)rptr + RELOC_SIZE);
-         if ((char *)rptr >= (char *)relocs + reloc_size)
+           ((char *) rptr + RELOC_SIZE);
+         if ((char *) rptr >= (char *) relocs + reloc_size)
            goto done;
        }
 
       pdp11_aout_swap_reloc_in (abfd, rptr, cache_ptr,
-                               (char *)rptr - (char *)relocs,
-                                   symbols, bfd_get_symcount (abfd));
+                               (bfd_size_type) ((char *) rptr - (char *) relocs),
+                               symbols,
+                               (bfd_size_type) bfd_get_symcount (abfd));
     }
  done:
   /* Just in case, if rptr >= relocs + reloc_size should happen
@@ -2277,12 +2291,12 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols)
   asect->relocation = reloc_cache;
   asect->reloc_count = cache_ptr - reloc_cache;
 
-  return true;
+  return TRUE;
 }
 
 /* Write out a relocation section into an object file.  */
 
-boolean
+bfd_boolean
 NAME(aout,squirt_out_relocs) (abfd, section)
      bfd *abfd;
      asection *section;
@@ -2290,22 +2304,20 @@ NAME(aout,squirt_out_relocs) (abfd, section)
   arelent **generic;
   unsigned char *native;
   unsigned int count = section->reloc_count;
-  size_t natsize;
+  bfd_size_type natsize;
 
 #if 0
   /* If we're writing an .o file, we must write
      relocation information, even if there is none. */
   if ((count == 0 || section->orelocation == NULL) &&
       <writing_executable>)
-    return true;
+    return TRUE;
 #endif
 
   natsize = bfd_get_section_size_before_reloc (section);
   native = (unsigned char *) bfd_zalloc (abfd, natsize);
   if (!native)
-    return false;
-
-  memset ((PTR)native, 0, natsize);
+    return FALSE;
 
   generic = section->orelocation;
   if (generic != NULL)
@@ -2322,15 +2334,14 @@ NAME(aout,squirt_out_relocs) (abfd, section)
        }
     }
 
-  if (bfd_write ((PTR) native, 1, natsize, abfd) != natsize)
+  if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
     {
-      bfd_release(abfd, native);
-      return false;
+      bfd_release (abfd, native);
+      return FALSE;
     }
 
   bfd_release (abfd, native);
-
-  return true;
+  return TRUE;
 }
 
 /* This is stupid.  This function should be a boolean predicate */
@@ -2387,7 +2398,7 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect)
       return -1;
     }
 
-  if (asect->flags & SEC_CONSTRUCTOR) 
+  if (asect->flags & SEC_CONSTRUCTOR)
     return (sizeof (arelent *) * (asect->reloc_count+1));
 
   if (asect == obj_datasec (abfd))
@@ -2458,10 +2469,9 @@ NAME(aout,get_symbol_info) (abfd, symbol, ret)
     }
 }
 
-/*ARGSUSED*/
 void
 NAME(aout,print_symbol) (abfd, afile, symbol, how)
-     bfd * abfd ATTRIBUTE_UNUSED;
+     bfd * abfd;
      PTR afile;
      asymbol *symbol;
      bfd_print_symbol_type how;
@@ -2481,9 +2491,9 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how)
       break;
     case bfd_print_symbol_all:
       {
-       CONST char *section_name = symbol->section->name;
+       const char *section_name = symbol->section->name;
 
-       bfd_print_symbol_vandf ((PTR)file,symbol);
+       bfd_print_symbol_vandf (abfd, (PTR)file, symbol);
 
        fprintf (file," %-5s %04x %02x %02x",
                 section_name,
@@ -2509,7 +2519,7 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how)
 long
 NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
      bfd *abfd;
-     boolean dynamic;
+     bfd_boolean dynamic;
      PTR *minisymsp;
      unsigned int *sizep;
 {
@@ -2545,7 +2555,7 @@ NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep)
 asymbol *
 NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym)
      bfd *abfd;
-     boolean dynamic;
+     bfd_boolean dynamic;
      const PTR minisym;
      asymbol *sym;
 {
@@ -2563,7 +2573,7 @@ NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym)
          (bfd_size_type) 1,
          obj_aout_external_strings (abfd),
          obj_aout_external_string_size (abfd),
-         false)))
+         FALSE)))
     return NULL;
 
   return sym;
@@ -2575,23 +2585,23 @@ NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym)
  wanted location.
 */
 
-boolean
+bfd_boolean
 NAME(aout,find_nearest_line)
      (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr)
      bfd *abfd;
      asection *section;
      asymbol **symbols;
      bfd_vma offset;
-     CONST char **filename_ptr;
-     CONST char **functionname_ptr;
+     const char **filename_ptr;
+     const char **functionname_ptr;
      unsigned int *line_ptr;
 {
   /* Run down the file looking for the filename, function and linenumber */
   asymbol **p;
-  CONST char *directory_name = NULL;
-  CONST char *main_file_name = NULL;
-  CONST char *current_file_name = NULL;
-  CONST char *line_file_name = NULL; /* Value of current_file_name at line number. */
+  const char *directory_name = NULL;
+  const char *main_file_name = NULL;
+  const char *current_file_name = NULL;
+  const char *line_file_name = NULL; /* Value of current_file_name at line number. */
   bfd_vma low_line_vma = 0;
   bfd_vma low_func_vma = 0;
   asymbol *func = 0;
@@ -2724,10 +2734,10 @@ NAME(aout,find_nearest_line)
     adata (abfd).line_buf = buf = NULL;
   else
     {
-      buf = (char *) bfd_malloc (filelen + funclen + 3);
+      buf = (char *) bfd_malloc ((bfd_size_type) filelen + funclen + 3);
       adata (abfd).line_buf = buf;
       if (buf == NULL)
-       return false;
+       return FALSE;
     }
 
   if (main_file_name != NULL)
@@ -2745,7 +2755,7 @@ NAME(aout,find_nearest_line)
   if (func)
     {
       const char *function = func->name;
-      char *p;
+      char *colon;
 
       /* The caller expects a symbol name.  We actually have a
         function name, without the leading underscore.  Put the
@@ -2759,19 +2769,19 @@ NAME(aout,find_nearest_line)
        }
 
       /* Have to remove : stuff.  */
-      p = strchr (buf, ':');
-      if (p != NULL)
-       *p = '\0';
+      colon = strchr (buf, ':');
+      if (colon != NULL)
+       *colon = '\0';
       *functionname_ptr = buf;
     }
 
-  return true;
+  return TRUE;
 }
 
 int
 NAME(aout,sizeof_headers) (abfd, execable)
      bfd *abfd;
-     boolean execable ATTRIBUTE_UNUSED;
+     bfd_boolean execable ATTRIBUTE_UNUSED;
 {
   return adata(abfd).exec_bytes_size;
 }
@@ -2779,14 +2789,14 @@ NAME(aout,sizeof_headers) (abfd, execable)
 /* Free all information we have cached for this BFD.  We can always
    read it again later if we need it.  */
 
-boolean
+bfd_boolean
 NAME(aout,bfd_free_cached_info) (abfd)
      bfd *abfd;
 {
   asection *o;
 
   if (bfd_get_format (abfd) != bfd_object)
-    return true;
+    return TRUE;
 
 #define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; }
   BFCI_FREE (obj_aout_symbols (abfd));
@@ -2803,19 +2813,19 @@ NAME(aout,bfd_free_cached_info) (abfd)
     BFCI_FREE (o->relocation);
 #undef BFCI_FREE
 
-  return true;
+  return TRUE;
 }
 \f
 /* a.out link code.  */
 
-static boolean aout_link_add_object_symbols
+static bfd_boolean aout_link_add_object_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
-static boolean aout_link_check_archive_element
-  PARAMS ((bfd *, struct bfd_link_info *, boolean *));
-static boolean aout_link_free_symbols PARAMS ((bfd *));
-static boolean aout_link_check_ar_symbols
-  PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
-static boolean aout_link_add_symbols
+static bfd_boolean aout_link_check_archive_element
+  PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *));
+static bfd_boolean aout_link_free_symbols PARAMS ((bfd *));
+static bfd_boolean aout_link_check_ar_symbols
+  PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded));
+static bfd_boolean aout_link_add_symbols
   PARAMS ((bfd *, struct bfd_link_info *));
 
 /* Routine to create an entry in an a.out link hash table.  */
@@ -2843,7 +2853,7 @@ NAME(aout,link_hash_newfunc) (entry, table, string)
   if (ret)
     {
       /* Set local fields.  */
-      ret->written = false;
+      ret->written = FALSE;
       ret->indx = -1;
     }
 
@@ -2852,7 +2862,7 @@ NAME(aout,link_hash_newfunc) (entry, table, string)
 
 /* Initialize an a.out link hash table.  */
 
-boolean
+bfd_boolean
 NAME(aout,link_hash_table_init) (table, abfd, newfunc)
      struct aout_link_hash_table *table;
      bfd *abfd;
@@ -2870,9 +2880,9 @@ NAME(aout,link_hash_table_create) (abfd)
      bfd *abfd;
 {
   struct aout_link_hash_table *ret;
+  bfd_size_type amt = sizeof (struct aout_link_hash_table);
 
-  ret = ((struct aout_link_hash_table *)
-        bfd_alloc (abfd, sizeof (struct aout_link_hash_table)));
+  ret = ((struct aout_link_hash_table *) bfd_alloc (abfd, amt));
   if (ret == NULL)
     return (struct bfd_link_hash_table *) NULL;
   if (! NAME(aout,link_hash_table_init) (ret, abfd,
@@ -2887,7 +2897,7 @@ NAME(aout,link_hash_table_create) (abfd)
 /* Given an a.out BFD, add symbols to the global hash table as
    appropriate.  */
 
-boolean
+bfd_boolean
 NAME(aout,link_add_symbols) (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
@@ -2901,27 +2911,27 @@ NAME(aout,link_add_symbols) (abfd, info)
        (abfd, info, aout_link_check_archive_element);
     default:
       bfd_set_error (bfd_error_wrong_format);
-      return false;
+      return FALSE;
     }
 }
 
 /* Add symbols from an a.out object file.  */
 
-static boolean
+static bfd_boolean
 aout_link_add_object_symbols (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
   if (! aout_get_external_symbols (abfd))
-    return false;
+    return FALSE;
   if (! aout_link_add_symbols (abfd, info))
-    return false;
+    return FALSE;
   if (! info->keep_memory)
     {
       if (! aout_link_free_symbols (abfd))
-       return false;
+       return FALSE;
     }
-  return true;
+  return TRUE;
 }
 
 /* Check a single archive element to see if we need to include it in
@@ -2929,36 +2939,36 @@ aout_link_add_object_symbols (abfd, info)
    needed in the link or not.  This is called from
    _bfd_generic_link_add_archive_symbols.  */
 
-static boolean
+static bfd_boolean
 aout_link_check_archive_element (abfd, info, pneeded)
      bfd *abfd;
      struct bfd_link_info *info;
-     boolean *pneeded;
+     bfd_boolean *pneeded;
 {
   if (! aout_get_external_symbols (abfd))
-    return false;
+    return FALSE;
 
   if (! aout_link_check_ar_symbols (abfd, info, pneeded))
-    return false;
+    return FALSE;
 
   if (*pneeded)
     {
       if (! aout_link_add_symbols (abfd, info))
-       return false;
+       return FALSE;
     }
 
   if (! info->keep_memory || ! *pneeded)
     {
       if (! aout_link_free_symbols (abfd))
-       return false;
+       return FALSE;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Free up the internal symbols read from an a.out file.  */
 
-static boolean
+static bfd_boolean
 aout_link_free_symbols (abfd)
      bfd *abfd;
 {
@@ -2980,7 +2990,7 @@ aout_link_free_symbols (abfd)
 #endif
       obj_aout_external_strings (abfd) = (char *) NULL;
     }
-  return true;
+  return TRUE;
 }
 
 /* Look through the internal symbols to see if this object file should
@@ -2990,17 +3000,17 @@ aout_link_free_symbols (abfd)
    known symbol but we do not include the object file in the link
    (unless there is some other reason to include it).  */
 
-static boolean
+static bfd_boolean
 aout_link_check_ar_symbols (abfd, info, pneeded)
      bfd *abfd;
      struct bfd_link_info *info;
-     boolean *pneeded;
+     bfd_boolean *pneeded;
 {
   register struct external_nlist *p;
   struct external_nlist *pend;
   char *strings;
 
-  *pneeded = false;
+  *pneeded = FALSE;
 
   /* Look through all the symbols.  */
   p = obj_aout_external_syms (abfd);
@@ -3008,7 +3018,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
   strings = obj_aout_external_strings (abfd);
   for (; p < pend; p++)
     {
-      int type = bfd_h_get_8 (abfd, p->e_type);
+      int type = H_GET_8 (abfd, p->e_type);
       const char *name;
       struct bfd_link_hash_entry *h;
 
@@ -3020,7 +3030,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
        continue;
 
       name = strings + GET_WORD (abfd, p->e_strx);
-      h = bfd_link_hash_lookup (info->hash, name, false, false, true);
+      h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
 
       /* We are only interested in symbols that are currently
         undefined or common.  */
@@ -3050,9 +3060,9 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
             seems a bit crazy to me, and I haven't implemented it.
             However, it might be correct.  */
          if (! (*info->callbacks->add_archive_element) (info, abfd, name))
-           return false;
-         *pneeded = true;
-         return true;
+           return FALSE;
+         *pneeded = TRUE;
+         return TRUE;
        }
 
       if (type == (N_UNDF | N_EXT))
@@ -3079,9 +3089,9 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
                      if (! (*info->callbacks->add_archive_element) (info,
                                                                     abfd,
                                                                     name))
-                       return false;
-                     *pneeded = true;
-                     return true;
+                       return FALSE;
+                     *pneeded = TRUE;
+                     return TRUE;
                    }
                  /* Turn the current link symbol into a common
                     symbol.  It is already on the undefs list.  */
@@ -3090,7 +3100,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
                              bfd_hash_allocate (&info->hash->table,
                                  sizeof (struct bfd_link_hash_common_entry)));
                  if (h->u.c.p == NULL)
-                   return false;
+                   return FALSE;
 
                  h->u.c.size = value;
 
@@ -3118,25 +3128,24 @@ aout_link_check_ar_symbols (abfd, info, pneeded)
     }
 
   /* We do not need this object file.  */
-  return true;
+  return TRUE;
 }
 
 /* Add all symbols from an object file to the hash table.  */
 
-static boolean
+static bfd_boolean
 aout_link_add_symbols (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *,
-                                    const char *, flagword, asection *,
-                                    bfd_vma, const char *, boolean,
-                                    boolean,
-                                    struct bfd_link_hash_entry **));
+  bfd_boolean (*add_one_symbol)
+    PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
+            bfd_vma, const char *, bfd_boolean, bfd_boolean,
+            struct bfd_link_hash_entry **));
   struct external_nlist *syms;
   bfd_size_type sym_count;
   char *strings;
-  boolean copy;
+  bfd_boolean copy;
   struct aout_link_hash_entry **sym_hash;
   register struct external_nlist *p;
   struct external_nlist *pend;
@@ -3145,15 +3154,15 @@ aout_link_add_symbols (abfd, info)
   sym_count = obj_aout_external_sym_count (abfd);
   strings = obj_aout_external_strings (abfd);
   if (info->keep_memory)
-    copy = false;
+    copy = FALSE;
   else
-    copy = true;
+    copy = TRUE;
 
   if (aout_backend_info (abfd)->add_dynamic_symbols != NULL)
     {
       if (! ((*aout_backend_info (abfd)->add_dynamic_symbols)
             (abfd, info, &syms, &sym_count, &strings)))
-       return false;
+       return FALSE;
     }
 
   /* We keep a list of the linker hash table entries that correspond
@@ -3162,10 +3171,9 @@ aout_link_add_symbols (abfd, info)
      should be conditional on info->keep_memory.  */
   sym_hash = ((struct aout_link_hash_entry **)
              bfd_alloc (abfd,
-                        ((size_t) sym_count
-                         * sizeof (struct aout_link_hash_entry *))));
+                        sym_count * sizeof (struct aout_link_hash_entry *)));
   if (sym_hash == NULL && sym_count != 0)
-    return false;
+    return FALSE;
   obj_aout_sym_hashes (abfd) = sym_hash;
 
   add_one_symbol = aout_backend_info (abfd)->add_one_symbol;
@@ -3185,7 +3193,7 @@ aout_link_add_symbols (abfd, info)
 
       *sym_hash = NULL;
 
-      type = bfd_h_get_8 (abfd, p->e_type);
+      type = H_GET_8 (abfd, p->e_type);
 
 #if 0 /* not supported in PDP-11 a.out */
       /* Ignore debugging symbols.  */
@@ -3241,9 +3249,9 @@ aout_link_add_symbols (abfd, info)
        }
 
       if (! ((*add_one_symbol)
-            (info, abfd, name, flags, section, value, string, copy, false,
+            (info, abfd, name, flags, section, value, string, copy, FALSE,
              (struct bfd_link_hash_entry **) sym_hash)))
-       return false;
+       return FALSE;
 
       /* Restrict the maximum alignment of a common symbol based on
         the architecture, since a.out has no way to represent
@@ -3266,7 +3274,7 @@ aout_link_add_symbols (abfd, info)
        }
     }
 
-  return true;
+  return TRUE;
 }
 \f
 /* A hash table used for header files with N_BINCL entries.  */
@@ -3329,22 +3337,22 @@ struct aout_final_link_info
 
 static struct bfd_hash_entry *aout_link_includes_newfunc
   PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-static boolean aout_link_input_bfd
+static bfd_boolean aout_link_input_bfd
   PARAMS ((struct aout_final_link_info *, bfd *input_bfd));
-static boolean aout_link_write_symbols
+static bfd_boolean aout_link_write_symbols
   PARAMS ((struct aout_final_link_info *, bfd *input_bfd));
-static boolean aout_link_write_other_symbol
+static bfd_boolean aout_link_write_other_symbol
   PARAMS ((struct aout_link_hash_entry *, PTR));
-static boolean aout_link_input_section
+static bfd_boolean aout_link_input_section
   PARAMS ((struct aout_final_link_info *, bfd *input_bfd,
           asection *input_section, file_ptr *reloff_ptr,
           bfd_size_type rel_size));
 static INLINE asection *aout_reloc_type_to_section
   PARAMS ((bfd *, int));
-static boolean aout_link_reloc_link_order
+static bfd_boolean aout_link_reloc_link_order
   PARAMS ((struct aout_final_link_info *, asection *,
           struct bfd_link_order *));
-static boolean pdp11_aout_link_input_section
+static bfd_boolean pdp11_aout_link_input_section
   PARAMS ((struct aout_final_link_info *finfo,
           bfd *input_bfd,
           asection *input_section,
@@ -3391,24 +3399,24 @@ aout_link_includes_newfunc (entry, table, string)
    of bfd_link_order structures which list all the input sections for
    the output section.  */
 
-boolean
+bfd_boolean
 NAME(aout,final_link) (abfd, info, callback)
      bfd *abfd;
      struct bfd_link_info *info;
      void (*callback) PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
 {
   struct aout_final_link_info aout_info;
-  boolean includes_hash_initialized = false;
+  bfd_boolean includes_hash_initialized = FALSE;
   register bfd *sub;
   bfd_size_type trsize, drsize;
-  size_t max_contents_size;
-  size_t max_relocs_size;
-  size_t max_sym_count;
+  bfd_size_type max_contents_size;
+  bfd_size_type max_relocs_size;
+  bfd_size_type max_sym_count;
   bfd_size_type text_size;
   file_ptr text_end;
   register struct bfd_link_order *p;
   asection *o;
-  boolean have_link_order_relocs;
+  bfd_boolean have_link_order_relocs;
 
   if (info->shared)
     abfd->flags |= DYNAMIC;
@@ -3424,10 +3432,10 @@ NAME(aout,final_link) (abfd, info, callback)
                               aout_link_includes_newfunc,
                               251))
     goto error_return;
-  includes_hash_initialized = true;
+  includes_hash_initialized = TRUE;
 
   /* Figure out the largest section size.  Also, if generating
-     relocateable output, count the relocs.  */
+     relocatable output, count the relocs.  */
   trsize = 0;
   drsize = 0;
   max_contents_size = 0;
@@ -3437,7 +3445,7 @@ NAME(aout,final_link) (abfd, info, callback)
     {
       size_t sz;
 
-      if (info->relocateable)
+      if (info->relocatable)
        {
          if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
            {
@@ -3451,7 +3459,7 @@ NAME(aout,final_link) (abfd, info, callback)
                 work out the number of relocs needed, and then multiply
                 by the reloc size.  */
              (*_bfd_error_handler)
-               ("%s: relocateable link from %s to %s not supported",
+               ("%s: relocatable link from %s to %s not supported",
                 bfd_get_filename (abfd),
                 sub->xvec->name, abfd->xvec->name);
              bfd_set_error (bfd_error_invalid_operation);
@@ -3481,7 +3489,7 @@ NAME(aout,final_link) (abfd, info, callback)
        }
     }
 
-  if (info->relocateable)
+  if (info->relocatable)
     {
       if (obj_textsec (abfd) != (asection *) NULL)
        trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd)
@@ -3547,7 +3555,7 @@ NAME(aout,final_link) (abfd, info, callback)
     struct aout_link_hash_entry *h;
 
     h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC",
-                              false, false, false);
+                              FALSE, FALSE, FALSE);
     if (h != NULL)
       aout_link_write_other_symbol (h, &aout_info);
   }
@@ -3574,7 +3582,7 @@ NAME(aout,final_link) (abfd, info, callback)
      We use the output_has_begun field of the input BFDs to see
      whether we have already handled it.  */
   for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next)
-    sub->output_has_begun = false;
+    sub->output_has_begun = FALSE;
 
   /* Mark all sections which are to be included in the link.  This
      will normally be every section.  We need to do this so that we
@@ -3585,11 +3593,11 @@ NAME(aout,final_link) (abfd, info, callback)
       for (p = o->link_order_head; p != NULL; p = p->next)
        {
          if (p->type == bfd_indirect_link_order)
-           p->u.indirect.section->linker_mark = true;
+           p->u.indirect.section->linker_mark = TRUE;
        }
     }
 
-  have_link_order_relocs = false;
+  have_link_order_relocs = FALSE;
   for (o = abfd->sections; o != (asection *) NULL; o = o->next)
     {
       for (p = o->link_order_head;
@@ -3607,14 +3615,14 @@ NAME(aout,final_link) (abfd, info, callback)
                {
                  if (! aout_link_input_bfd (&aout_info, input_bfd))
                    goto error_return;
-                 input_bfd->output_has_begun = true;
+                 input_bfd->output_has_begun = TRUE;
                }
            }
          else if (p->type == bfd_section_reloc_link_order
                   || p->type == bfd_symbol_reloc_link_order)
            {
              /* These are handled below.  */
-             have_link_order_relocs = true;
+             have_link_order_relocs = TRUE;
            }
          else
            {
@@ -3674,7 +3682,7 @@ NAME(aout,final_link) (abfd, info, callback)
   if (includes_hash_initialized)
     {
       bfd_hash_table_free (&aout_info.includes.root);
-      includes_hash_initialized = false;
+      includes_hash_initialized = FALSE;
     }
 
   /* Finish up any dynamic linking we may be doing.  */
@@ -3707,15 +3715,15 @@ NAME(aout,final_link) (abfd, info, callback)
 
       b = 0;
       if (bfd_seek (abfd,
-                   (obj_datasec (abfd)->filepos
-                    + exec_hdr (abfd)->a_data
-                    - 1),
+                   (file_ptr) (obj_datasec (abfd)->filepos
+                               + exec_hdr (abfd)->a_data
+                               - 1),
                    SEEK_SET) != 0
-         || bfd_write (&b, 1, 1, abfd) != 1)
+         || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1)
        goto error_return;
     }
 
-  return true;
+  return TRUE;
 
  error_return:
   if (aout_info.contents != NULL)
@@ -3728,12 +3736,12 @@ NAME(aout,final_link) (abfd, info, callback)
     free (aout_info.output_syms);
   if (includes_hash_initialized)
     bfd_hash_table_free (&aout_info.includes.root);
-  return false;
+  return FALSE;
 }
 
 /* Link an a.out input BFD into the output file.  */
 
-static boolean
+static bfd_boolean
 aout_link_input_bfd (finfo, input_bfd)
      struct aout_final_link_info *finfo;
      bfd *input_bfd;
@@ -3751,16 +3759,16 @@ aout_link_input_bfd (finfo, input_bfd)
     }
 
   /* Get the symbols.  We probably have them already, unless
-     finfo->info->keep_memory is false.  */
+     finfo->info->keep_memory is FALSE.  */
   if (! aout_get_external_symbols (input_bfd))
-    return false;
+    return FALSE;
 
   sym_count = obj_aout_external_sym_count (input_bfd);
 
   /* Write out the symbols and get a map of the new indices.  The map
      is placed into finfo->symbol_map.  */
   if (! aout_link_write_symbols (finfo, input_bfd))
-    return false;
+    return FALSE;
 
   /* Relocate and write out the sections.  These functions use the
      symbol map created by aout_link_write_symbols.  The linker_mark
@@ -3772,7 +3780,7 @@ aout_link_input_bfd (finfo, input_bfd)
                                     obj_textsec (input_bfd),
                                     &finfo->treloff,
                                     exec_hdr (input_bfd)->a_trsize))
-       return false;
+       return FALSE;
     }
   if (obj_datasec (input_bfd)->linker_mark)
     {
@@ -3780,7 +3788,7 @@ aout_link_input_bfd (finfo, input_bfd)
                                     obj_datasec (input_bfd),
                                     &finfo->dreloff,
                                     exec_hdr (input_bfd)->a_drsize))
-       return false;
+       return FALSE;
     }
 
   /* If we are not keeping memory, we don't need the symbols any
@@ -3789,16 +3797,16 @@ aout_link_input_bfd (finfo, input_bfd)
   if (! finfo->info->keep_memory)
     {
       if (! aout_link_free_symbols (input_bfd))
-       return false;
+       return FALSE;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Adjust and write out the symbols for an a.out file.  Set the new
    symbol indices into a symbol_map.  */
 
-static boolean
+static bfd_boolean
 aout_link_write_symbols (finfo, input_bfd)
      struct aout_final_link_info *finfo;
      bfd *input_bfd;
@@ -3814,8 +3822,8 @@ aout_link_write_symbols (finfo, input_bfd)
   struct external_nlist *sym_end;
   struct aout_link_hash_entry **sym_hash;
   int *symbol_map;
-  boolean pass;
-  boolean skip_next;
+  bfd_boolean pass;
+  bfd_boolean skip_next;
 
   output_bfd = finfo->output_bfd;
   sym_count = obj_aout_external_sym_count (input_bfd);
@@ -3829,14 +3837,14 @@ aout_link_write_symbols (finfo, input_bfd)
   if (strip != strip_all
       && (strip != strip_some
          || bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename,
-                             false, false) != NULL)
+                             FALSE, FALSE) != NULL)
       && discard != discard_all)
     {
-      bfd_h_put_8 (output_bfd, N_TEXT, outsym->e_type);
+      H_PUT_8 (output_bfd, N_TEXT, outsym->e_type);
       strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
-                                      input_bfd->filename, false);
+                                      input_bfd->filename, FALSE);
       if (strtab_index == (bfd_size_type) -1)
-       return false;
+       return FALSE;
       PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
       PUT_WORD (output_bfd,
                (bfd_get_section_vma (output_bfd,
@@ -3847,22 +3855,22 @@ aout_link_write_symbols (finfo, input_bfd)
       ++outsym;
     }
 
-  pass = false;
-  skip_next = false;
+  pass = FALSE;
+  skip_next = FALSE;
   sym = obj_aout_external_syms (input_bfd);
   sym_end = sym + sym_count;
   sym_hash = obj_aout_sym_hashes (input_bfd);
   symbol_map = finfo->symbol_map;
-  memset (symbol_map, 0, sym_count * sizeof *symbol_map);
+  memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map);
   for (; sym < sym_end; sym++, sym_hash++, symbol_map++)
     {
       const char *name;
       int type;
       struct aout_link_hash_entry *h;
-      boolean skip;
+      bfd_boolean skip;
       asection *symsec;
       bfd_vma val = 0;
-      boolean copy;
+      bfd_boolean copy;
 
       /* We set *symbol_map to 0 above for all symbols.  If it has
          already been set to -1 for this symbol, it means that we are
@@ -3876,7 +3884,7 @@ aout_link_write_symbols (finfo, input_bfd)
          we do copy the symbol over.  */
       *symbol_map = -1;
 
-      type = bfd_h_get_8 (input_bfd, sym->e_type);
+      type = H_GET_8 (input_bfd, sym->e_type);
       name = strings + GET_WORD (input_bfd, sym->e_strx);
 
       h = NULL;
@@ -3886,14 +3894,14 @@ aout_link_write_symbols (finfo, input_bfd)
          /* Pass this symbol through.  It is the target of an
             indirect or warning symbol.  */
          val = GET_WORD (input_bfd, sym->e_value);
-         pass = false;
+         pass = FALSE;
        }
       else if (skip_next)
        {
          /* Skip this symbol, which is the target of an indirect
             symbol that we have changed to no longer be an indirect
             symbol.  */
-         skip_next = false;
+         skip_next = FALSE;
          continue;
        }
       else
@@ -3935,34 +3943,34 @@ aout_link_write_symbols (finfo, input_bfd)
            {
              if ((type & N_TYPE) == N_INDR
                  || type == N_WARNING)
-               skip_next = true;
+               skip_next = TRUE;
              *symbol_map = h->indx;
              continue;
            }
 
          /* See if we are stripping this symbol.  */
-         skip = false;
+         skip = FALSE;
          switch (strip)
            {
            case strip_none:
              break;
            case strip_debugger:
              if ((type & N_STAB) != 0)
-               skip = true;
+               skip = TRUE;
              break;
            case strip_some:
-             if (bfd_hash_lookup (finfo->info->keep_hash, name, false, false)
+             if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE)
                  == NULL)
-               skip = true;
+               skip = TRUE;
              break;
            case strip_all:
-             skip = true;
+             skip = TRUE;
              break;
            }
          if (skip)
            {
              if (h != (struct aout_link_hash_entry *) NULL)
-               h->written = true;
+               h->written = TRUE;
              continue;
            }
 
@@ -3991,7 +3999,7 @@ aout_link_write_symbols (finfo, input_bfd)
                 the indirect symbol was defined, we output it with
                 the correct definition so the debugger will
                 understand it.  */
-             pass = true;
+             pass = TRUE;
              val = GET_WORD (input_bfd, sym->e_value);
              symsec = NULL;
            }
@@ -4007,7 +4015,7 @@ aout_link_write_symbols (finfo, input_bfd)
                 a case we do not want to output the next symbol,
                 which is the target of the indirection.  */
              if ((type & N_TYPE) == N_INDR)
-               skip_next = true;
+               skip_next = TRUE;
 
              symsec = NULL;
 
@@ -4099,7 +4107,7 @@ aout_link_write_symbols (finfo, input_bfd)
             it is a local symbol see if we should discard it.  */
          if (h != (struct aout_link_hash_entry *) NULL)
            {
-             h->written = true;
+             h->written = TRUE;
              h->indx = obj_aout_external_sym_count (output_bfd);
            }
          else if ((type & N_TYPE) != N_SETT
@@ -4110,19 +4118,20 @@ aout_link_write_symbols (finfo, input_bfd)
              switch (discard)
                {
                case discard_none:
+               case discard_sec_merge:
                  break;
                case discard_l:
                  if ((type & N_STAB) == 0
                      && bfd_is_local_label_name (input_bfd, name))
-                   skip = true;
+                   skip = TRUE;
                  break;
                case discard_all:
-                 skip = true;
+                 skip = TRUE;
                  break;
                }
              if (skip)
                {
-                 pass = false;
+                 pass = FALSE;
                  continue;
                }
            }
@@ -4146,7 +4155,7 @@ aout_link_write_symbols (finfo, input_bfd)
                {
                  int incl_type;
 
-                 incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type);
+                 incl_type = H_GET_8 (input_bfd, incl_sym->e_type);
                  if (incl_type == N_EINCL)
                    {
                      if (nest == 0)
@@ -4167,7 +4176,7 @@ aout_link_write_symbols (finfo, input_bfd)
                            {
                              /* Skip the file number.  */
                              ++s;
-                             while (isdigit ((unsigned char) *s))
+                             while (ISDIGIT (*s))
                                ++s;
                              --s;
                            }
@@ -4180,9 +4189,9 @@ aout_link_write_symbols (finfo, input_bfd)
                  symbol.  */
              copy = ! finfo->info->keep_memory;
              incl_entry = aout_link_includes_lookup (&finfo->includes,
-                                                     name, true, copy);
+                                                     name, TRUE, copy);
              if (incl_entry == NULL)
-               return false;
+               return FALSE;
              for (t = incl_entry->totals; t != NULL; t = t->next)
                if (t->total == val)
                  break;
@@ -4194,7 +4203,7 @@ aout_link_write_symbols (finfo, input_bfd)
                       bfd_hash_allocate (&finfo->includes.root,
                                          sizeof *t));
                  if (t == NULL)
-                   return false;
+                   return FALSE;
                  t->total = val;
                  t->next = incl_entry->totals;
                  incl_entry->totals = t;
@@ -4215,7 +4224,7 @@ aout_link_write_symbols (finfo, input_bfd)
                    {
                      int incl_type;
 
-                     incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type);
+                     incl_type = H_GET_8 (input_bfd, incl_sym->e_type);
                      if (incl_type == N_EINCL)
                        {
                          if (nest == 0)
@@ -4236,8 +4245,8 @@ aout_link_write_symbols (finfo, input_bfd)
 
       /* Copy this symbol into the list of symbols we are going to
         write out.  */
-      bfd_h_put_8 (output_bfd, type, outsym->e_type);
-      copy = false;
+      H_PUT_8 (output_bfd, type, outsym->e_type);
+      copy = FALSE;
       if (! finfo->info->keep_memory)
        {
          /* name points into a string table which we are going to
@@ -4246,12 +4255,12 @@ aout_link_write_symbols (finfo, input_bfd)
          if (h != (struct aout_link_hash_entry *) NULL)
            name = h->root.root.string;
          else
-           copy = true;
+           copy = TRUE;
        }
       strtab_index = add_to_stringtab (output_bfd, finfo->strtab,
                                       name, copy);
       if (strtab_index == (bfd_size_type) -1)
-       return false;
+       return FALSE;
       PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
       PUT_WORD (output_bfd, val, outsym->e_value);
       *symbol_map = obj_aout_external_sym_count (output_bfd);
@@ -4262,26 +4271,24 @@ aout_link_write_symbols (finfo, input_bfd)
   /* Write out the output symbols we have just constructed.  */
   if (outsym > finfo->output_syms)
     {
-      bfd_size_type outsym_count;
+      bfd_size_type size;
 
       if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0)
-       return false;
-      outsym_count = outsym - finfo->output_syms;
-      if (bfd_write ((PTR) finfo->output_syms,
-                    (bfd_size_type) EXTERNAL_NLIST_SIZE,
-                    (bfd_size_type) outsym_count, output_bfd)
-         != outsym_count * EXTERNAL_NLIST_SIZE)
-       return false;
-      finfo->symoff += outsym_count * EXTERNAL_NLIST_SIZE;
+       return FALSE;
+      size = outsym - finfo->output_syms;
+      size *= EXTERNAL_NLIST_SIZE;
+      if (bfd_bwrite ((PTR) finfo->output_syms, size, output_bfd) != size)
+       return FALSE;
+      finfo->symoff += size;
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Write out a symbol that was not associated with an a.out input
    object.  */
 
-static boolean
+static bfd_boolean
 aout_link_write_other_symbol (h, data)
      struct aout_link_hash_entry *h;
      PTR data;
@@ -4292,6 +4299,14 @@ aout_link_write_other_symbol (h, data)
   bfd_vma val;
   struct external_nlist outsym;
   bfd_size_type indx;
+  bfd_size_type amt;
+
+  if (h->root.type == bfd_link_hash_warning)
+    {
+      h = (struct aout_link_hash_entry *) h->root.u.i.link;
+      if (h->root.type == bfd_link_hash_new)
+       return TRUE;
+    }
 
   output_bfd = finfo->output_bfd;
 
@@ -4306,28 +4321,28 @@ aout_link_write_other_symbol (h, data)
     }
 
   if (h->written)
-    return true;
+    return TRUE;
 
-  h->written = true;
+  h->written = TRUE;
 
   /* An indx of -2 means the symbol must be written.  */
   if (h->indx != -2
       && (finfo->info->strip == strip_all
          || (finfo->info->strip == strip_some
              && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string,
-                                 false, false) == NULL)))
-    return true;
+                                 FALSE, FALSE) == NULL)))
+    return TRUE;
 
   switch (h->root.type)
     {
     default:
       abort ();
       /* Avoid variable not initialized warnings.  */
-      return true;
+      return TRUE;
     case bfd_link_hash_new:
       /* This can happen for set symbols when sets are not being
          built.  */
-      return true;
+      return TRUE;
     case bfd_link_hash_undefined:
       type = N_UNDF | N_EXT;
       val = 0;
@@ -4365,12 +4380,12 @@ aout_link_write_other_symbol (h, data)
     case bfd_link_hash_warning:
       /* FIXME: Ignore these for now.  The circumstances under which
         they should be written out are not clear to me.  */
-      return true;
+      return TRUE;
     }
 
-  bfd_h_put_8 (output_bfd, type, outsym.e_type);
+  H_PUT_8 (output_bfd, type, outsym.e_type);
   indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string,
-                          false);
+                          FALSE);
   if (indx == (bfd_size_type) -1)
     {
       /* FIXME: No way to handle errors.  */
@@ -4379,24 +4394,24 @@ aout_link_write_other_symbol (h, data)
   PUT_WORD (output_bfd, indx, outsym.e_strx);
   PUT_WORD (output_bfd, val, outsym.e_value);
 
+  amt = EXTERNAL_NLIST_SIZE;
   if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0
-      || bfd_write ((PTR) &outsym, (bfd_size_type) EXTERNAL_NLIST_SIZE,
-                   (bfd_size_type) 1, output_bfd) != EXTERNAL_NLIST_SIZE)
+      || bfd_bwrite ((PTR) &outsym, amt, output_bfd) != amt)
     {
       /* FIXME: No way to handle errors.  */
       abort ();
     }
 
-  finfo->symoff += EXTERNAL_NLIST_SIZE;
+  finfo->symoff += amt;
   h->indx = obj_aout_external_sym_count (output_bfd);
   ++obj_aout_external_sym_count (output_bfd);
 
-  return true;
+  return TRUE;
 }
 
 /* Link an a.out section into the output file.  */
 
-static boolean
+static bfd_boolean
 aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
                         rel_size)
      struct aout_final_link_info *finfo;
@@ -4413,7 +4428,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
   if (! bfd_get_section_contents (input_bfd, input_section,
                                  (PTR) finfo->contents,
                                  (file_ptr) 0, input_size))
-    return false;
+    return FALSE;
 
   /* Read in the relocs if we haven't already done it.  */
   if (aout_section_data (input_section) != NULL
@@ -4425,8 +4440,8 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
       if (rel_size > 0)
        {
          if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0
-             || bfd_read (relocs, 1, rel_size, input_bfd) != rel_size)
-           return false;
+             || bfd_bread (relocs, rel_size, input_bfd) != rel_size)
+           return FALSE;
        }
     }
 
@@ -4434,25 +4449,24 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
   if (! pdp11_aout_link_input_section (finfo, input_bfd, input_section,
                                       (struct pdp11_aout_reloc_external *) relocs,
                                       rel_size, finfo->contents))
-    return false;
+    return FALSE;
 
   /* Write out the section contents.  */
   if (! bfd_set_section_contents (finfo->output_bfd,
                                  input_section->output_section,
                                  (PTR) finfo->contents,
-                                 input_section->output_offset,
+                                 (file_ptr) input_section->output_offset,
                                  input_size))
-    return false;
+    return FALSE;
 
-  /* If we are producing relocateable output, the relocs were
+  /* If we are producing relocatable output, the relocs were
      modified, and we now write them out.  */
-  if (finfo->info->relocateable && rel_size > 0)
+  if (finfo->info->relocatable && rel_size > 0)
     {
       if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
-       return false;
-      if (bfd_write (relocs, (bfd_size_type) 1, rel_size, finfo->output_bfd)
-         != rel_size)
-       return false;
+       return FALSE;
+      if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size)
+       return FALSE;
       *reloff_ptr += rel_size;
 
       /* Assert that the relocs have not run into the symbols, and
@@ -4464,7 +4478,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr,
                          <= obj_datasec (finfo->output_bfd)->rel_filepos)));
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Get the section corresponding to a reloc index.  */
@@ -4491,7 +4505,7 @@ aout_reloc_type_to_section (abfd, type)
     }
 }
 
-static boolean
+static bfd_boolean
 pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs,
                               rel_size, contents)
      struct aout_final_link_info *finfo;
@@ -4501,13 +4515,12 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs,
      bfd_size_type rel_size;
      bfd_byte *contents;
 {
-  boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *,
-                                         bfd *, asection *,
-                                         struct aout_link_hash_entry *,
-                                         PTR, bfd_byte *, boolean *,
-                                         bfd_vma *));
+  bfd_boolean (*check_dynamic_reloc)
+    PARAMS ((struct bfd_link_info *, bfd *, asection *,
+            struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *,
+            bfd_vma *));
   bfd *output_bfd;
-  boolean relocateable;
+  bfd_boolean relocatable;
   struct external_nlist *syms;
   char *strings;
   struct aout_link_hash_entry **sym_hashes;
@@ -4523,7 +4536,7 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs,
   BFD_ASSERT (input_bfd->xvec->header_byteorder
              == output_bfd->xvec->header_byteorder);
 
-  relocateable = finfo->info->relocateable;
+  relocatable = finfo->info->relocatable;
   syms = obj_aout_external_syms (input_bfd);
   strings = obj_aout_external_strings (input_bfd);
   sym_hashes = obj_aout_sym_hashes (input_bfd);
@@ -4564,9 +4577,9 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs,
        howto = howto_table_pdp11 + howto_idx;
       }
 
-      if (relocateable)
+      if (relocatable)
        {
-         /* We are generating a relocateable output file, and must
+         /* We are generating a relocatable output file, and must
             modify the reloc accordingly.  */
          if (r_extern)
            {
@@ -4615,10 +4628,10 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs,
                          if (h->indx < 0)
                            {
                              h->indx = -2;
-                             h->written = false;
+                             h->written = FALSE;
                              if (! aout_link_write_other_symbol (h,
                                                                  (PTR) finfo))
-                               return false;
+                               return FALSE;
                            }
                          r_index = h->indx;
                        }
@@ -4631,7 +4644,7 @@ pdp11_aout_link_input_section (finfo, input_bfd, input_section, relocs,
                          if (! ((*finfo->info->callbacks->unattached_reloc)
                                 (finfo->info, name, input_bfd, input_section,
                                  r_addr)))
-                           return false;
+                           return FALSE;
                          r_index = 0;
                        }
                    }
@@ -4687,11 +4700,11 @@ fprintf (stderr, "TODO: change the address of the relocation\n");
        }
       else
        {
-         boolean hundef;
+         bfd_boolean hundef;
 
          /* We are generating an executable, and must do a full
             relocation.  */
-         hundef = false;
+         hundef = FALSE;
          if (r_extern)
            {
              h = sym_hashes[r_index];
@@ -4709,7 +4722,7 @@ fprintf (stderr, "TODO: change the address of the relocation\n");
                relocation = 0;
              else
                {
-                 hundef = true;
+                 hundef = TRUE;
                  relocation = 0;
                }
            }
@@ -4727,12 +4740,12 @@ fprintf (stderr, "TODO: change the address of the relocation\n");
 
          if (check_dynamic_reloc != NULL)
            {
-             boolean skip;
+             bfd_boolean skip;
 
              if (! ((*check_dynamic_reloc)
                     (finfo->info, input_bfd, input_section, h,
                      (PTR) rel, contents, &skip, &relocation)))
-               return false;
+               return FALSE;
              if (skip)
                continue;
            }
@@ -4750,8 +4763,8 @@ fprintf (stderr, "TODO: change the address of the relocation\n");
                name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
              if (! ((*finfo->info->callbacks->undefined_symbol)
                     (finfo->info, name, input_bfd, input_section,
-                     r_addr, true)))
-               return false;
+                     r_addr, TRUE)))
+               return FALSE;
            }
 
          r = MY_final_link_relocate (howto,
@@ -4786,19 +4799,19 @@ fprintf (stderr, "TODO: change the address of the relocation\n");
                if (! ((*finfo->info->callbacks->reloc_overflow)
                       (finfo->info, name, howto->name,
                        (bfd_vma) 0, input_bfd, input_section, r_addr)))
-                 return false;
+                 return FALSE;
              }
              break;
            }
        }
     }
 
-  return true;
+  return TRUE;
 }
 
 /* Handle a link order which is supposed to generate a reloc.  */
 
-static boolean
+static bfd_boolean
 aout_link_reloc_link_order (finfo, o, p)
      struct aout_final_link_info *finfo;
      asection *o;
@@ -4811,6 +4824,7 @@ aout_link_reloc_link_order (finfo, o, p)
   file_ptr *reloff_ptr;
   struct reloc_std_external srel;
   PTR rel_ptr;
+  bfd_size_type rel_size;
 
   pr = p->u.reloc.p;
 
@@ -4833,7 +4847,7 @@ aout_link_reloc_link_order (finfo, o, p)
       r_extern = 1;
       h = ((struct aout_link_hash_entry *)
           bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info,
-                                        pr->u.name, false, false, true));
+                                        pr->u.name, FALSE, FALSE, TRUE));
       if (h != (struct aout_link_hash_entry *) NULL
          && h->indx >= 0)
        r_index = h->indx;
@@ -4844,9 +4858,9 @@ aout_link_reloc_link_order (finfo, o, p)
             here.  I don't think that will ever matter for a global
             symbol.  */
          h->indx = -2;
-         h->written = false;
+         h->written = FALSE;
          if (! aout_link_write_other_symbol (h, (PTR) finfo))
-           return false;
+           return FALSE;
          r_index = h->indx;
        }
       else
@@ -4854,7 +4868,7 @@ aout_link_reloc_link_order (finfo, o, p)
          if (! ((*finfo->info->callbacks->unattached_reloc)
                 (finfo->info, pr->u.name, (bfd *) NULL,
                  (asection *) NULL, (bfd_vma) 0)))
-           return false;
+           return FALSE;
          r_index = 0;
        }
     }
@@ -4863,7 +4877,7 @@ aout_link_reloc_link_order (finfo, o, p)
   if (howto == 0)
     {
       bfd_set_error (bfd_error_bad_value);
-      return false;
+      return FALSE;
     }
 
   if (o == obj_textsec (finfo->output_bfd))
@@ -4933,12 +4947,12 @@ aout_link_reloc_link_order (finfo, o, p)
       bfd_size_type size;
       bfd_reloc_status_type r;
       bfd_byte *buf;
-      boolean ok;
+      bfd_boolean ok;
 
       size = bfd_get_reloc_size (howto);
       buf = (bfd_byte *) bfd_zmalloc (size);
       if (buf == (bfd_byte *) NULL)
-       return false;
+       return FALSE;
       r = MY_relocate_contents (howto, finfo->output_bfd,
                                pr->addend, buf);
       switch (r)
@@ -4959,7 +4973,7 @@ aout_link_reloc_link_order (finfo, o, p)
                  (asection *) NULL, (bfd_vma) 0)))
            {
              free (buf);
-             return false;
+             return FALSE;
            }
          break;
        }
@@ -4969,17 +4983,15 @@ aout_link_reloc_link_order (finfo, o, p)
                                     size);
       free (buf);
       if (! ok)
-       return false;
+       return FALSE;
     }
 
+  rel_size = obj_reloc_entry_size (finfo->output_bfd);
   if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0
-      || (bfd_write (rel_ptr, (bfd_size_type) 1,
-                    obj_reloc_entry_size (finfo->output_bfd),
-                    finfo->output_bfd)
-         != obj_reloc_entry_size (finfo->output_bfd)))
-    return false;
+      || bfd_bwrite (rel_ptr, rel_size, finfo->output_bfd) != rel_size)
+    return FALSE;
 
-  *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd);
+  *reloff_ptr += rel_size;
 
   /* Assert that the relocs have not run into the symbols, and that n
      the text relocs have not run into the data relocs.  */
@@ -4988,35 +5000,42 @@ aout_link_reloc_link_order (finfo, o, p)
                  || (*reloff_ptr
                      <= obj_datasec (finfo->output_bfd)->rel_filepos)));
 
-  return true;
+  return TRUE;
 }
 /* end of modified aoutx.h */
 
-bfd_vma
-bfd_getp32 (addr)
-     const bfd_byte *addr;
+static bfd_vma
+bfd_getp32 (const void *p)
 {
-  return (((((bfd_vma)addr[1] << 8) | addr[0]) << 8)
-         | addr[3]) << 8 | addr[2];
+  const bfd_byte *addr = p;
+  unsigned long v;
+  v = (unsigned long) addr[1] << 24;
+  v |= (unsigned long) addr[0] << 16;
+  v |= (unsigned long) addr[3] << 8;
+  v |= (unsigned long) addr[2];
+  return v;
 }
 
 #define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000)
 
-bfd_signed_vma
-bfd_getp_signed_32 (addr)
-     const bfd_byte *addr;
+static bfd_signed_vma
+bfd_getp_signed_32 (const void *p)
 {
-  return COERCE32((((((bfd_vma)addr[1] << 8) | addr[0]) << 8)
-                  | addr[3]) << 8 | addr[2]);
+  const bfd_byte *addr = p;
+  unsigned long v;
+  v = (unsigned long) addr[1] << 24;
+  v |= (unsigned long) addr[0] << 16;
+  v |= (unsigned long) addr[3] << 8;
+  v |= (unsigned long) addr[2];
+  return COERCE32 (v);
 }
 
-void
-bfd_putp32 (data, addr)
-     bfd_vma data;
-     bfd_byte *addr;
+static void
+bfd_putp32 (bfd_vma data, void *p)
 {
-  addr[0] = (bfd_byte)(data >> 16);
-  addr[1] = (bfd_byte)(data >> 24);
-  addr[2] = (bfd_byte)data;
-  addr[3] = (bfd_byte)(data >>  8);
+  bfd_byte *addr = p;
+  addr[0] = (data >> 16) & 0xff;
+  addr[1] = (data >> 24) & 0xff;
+  addr[2] = (data >> 0) & 0xff;
+  addr[3] = (data >> 8) & 0xff;
 }
This page took 0.065796 seconds and 4 git commands to generate.