2004-04-28 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / bfd / bout.c
index fb6b4751d30bbe73b56c8f1ab776d6e6a0056d19..a39a9a36a9453871196d53b0b945040afddaabbc 100644 (file)
@@ -1,6 +1,6 @@
 /* BFD back-end for Intel 960 b.out binaries.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001
+   2000, 2001, 2002, 2003
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -30,30 +30,59 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "aout/stab_gnu.h"
 #include "libaout.h"           /* BFD a.out internal data structures.  */
 
-static int                   aligncode PARAMS ((bfd *abfd, asection *input_section, arelent *r, unsigned int shrink));
-static void                  perform_slip PARAMS ((bfd *abfd, unsigned int slip, asection *input_section, bfd_vma value));
-static boolean               b_out_squirt_out_relocs PARAMS ((bfd *abfd, asection *section));
-static const bfd_target *    b_out_callback PARAMS ((bfd *));
-static bfd_reloc_status_type calljx_callback PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR src, PTR dst, asection *));
-static bfd_reloc_status_type callj_callback PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR data, unsigned int srcidx, unsigned int dstidx, asection *, boolean));
-static bfd_vma               get_value PARAMS ((arelent *, struct bfd_link_info *, asection *));
-static int                   abs32code PARAMS ((bfd *, asection *, arelent *, unsigned int, struct bfd_link_info *));
-static boolean               b_out_bfd_relax_section PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *));
-static bfd_byte *            b_out_bfd_get_relocated_section_contents  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, boolean, asymbol **));
-static int                   b_out_sizeof_headers PARAMS ((bfd *, boolean));
-static boolean               b_out_set_arch_mach PARAMS ((bfd *, enum bfd_architecture, unsigned long));
-static boolean               b_out_set_section_contents PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
-static long                  b_out_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr));
-static long                  b_out_canonicalize_reloc PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
-static boolean               b_out_slurp_reloc_table PARAMS ((bfd *, sec_ptr, asymbol **));
-static reloc_howto_type *    b_out_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
-static boolean               b_out_write_object_contents PARAMS ((bfd *));
-static int                   b_out_symbol_cmp PARAMS ((const void *, const void *));
-static boolean               b_out_mkobject PARAMS ((bfd *));
-static const bfd_target *    b_out_object_p PARAMS ((bfd *));
-
-void bout_swap_exec_header_in  PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
-void bout_swap_exec_header_out PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
+static int aligncode
+  PARAMS ((bfd *abfd, asection *input_section, arelent *r,
+          unsigned int shrink));
+static void perform_slip
+  PARAMS ((bfd *abfd, unsigned int slip, asection *input_section,
+          bfd_vma value));
+static bfd_boolean b_out_squirt_out_relocs
+  PARAMS ((bfd *abfd, asection *section));
+static const bfd_target *b_out_callback
+  PARAMS ((bfd *));
+static bfd_reloc_status_type calljx_callback
+  PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR src, PTR dst,
+          asection *));
+static bfd_reloc_status_type callj_callback
+  PARAMS ((bfd *, struct bfd_link_info *, arelent *, PTR data,
+          unsigned int srcidx, unsigned int dstidx, asection *, bfd_boolean));
+static bfd_vma get_value
+  PARAMS ((arelent *, struct bfd_link_info *, asection *));
+static int abs32code
+  PARAMS ((bfd *, asection *, arelent *, unsigned int,
+          struct bfd_link_info *));
+static bfd_boolean b_out_bfd_relax_section
+  PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *));
+static bfd_byte *b_out_bfd_get_relocated_section_contents
+  PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
+          bfd_boolean, asymbol **));
+static int b_out_sizeof_headers
+  PARAMS ((bfd *, bfd_boolean));
+static bfd_boolean b_out_set_arch_mach
+  PARAMS ((bfd *, enum bfd_architecture, unsigned long));
+static bfd_boolean b_out_set_section_contents
+  PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type));
+static long b_out_get_reloc_upper_bound
+  PARAMS ((bfd *, sec_ptr));
+static long b_out_canonicalize_reloc
+  PARAMS ((bfd *, sec_ptr, arelent **, asymbol **));
+static bfd_boolean b_out_slurp_reloc_table
+  PARAMS ((bfd *, sec_ptr, asymbol **));
+static reloc_howto_type *b_out_bfd_reloc_type_lookup
+  PARAMS ((bfd *, bfd_reloc_code_real_type));
+static bfd_boolean b_out_write_object_contents
+  PARAMS ((bfd *));
+static int b_out_symbol_cmp
+  PARAMS ((const void *, const void *));
+static bfd_boolean b_out_mkobject
+  PARAMS ((bfd *));
+static const bfd_target *b_out_object_p
+  PARAMS ((bfd *));
+
+void bout_swap_exec_header_in
+  PARAMS ((bfd *, struct external_exec *, struct internal_exec *));
+void bout_swap_exec_header_out
+  PARAMS ((bfd *, struct internal_exec *, struct external_exec *));
 
 /* Swaps the information in an executable header taken from a raw byte
    stream memory image, into the internal exec_header structure.  */
@@ -67,7 +96,7 @@ bout_swap_exec_header_in (abfd, raw_bytes, execp)
   struct external_exec *bytes = (struct external_exec *)raw_bytes;
 
   /* Now fill in fields in the execp, from the bytes in the raw data.  */
-  execp->a_info   = bfd_h_get_32 (abfd, bytes->e_info);
+  execp->a_info   = H_GET_32 (abfd, bytes->e_info);
   execp->a_text   = GET_WORD (abfd, bytes->e_text);
   execp->a_data   = GET_WORD (abfd, bytes->e_data);
   execp->a_bss    = GET_WORD (abfd, bytes->e_bss);
@@ -95,7 +124,7 @@ bout_swap_exec_header_out (abfd, execp, raw_bytes)
   struct external_exec *bytes = (struct external_exec *)raw_bytes;
 
   /* Now fill in fields in the raw data, from the fields in the exec struct.  */
-  bfd_h_put_32 (abfd, execp->a_info  , bytes->e_info);
+  H_PUT_32 (abfd, execp->a_info  , bytes->e_info);
   PUT_WORD (abfd, execp->a_text  , bytes->e_text);
   PUT_WORD (abfd, execp->a_data  , bytes->e_data);
   PUT_WORD (abfd, execp->a_bss   , bytes->e_bss);
@@ -117,16 +146,16 @@ b_out_object_p (abfd)
 {
   struct internal_exec anexec;
   struct external_exec exec_bytes;
+  bfd_size_type amt = EXEC_BYTES_SIZE;
 
-  if (bfd_read ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd)
-      != EXEC_BYTES_SIZE)
+  if (bfd_bread ((PTR) &exec_bytes, amt, abfd) != amt)
     {
       if (bfd_get_error () != bfd_error_system_call)
        bfd_set_error (bfd_error_wrong_format);
       return 0;
     }
 
-  anexec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
+  anexec.a_info = H_GET_32 (abfd, exec_bytes.e_info);
 
   if (N_BADMAG (anexec))
     {
@@ -201,24 +230,25 @@ struct bout_data_struct
     struct internal_exec e;
   };
 
-static boolean
+static bfd_boolean
 b_out_mkobject (abfd)
      bfd *abfd;
 {
   struct bout_data_struct *rawptr;
+  bfd_size_type amt = sizeof (struct bout_data_struct);
 
-  rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, sizeof (struct bout_data_struct));
+  rawptr = (struct bout_data_struct *) bfd_zalloc (abfd, amt);
   if (rawptr == NULL)
-    return false;
+    return FALSE;
 
   abfd->tdata.bout_data = rawptr;
   exec_hdr (abfd) = &rawptr->e;
 
-  obj_textsec (abfd) = (asection *)NULL;
-  obj_datasec (abfd) = (asection *)NULL;
-  obj_bsssec (abfd) = (asection *)NULL;
+  obj_textsec (abfd) = (asection *) NULL;
+  obj_datasec (abfd) = (asection *) NULL;
+  obj_bsssec (abfd) = (asection *) NULL;
 
-  return true;
+  return TRUE;
 }
 
 static int
@@ -252,14 +282,15 @@ b_out_symbol_cmp (a_ptr, b_ptr)
   return 0;
 }
 
-static boolean
+static bfd_boolean
 b_out_write_object_contents (abfd)
      bfd *abfd;
 {
   struct external_exec swapped_hdr;
+  bfd_size_type amt;
 
   if (! aout_32_make_sections (abfd))
-    return false;
+    return FALSE;
 
   exec_hdr (abfd)->a_info = BMAGIC;
 
@@ -282,10 +313,10 @@ b_out_write_object_contents (abfd)
 
   bout_swap_exec_header_out (abfd, exec_hdr (abfd), &swapped_hdr);
 
+  amt = EXEC_BYTES_SIZE;
   if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
-      || (bfd_write ((PTR) &swapped_hdr, 1, EXEC_BYTES_SIZE, abfd)
-         != EXEC_BYTES_SIZE))
-    return false;
+      || bfd_bwrite ((PTR) &swapped_hdr, amt, abfd) != amt)
+    return FALSE;
 
   /* Now write out reloc info, followed by syms and strings */
   if (bfd_get_symcount (abfd) != 0)
@@ -311,27 +342,31 @@ b_out_write_object_contents (abfd)
        }
 
       if (q > outsyms)
-       qsort (outsyms, q - outsyms, sizeof (asymbol*), b_out_symbol_cmp);
+       qsort (outsyms, (size_t) (q - outsyms), sizeof (asymbol*),
+              b_out_symbol_cmp);
 
       /* Back to your regularly scheduled program.  */
       if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*exec_hdr(abfd))), SEEK_SET)
          != 0)
-       return false;
+       return FALSE;
 
       if (! aout_32_write_syms (abfd))
-       return false;
+       return FALSE;
 
-      if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET) != 0)
-       return false;
+      if (bfd_seek (abfd, (file_ptr) (N_TROFF(*exec_hdr(abfd))), SEEK_SET)
+         != 0)
+       return FALSE;
 
-      if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd))) return false;
+      if (!b_out_squirt_out_relocs (abfd, obj_textsec (abfd)))
+       return FALSE;
       if (bfd_seek (abfd, (file_ptr) (N_DROFF(*exec_hdr(abfd))), SEEK_SET)
          != 0)
-       return false;
+       return FALSE;
 
-      if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd))) return false;
+      if (!b_out_squirt_out_relocs (abfd, obj_datasec (abfd)))
+       return FALSE;
     }
-  return true;
+  return TRUE;
 }
 \f
 /* Some reloc hackery.  */
@@ -372,7 +407,7 @@ calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section)
       BFD_ASSERT (IS_BALNAME (balsym->other));
       inst &= BALX_MASK;
       inst |= BALX;
-      bfd_put_32 (abfd, inst, (bfd_byte *) dst-4);
+      bfd_put_32 (abfd, (bfd_vma) inst, (bfd_byte *) dst-4);
       symbol = balsym;
       value = (symbol->symbol.value
               + output_addr (symbol->symbol.section));
@@ -380,7 +415,7 @@ calljx_callback (abfd, link_info, reloc_entry, src, dst, input_section)
 
   word += value + reloc_entry->addend;
 
-  bfd_put_32 (abfd, word, dst);
+  bfd_put_32 (abfd, (bfd_vma) word, dst);
   return bfd_reloc_ok;
 }
 
@@ -396,7 +431,7 @@ callj_callback (abfd, link_info, reloc_entry,  data, srcidx, dstidx,
      unsigned int srcidx;
      unsigned int dstidx;
      asection *input_section;
-     boolean shrinking;
+     bfd_boolean shrinking;
 {
   int word = bfd_get_32 (abfd, (bfd_byte *) data + srcidx);
   asymbol *symbol_in = *(reloc_entry->sym_ptr_ptr);
@@ -445,7 +480,7 @@ callj_callback (abfd, link_info, reloc_entry,  data, srcidx, dstidx,
                      - output_addr (input_section))
                     & BAL_MASK);
     }
-  bfd_put_32 (abfd, word, (bfd_byte *) data + dstidx);
+  bfd_put_32 (abfd, (bfd_vma) word, (bfd_byte *) data + dstidx);
   return bfd_reloc_ok;
 }
 
@@ -463,33 +498,33 @@ callj_callback (abfd, link_info, reloc_entry,  data, srcidx, dstidx,
 #define ALIGNER 10
 #define ALIGNDONE 11
 static reloc_howto_type howto_reloc_callj =
-HOWTO(CALLJ, 0, 2, 24, true, 0, complain_overflow_signed, 0,"callj", true, 0x00ffffff, 0x00ffffff,false);
+HOWTO(CALLJ, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE);
 static  reloc_howto_type howto_reloc_abs32 =
-HOWTO(ABS32, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"abs32", true, 0xffffffff,0xffffffff,false);
+HOWTO(ABS32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"abs32", TRUE, 0xffffffff,0xffffffff,FALSE);
 static reloc_howto_type howto_reloc_pcrel24 =
-HOWTO(PCREL24, 0, 2, 24, true, 0, complain_overflow_signed,0,"pcrel24", true, 0x00ffffff,0x00ffffff,false);
+HOWTO(PCREL24, 0, 2, 24, TRUE, 0, complain_overflow_signed,0,"pcrel24", TRUE, 0x00ffffff,0x00ffffff,FALSE);
 
 static reloc_howto_type howto_reloc_pcrel13 =
-HOWTO(PCREL13, 0, 2, 13, true, 0, complain_overflow_signed,0,"pcrel13", true, 0x00001fff,0x00001fff,false);
+HOWTO(PCREL13, 0, 2, 13, TRUE, 0, complain_overflow_signed,0,"pcrel13", TRUE, 0x00001fff,0x00001fff,FALSE);
 
 static reloc_howto_type howto_reloc_abs32codeshrunk =
-HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, true, 0, complain_overflow_signed, 0,"callx->callj", true, 0x00ffffff, 0x00ffffff,false);
+HOWTO(ABS32CODE_SHRUNK, 0, 2, 24, TRUE, 0, complain_overflow_signed, 0,"callx->callj", TRUE, 0x00ffffff, 0x00ffffff,FALSE);
 
 static  reloc_howto_type howto_reloc_abs32code =
-HOWTO(ABS32CODE, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"callx", true, 0xffffffff,0xffffffff,false);
+HOWTO(ABS32CODE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"callx", TRUE, 0xffffffff,0xffffffff,FALSE);
 
 static reloc_howto_type howto_align_table[] = {
-  HOWTO (ALIGNER, 0, 0x1, 0, false, 0, complain_overflow_dont, 0, "align16", false, 0, 0, false),
-  HOWTO (ALIGNER, 0, 0x3, 0, false, 0, complain_overflow_dont, 0, "align32", false, 0, 0, false),
-  HOWTO (ALIGNER, 0, 0x7, 0, false, 0, complain_overflow_dont, 0, "align64", false, 0, 0, false),
-  HOWTO (ALIGNER, 0, 0xf, 0, false, 0, complain_overflow_dont, 0, "align128", false, 0, 0, false),
+  HOWTO (ALIGNER, 0, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "align16", FALSE, 0, 0, FALSE),
+  HOWTO (ALIGNER, 0, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "align32", FALSE, 0, 0, FALSE),
+  HOWTO (ALIGNER, 0, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "align64", FALSE, 0, 0, FALSE),
+  HOWTO (ALIGNER, 0, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "align128", FALSE, 0, 0, FALSE),
 };
 
 static reloc_howto_type howto_done_align_table[] = {
-  HOWTO (ALIGNDONE, 0x1, 0x1, 0, false, 0, complain_overflow_dont, 0, "donealign16", false, 0, 0, false),
-  HOWTO (ALIGNDONE, 0x3, 0x3, 0, false, 0, complain_overflow_dont, 0, "donealign32", false, 0, 0, false),
-  HOWTO (ALIGNDONE, 0x7, 0x7, 0, false, 0, complain_overflow_dont, 0, "donealign64", false, 0, 0, false),
-  HOWTO (ALIGNDONE, 0xf, 0xf, 0, false, 0, complain_overflow_dont, 0, "donealign128", false, 0, 0, false),
+  HOWTO (ALIGNDONE, 0x1, 0x1, 0, FALSE, 0, complain_overflow_dont, 0, "donealign16", FALSE, 0, 0, FALSE),
+  HOWTO (ALIGNDONE, 0x3, 0x3, 0, FALSE, 0, complain_overflow_dont, 0, "donealign32", FALSE, 0, 0, FALSE),
+  HOWTO (ALIGNDONE, 0x7, 0x7, 0, FALSE, 0, complain_overflow_dont, 0, "donealign64", FALSE, 0, 0, FALSE),
+  HOWTO (ALIGNDONE, 0xf, 0xf, 0, FALSE, 0, complain_overflow_dont, 0, "donealign128", FALSE, 0, 0, FALSE),
 };
 
 static reloc_howto_type *
@@ -513,29 +548,29 @@ b_out_bfd_reloc_type_lookup (abfd, code)
 
 /* Allocate enough room for all the reloc entries, plus pointers to them all.  */
 
-static boolean
+static bfd_boolean
 b_out_slurp_reloc_table (abfd, asect, symbols)
      bfd *abfd;
      sec_ptr asect;
      asymbol **symbols;
 {
   register struct relocation_info *rptr;
-  unsigned int counter ;
-  arelent *cache_ptr ;
+  unsigned int counter;
+  arelent *cache_ptr;
   int extern_mask, pcrel_mask, callj_mask, length_shift;
   int incode_mask;
   int size_mask;
   bfd_vma prev_addr = 0;
   unsigned int count;
-  size_t  reloc_size;
+  bfd_size_type reloc_size, amt;
   struct relocation_info *relocs;
   arelent *reloc_cache;
 
   if (asect->relocation)
-    return true;
+    return TRUE;
 
   if (!aout_32_slurp_symbol_table (abfd))
-    return false;
+    return FALSE;
 
   if (asect == obj_datasec (abfd))
     {
@@ -556,31 +591,32 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
     }
 
   bfd_set_error (bfd_error_invalid_operation);
-  return false;
+  return FALSE;
 
  doit:
-  if (bfd_seek (abfd, (file_ptr) (asect->rel_filepos),  SEEK_SET) != 0)
-    return false;
+  if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0)
+    return FALSE;
   count = reloc_size / sizeof (struct relocation_info);
 
   relocs = (struct relocation_info *) bfd_malloc (reloc_size);
   if (!relocs && reloc_size != 0)
-    return false;
+    return FALSE;
 
-  reloc_cache = (arelent *) bfd_malloc ((count+1) * sizeof (arelent));
+  amt = ((bfd_size_type) count + 1) * sizeof (arelent);
+  reloc_cache = (arelent *) bfd_malloc (amt);
   if (!reloc_cache)
     {
       if (relocs != NULL)
-       free ((char*)relocs);
-      return false;
+       free (relocs);
+      return FALSE;
     }
 
-  if (bfd_read ((PTR) relocs, 1, reloc_size, abfd) != reloc_size)
+  if (bfd_bread ((PTR) relocs, reloc_size, abfd) != reloc_size)
     {
       free (reloc_cache);
       if (relocs != NULL)
        free (relocs);
-      return false;
+      return FALSE;
     }
 
   if (bfd_header_big_endian (abfd))
@@ -611,7 +647,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
     unsigned char *raw = (unsigned char *)rptr;
     unsigned int symnum;
 
-    cache_ptr->address = bfd_h_get_32 (abfd, raw + 0);
+    cache_ptr->address = H_GET_32 (abfd, raw + 0);
     cache_ptr->howto = 0;
 
     if (bfd_header_big_endian (abfd))
@@ -621,7 +657,7 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
 
     if (raw[7] & extern_mask)
       {
-       /* If this is set then the r_index is a index into the symbol table;
+       /* If this is set then the r_index is an index into the symbol table;
           if the bit is not set then r_index contains a section map.
           We either fill in the sym entry with a pointer to the symbol,
           or point to the correct section.  */
@@ -735,10 +771,10 @@ b_out_slurp_reloc_table (abfd, asect, symbols)
   asect->relocation = reloc_cache;
   asect->reloc_count = count;
 
-  return true;
+  return TRUE;
 }
 
-static boolean
+static bfd_boolean
 b_out_squirt_out_relocs (abfd, section)
      bfd *abfd;
      asection *section;
@@ -750,16 +786,17 @@ b_out_squirt_out_relocs (abfd, section)
   int len_1;
   unsigned int count = section->reloc_count;
   struct relocation_info *native, *natptr;
-  size_t natsize = count * sizeof (struct relocation_info);
-  int extern_mask, pcrel_mask,  len_2, callj_mask;
+  bfd_size_type natsize;
+  int extern_mask, pcrel_mask, len_2, callj_mask;
 
   if (count == 0)
-    return true;
+    return TRUE;
 
-  generic   = section->orelocation;
+  generic = section->orelocation;
+  natsize = (bfd_size_type) count * sizeof (struct relocation_info);
   native = ((struct relocation_info *) bfd_malloc (natsize));
   if (!native && natsize != 0)
-    return false;
+    return FALSE;
 
   if (bfd_header_big_endian (abfd))
     {
@@ -789,7 +826,7 @@ b_out_squirt_out_relocs (abfd, section)
       asymbol *sym = *(g->sym_ptr_ptr);
       asection *output_section = sym->section->output_section;
 
-      bfd_h_put_32(abfd, g->address, raw);
+      H_PUT_32 (abfd, g->address, raw);
       /* Find a type in the output format which matches the input howto -
         at the moment we assume input format == output format FIXME!!  */
       r_idx = 0;
@@ -861,15 +898,15 @@ b_out_squirt_out_relocs (abfd, section)
        raw[7] |= extern_mask;
     }
 
-  if (bfd_write ((PTR) native, 1, natsize, abfd) != natsize)
+  if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize)
     {
       free ((PTR)native);
-      return false;
+      return FALSE;
     }
 
   free ((PTR)native);
 
-  return true;
+  return TRUE;
 }
 
 /* This is stupid.  This function should be a boolean predicate.  */
@@ -942,19 +979,19 @@ b_out_get_reloc_upper_bound (abfd, asect)
 }
 
 \f
-static boolean
+static bfd_boolean
 b_out_set_section_contents (abfd, section, location, offset, count)
      bfd *abfd;
      asection *section;
-     PTR location;
+     const PTR location;
      file_ptr offset;
      bfd_size_type count;
 {
-  if (abfd->output_has_begun == false)
+  if (! abfd->output_has_begun)
     {
       /* Set by bfd.c handler.  */
       if (! aout_32_make_sections (abfd))
-       return false;
+       return FALSE;
 
       obj_textsec (abfd)->filepos = sizeof (struct internal_exec);
       obj_datasec(abfd)->filepos = obj_textsec(abfd)->filepos
@@ -963,15 +1000,15 @@ b_out_set_section_contents (abfd, section, location, offset, count)
 
   /* Regardless, once we know what we're doing, we might as well get going.  */
   if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0)
-    return false;
+    return FALSE;
 
-  if (count != 0)
-    return (bfd_write ((PTR)location, 1, count, abfd) == count) ? true : false;
+  if (count == 0)
+    return TRUE;
 
-  return true;
+  return bfd_bwrite ((PTR) location, count, abfd) == count;
 }
 
-static boolean
+static bfd_boolean
 b_out_set_arch_mach (abfd, arch, machine)
      bfd *abfd;
      enum bfd_architecture arch;
@@ -980,7 +1017,7 @@ b_out_set_arch_mach (abfd, arch, machine)
   bfd_default_set_arch_mach(abfd, arch, machine);
 
   if (arch == bfd_arch_unknown)        /* Unknown machine arch is OK.  */
-    return true;
+    return TRUE;
 
   if (arch == bfd_arch_i960)   /* i960 default is OK.  */
     switch (machine)
@@ -994,18 +1031,18 @@ b_out_set_arch_mach (abfd, arch, machine)
       case bfd_mach_i960_jx:
       case bfd_mach_i960_hx:
       case 0:
-       return true;
+       return TRUE;
       default:
-       return false;
+       return FALSE;
       }
 
-  return false;
+  return FALSE;
 }
 
 static int
 b_out_sizeof_headers (ignore_abfd, ignore)
      bfd *ignore_abfd ATTRIBUTE_UNUSED;
-     boolean ignore ATTRIBUTE_UNUSED;
+     bfd_boolean ignore ATTRIBUTE_UNUSED;
 {
   return sizeof (struct internal_exec);
 }
@@ -1034,7 +1071,7 @@ get_value (reloc, link_info, input_section)
         generic symbols.  */
       h = bfd_wrapped_link_hash_lookup (input_section->owner, link_info,
                                        bfd_asymbol_name (symbol),
-                                       false, false, true);
+                                       FALSE, FALSE, TRUE);
       if (h != (struct bfd_link_hash_entry *) NULL
          && (h->type == bfd_link_hash_defined
              || h->type == bfd_link_hash_defweak))
@@ -1047,7 +1084,7 @@ get_value (reloc, link_info, input_section)
          if (! ((*link_info->callbacks->undefined_symbol)
                 (link_info, bfd_asymbol_name (symbol),
                  input_section->owner, input_section, reloc->address,
-                 true)))
+                 TRUE)))
            abort ();
          value = 0;
        }
@@ -1151,7 +1188,7 @@ aligncode (abfd, input_section, r, shrink)
   bfd_vma gap;
   bfd_vma old_end;
   bfd_vma new_end;
-  int shrink_delta;
+  unsigned int shrink_delta;
   int size = r->howto->size;
 
   /* Reduce the size of the alignment so that it's still aligned but
@@ -1186,33 +1223,33 @@ aligncode (abfd, input_section, r, shrink)
   return shrink;
 }
 
-static boolean
+static bfd_boolean
 b_out_bfd_relax_section (abfd, i, link_info, again)
      bfd *abfd;
      asection *i;
      struct bfd_link_info *link_info;
-     boolean *again;
+     bfd_boolean *again;
 {
   /* Get enough memory to hold the stuff.  */
   bfd *input_bfd = i->owner;
   asection *input_section = i;
-  int shrink = 0 ;
+  unsigned int shrink = 0 ;
   arelent **reloc_vector = NULL;
-  long reloc_size = bfd_get_reloc_upper_bound(input_bfd,
-                                             input_section);
+  long reloc_size = bfd_get_reloc_upper_bound (input_bfd,
+                                              input_section);
 
   if (reloc_size < 0)
-    return false;
+    return FALSE;
 
   /* We only run this relaxation once.  It might work to run it
      multiple times, but it hasn't been tested.  */
-  *again = false;
+  *again = FALSE;
 
   if (reloc_size)
     {
       long reloc_count;
 
-      reloc_vector = (arelent **) bfd_malloc (reloc_size);
+      reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
       if (reloc_vector == NULL && reloc_size != 0)
        goto error_return;
 
@@ -1242,7 +1279,7 @@ b_out_bfd_relax_section (abfd, i, link_info, again)
                                      link_info);
                  break;
                case ABS32CODE_SHRUNK:
-                 shrink+=4;
+                 shrink += 4;
                  break;
                }
            }
@@ -1252,21 +1289,21 @@ b_out_bfd_relax_section (abfd, i, link_info, again)
 
   if (reloc_vector != NULL)
     free (reloc_vector);
-  return true;
+  return TRUE;
  error_return:
   if (reloc_vector != NULL)
     free (reloc_vector);
-  return false;
+  return FALSE;
 }
 
 static bfd_byte *
 b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
-                                         data, relocateable, symbols)
+                                         data, relocatable, symbols)
      bfd *output_bfd;
      struct bfd_link_info *link_info;
      struct bfd_link_order *link_order;
      bfd_byte *data;
-     boolean relocateable;
+     bfd_boolean relocatable;
      asymbol **symbols;
 {
   /* Get enough memory to hold the stuff.  */
@@ -1280,25 +1317,25 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
   if (reloc_size < 0)
     goto error_return;
 
-  /* If producing relocateable output, don't bother to relax.  */
-  if (relocateable)
+  /* If producing relocatable output, don't bother to relax.  */
+  if (relocatable)
     return bfd_generic_get_relocated_section_contents (output_bfd, link_info,
                                                       link_order,
-                                                      data, relocateable,
+                                                      data, relocatable,
                                                       symbols);
 
-  reloc_vector = (arelent **) bfd_malloc (reloc_size);
+  reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
   if (reloc_vector == NULL && reloc_size != 0)
     goto error_return;
 
   input_section->reloc_done = 1;
 
   /* Read in the section.  */
-  BFD_ASSERT (true == bfd_get_section_contents (input_bfd,
-                                               input_section,
-                                               data,
-                                               0,
-                                               input_section->_raw_size));
+  BFD_ASSERT (bfd_get_section_contents (input_bfd,
+                                       input_section,
+                                       data,
+                                       (bfd_vma) 0,
+                                       input_section->_raw_size));
 
   reloc_count = bfd_canonicalize_reloc (input_bfd,
                                        input_section,
@@ -1360,13 +1397,14 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
                case CALLJ:
                  callj_callback (input_bfd, link_info, reloc, data,
                                  src_address, dst_address, input_section,
-                                 false);
+                                 FALSE);
                  src_address += 4;
                  dst_address += 4;
                  break;
                case ALIGNDONE:
                  BFD_ASSERT (reloc->addend >= src_address);
-                 BFD_ASSERT (reloc->addend <= input_section->_raw_size);
+                 BFD_ASSERT ((bfd_vma) reloc->addend
+                             <= input_section->_raw_size);
                  src_address = reloc->addend;
                  dst_address = ((dst_address + reloc->howto->size)
                                 & ~reloc->howto->size);
@@ -1376,7 +1414,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
                     callj will reach, so do the right thing.  */
                  callj_callback (input_bfd, link_info, reloc, data,
                                  src_address + 4, dst_address, input_section,
-                                 true);
+                                 TRUE);
                  dst_address += 4;
                  src_address += 8;
                  break;
@@ -1394,7 +1432,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
                                + reloc->addend)
                               & BAL_MASK));
 
-                   bfd_put_32 (input_bfd, word, data + dst_address);
+                   bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
                    dst_address += 4;
                    src_address += 4;
 
@@ -1414,7 +1452,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
                                - output_addr (input_section))
                               & PCREL13_MASK));
 
-                   bfd_put_32 (input_bfd, word, data + dst_address);
+                   bfd_put_32 (input_bfd, (bfd_vma) word, data + dst_address);
                    dst_address += 4;
                    src_address += 4;
                  }
@@ -1442,11 +1480,14 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order,
 #define aout_32_close_and_cleanup aout_32_bfd_free_cached_info
 
 #define b_out_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
+#define b_out_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
 #define b_out_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#define b_out_bfd_link_just_syms _bfd_generic_link_just_syms
 #define b_out_bfd_final_link _bfd_generic_final_link
 #define b_out_bfd_link_split_section  _bfd_generic_link_split_section
 #define b_out_bfd_gc_sections  bfd_generic_gc_sections
 #define b_out_bfd_merge_sections  bfd_generic_merge_sections
+#define b_out_bfd_discard_group bfd_generic_discard_group
 
 #define aout_32_get_section_contents_in_window \
   _bfd_generic_get_section_contents_in_window
This page took 0.036084 seconds and 4 git commands to generate.