* coff-h8300.c (h8300_reloc16_extra_cases): Correct off by one
[deliverable/binutils-gdb.git] / bfd / coffswap.h
index 75bbf32221cd48a3d42f0d6b1f669bf842312928..b7ec96108b1be7d37e2cbb349c786365dd10178a 100644 (file)
@@ -1,5 +1,5 @@
 /* Generic COFF swapping routines, for BFD.
-   Copyright 1990, 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
+   Copyright 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -397,6 +397,13 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
          in->x_scn.x_scnlen = GET_SCN_SCNLEN(abfd, ext);
          in->x_scn.x_nreloc = GET_SCN_NRELOC(abfd, ext);
          in->x_scn.x_nlinno = GET_SCN_NLINNO(abfd, ext);
+
+         /* PE defines some extra fields; we zero them out for
+             safety.  */
+         in->x_scn.x_checksum = 0;
+         in->x_scn.x_associated = 0;
+         in->x_scn.x_comdat = 0;
+
          return;
        }
       break;
@@ -621,6 +628,7 @@ coff_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
   aouthdr_int->o_algntext = bfd_h_get_16(abfd, aouthdr_ext->o_algntext);
   aouthdr_int->o_algndata = bfd_h_get_16(abfd, aouthdr_ext->o_algndata);
   aouthdr_int->o_modtype = bfd_h_get_16(abfd, aouthdr_ext->o_modtype);
+  aouthdr_int->o_cputype = bfd_h_get_16(abfd, aouthdr_ext->o_cputype);
   aouthdr_int->o_maxstack = bfd_h_get_32(abfd, aouthdr_ext->o_maxstack);
   aouthdr_int->o_maxdata = bfd_h_get_32(abfd, aouthdr_ext->o_maxdata);
 #endif
@@ -678,9 +686,9 @@ coff_swap_aouthdr_out (abfd, in, out)
   bfd_h_put_16 (abfd, aouthdr_in->o_algntext, aouthdr_out->o_algntext);
   bfd_h_put_16 (abfd, aouthdr_in->o_algndata, aouthdr_out->o_algndata);
   bfd_h_put_16 (abfd, aouthdr_in->o_modtype, aouthdr_out->o_modtype);
+  bfd_h_put_16 (abfd, aouthdr_in->o_cputype, aouthdr_out->o_cputype);
   bfd_h_put_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
   bfd_h_put_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
-  memset (aouthdr_out->o_resv1, 0, sizeof aouthdr_out->o_resv1);
   memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2);
 #endif
 
@@ -779,9 +787,13 @@ coff_swap_scnhdr_out (abfd, in, out)
     PUTHALF(abfd, scnhdr_int->s_nlnno, (bfd_byte *) scnhdr_ext->s_nlnno);
   else
     {
-      (*_bfd_error_handler) ("%s: line number overflow: 0x%lx > 0xffff",
+      char buf[sizeof (scnhdr_int->s_name) + 1];
+
+      memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
+      buf[sizeof (scnhdr_int->s_name)] = '\0';
+      (*_bfd_error_handler) ("%s: %s: line number overflow: 0x%lx > 0xffff",
                             bfd_get_filename (abfd),
-                            scnhdr_int->s_nlnno);
+                            buf, scnhdr_int->s_nlnno);
       bfd_set_error (bfd_error_file_truncated);
       PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nlnno);
       ret = 0;
@@ -790,9 +802,13 @@ coff_swap_scnhdr_out (abfd, in, out)
     PUTHALF(abfd, scnhdr_int->s_nreloc, (bfd_byte *) scnhdr_ext->s_nreloc);
   else
     {
-      (*_bfd_error_handler) ("%s: reloc overflow: 0x%lx > 0xffff",
+      char buf[sizeof (scnhdr_int->s_name) + 1];
+
+      memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
+      buf[sizeof (scnhdr_int->s_name)] = '\0';
+      (*_bfd_error_handler) ("%s: %s: reloc overflow: 0x%lx > 0xffff",
                             bfd_get_filename (abfd),
-                            scnhdr_int->s_nreloc);
+                            buf, scnhdr_int->s_nreloc);
       bfd_set_error (bfd_error_file_truncated);
       PUTHALF (abfd, 0xffff, (bfd_byte *) scnhdr_ext->s_nreloc);
       ret = 0;
This page took 0.023666 seconds and 4 git commands to generate.