Make the assembler generate an error if there is an attempt to define a section with...
[deliverable/binutils-gdb.git] / bfd / coffswap.h
index 8e1911f54c1059df0966c06546a1594d1d0e6ebd..c4ac067a62f32848f5d32dfa1da80bbac575de5b 100644 (file)
@@ -1,7 +1,5 @@
 /* Generic COFF swapping routines, for BFD.
 /* Generic COFF swapping routines, for BFD.
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
-   2001, 2002, 2005, 2007
-   Free Software Foundation, Inc.
+   Copyright (C) 1990-2020 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -266,9 +264,6 @@ coff_swap_filehdr_in (bfd * abfd, void * src, void * dst)
   filehdr_dst->f_nsyms  = H_GET_32 (abfd, filehdr_src->f_nsyms);
   filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr);
   filehdr_dst->f_flags  = H_GET_16 (abfd, filehdr_src->f_flags);
   filehdr_dst->f_nsyms  = H_GET_32 (abfd, filehdr_src->f_nsyms);
   filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr);
   filehdr_dst->f_flags  = H_GET_16 (abfd, filehdr_src->f_flags);
-#ifdef TIC80_TARGET_ID
-  filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id);
-#endif
 
 #ifdef COFF_ADJUST_FILEHDR_IN_POST
   COFF_ADJUST_FILEHDR_IN_POST (abfd, src, dst);
 
 #ifdef COFF_ADJUST_FILEHDR_IN_POST
   COFF_ADJUST_FILEHDR_IN_POST (abfd, src, dst);
@@ -291,9 +286,6 @@ coff_swap_filehdr_out (bfd *abfd, void * in, void * out)
   H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
   H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
   H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
   H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
   H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
   H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
-#ifdef TIC80_TARGET_ID
-  H_PUT_16 (abfd, filehdr_in->f_target_id, filehdr_out->f_target_id);
-#endif
 
 #ifdef COFF_ADJUST_FILEHDR_OUT_POST
   COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
 
 #ifdef COFF_ADJUST_FILEHDR_OUT_POST
   COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
@@ -324,7 +316,7 @@ coff_swap_sym_in (bfd * abfd, void * ext1, void * in1)
     }
 
   in->n_value = H_GET_32 (abfd, ext->e_value);
     }
 
   in->n_value = H_GET_32 (abfd, ext->e_value);
-  in->n_scnum = H_GET_16 (abfd, ext->e_scnum);
+  in->n_scnum = (short) H_GET_16 (abfd, ext->e_scnum);
   if (sizeof (ext->e_type) == 2)
     in->n_type = H_GET_16 (abfd, ext->e_type);
   else
   if (sizeof (ext->e_type) == 2)
     in->n_type = H_GET_16 (abfd, ext->e_type);
   else
@@ -382,7 +374,7 @@ static void
 coff_swap_aux_in (bfd *abfd,
                  void * ext1,
                  int type,
 coff_swap_aux_in (bfd *abfd,
                  void * ext1,
                  int type,
-                 int class,
+                 int in_class,
                  int indx,
                  int numaux,
                  void * in1)
                  int indx,
                  int numaux,
                  void * in1)
@@ -391,10 +383,10 @@ coff_swap_aux_in (bfd *abfd,
   union internal_auxent *in = (union internal_auxent *) in1;
 
 #ifdef COFF_ADJUST_AUX_IN_PRE
   union internal_auxent *in = (union internal_auxent *) in1;
 
 #ifdef COFF_ADJUST_AUX_IN_PRE
-  COFF_ADJUST_AUX_IN_PRE (abfd, ext1, type, class, indx, numaux, in1);
+  COFF_ADJUST_AUX_IN_PRE (abfd, ext1, type, in_class, indx, numaux, in1);
 #endif
 
 #endif
 
-  switch (class)
+  switch (in_class)
     {
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0)
     {
     case C_FILE:
       if (ext->x_file.x_fname[0] == 0)
@@ -431,7 +423,7 @@ coff_swap_aux_in (bfd *abfd,
          in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext);
 
          /* PE defines some extra fields; we zero them out for
          in->x_scn.x_nlinno = GET_SCN_NLINNO (abfd, ext);
 
          /* PE defines some extra fields; we zero them out for
-             safety.  */
+            safety.  */
          in->x_scn.x_checksum = 0;
          in->x_scn.x_associated = 0;
          in->x_scn.x_comdat = 0;
          in->x_scn.x_checksum = 0;
          in->x_scn.x_associated = 0;
          in->x_scn.x_comdat = 0;
@@ -446,7 +438,8 @@ coff_swap_aux_in (bfd *abfd,
   in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx);
 #endif
 
   in->x_sym.x_tvndx = H_GET_16 (abfd, ext->x_sym.x_tvndx);
 #endif
 
-  if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
+  if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
+      || ISTAG (in_class))
     {
       in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext);
       in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext);
     {
       in->x_sym.x_fcnary.x_fcn.x_lnnoptr = GET_FCN_LNNOPTR (abfd, ext);
       in->x_sym.x_fcnary.x_fcn.x_endndx.l = GET_FCN_ENDNDX (abfd, ext);
@@ -477,7 +470,7 @@ coff_swap_aux_in (bfd *abfd,
  end: ;
 
 #ifdef COFF_ADJUST_AUX_IN_POST
  end: ;
 
 #ifdef COFF_ADJUST_AUX_IN_POST
-  COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, class, indx, numaux, in1);
+  COFF_ADJUST_AUX_IN_POST (abfd, ext1, type, in_class, indx, numaux, in1);
 #endif
 }
 
 #endif
 }
 
@@ -485,7 +478,7 @@ static unsigned int
 coff_swap_aux_out (bfd * abfd,
                   void * inp,
                   int type,
 coff_swap_aux_out (bfd * abfd,
                   void * inp,
                   int type,
-                  int class,
+                  int in_class,
                   int indx ATTRIBUTE_UNUSED,
                   int numaux ATTRIBUTE_UNUSED,
                   void * extp)
                   int indx ATTRIBUTE_UNUSED,
                   int numaux ATTRIBUTE_UNUSED,
                   void * extp)
@@ -494,12 +487,12 @@ coff_swap_aux_out (bfd * abfd,
   AUXENT *ext = (AUXENT *) extp;
 
 #ifdef COFF_ADJUST_AUX_OUT_PRE
   AUXENT *ext = (AUXENT *) extp;
 
 #ifdef COFF_ADJUST_AUX_OUT_PRE
-  COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, class, indx, numaux, extp);
+  COFF_ADJUST_AUX_OUT_PRE (abfd, inp, type, in_class, indx, numaux, extp);
 #endif
 
   memset (ext, 0, AUXESZ);
 
 #endif
 
   memset (ext, 0, AUXESZ);
 
-  switch (class)
+  switch (in_class)
     {
     case C_FILE:
       if (in->x_file.x_fname[0] == 0)
     {
     case C_FILE:
       if (in->x_file.x_fname[0] == 0)
@@ -537,7 +530,8 @@ coff_swap_aux_out (bfd * abfd,
   H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx);
 #endif
 
   H_PUT_16 (abfd, in->x_sym.x_tvndx, ext->x_sym.x_tvndx);
 #endif
 
-  if (class == C_BLOCK || class == C_FCN || ISFCN (type) || ISTAG (class))
+  if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
+      || ISTAG (in_class))
     {
       PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
       PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
     {
       PUT_FCN_LNNOPTR (abfd, in->x_sym.x_fcnary.x_fcn.x_lnnoptr, ext);
       PUT_FCN_ENDNDX (abfd, in->x_sym.x_fcnary.x_fcn.x_endndx.l, ext);
@@ -567,7 +561,7 @@ coff_swap_aux_out (bfd * abfd,
 
  end:
 #ifdef COFF_ADJUST_AUX_OUT_POST
 
  end:
 #ifdef COFF_ADJUST_AUX_OUT_POST
-  COFF_ADJUST_AUX_OUT_POST (abfd, inp, type, class, indx, numaux, extp);
+  COFF_ADJUST_AUX_OUT_POST (abfd, inp, type, in_class, indx, numaux, extp);
 #endif
   return AUXESZ;
 }
 #endif
   return AUXESZ;
 }
@@ -618,17 +612,6 @@ coff_swap_aouthdr_in (bfd * abfd, void * aouthdr_ext1, void * aouthdr_int1)
   aouthdr_int->data_start =
     GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
 
   aouthdr_int->data_start =
     GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
 
-#ifdef I960
-  aouthdr_int->tagentries = H_GET_32 (abfd, aouthdr_ext->tagentries);
-#endif
-
-#ifdef APOLLO_M68
-  H_PUT_32 (abfd, aouthdr_int->o_inlib, aouthdr_ext->o_inlib);
-  H_PUT_32 (abfd, aouthdr_int->o_sri, aouthdr_ext->o_sri);
-  H_PUT_32 (abfd, aouthdr_int->vid[0], aouthdr_ext->vid);
-  H_PUT_32 (abfd, aouthdr_int->vid[1], aouthdr_ext->vid + 4);
-#endif
-
 #ifdef RS6000COFF_C
 #ifdef XCOFF64
   aouthdr_int->o_toc = H_GET_64 (abfd, aouthdr_ext->o_toc);
 #ifdef RS6000COFF_C
 #ifdef XCOFF64
   aouthdr_int->o_toc = H_GET_64 (abfd, aouthdr_ext->o_toc);
@@ -689,10 +672,6 @@ coff_swap_aouthdr_out (bfd * abfd, void * in, void * out)
   PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
                          aouthdr_out->data_start);
 
   PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
                          aouthdr_out->data_start);
 
-#ifdef I960
-  H_PUT_32 (abfd, aouthdr_in->tagentries, aouthdr_out->tagentries);
-#endif
-
 #ifdef RS6000COFF_C
 #ifdef XCOFF64
   H_PUT_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
 #ifdef RS6000COFF_C
 #ifdef XCOFF64
   H_PUT_64 (abfd, aouthdr_in->o_toc, aouthdr_out->o_toc);
@@ -767,9 +746,6 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
   scnhdr_int->s_flags = GET_SCNHDR_FLAGS (abfd, scnhdr_ext->s_flags);
   scnhdr_int->s_nreloc = GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc);
   scnhdr_int->s_nlnno = GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno);
   scnhdr_int->s_flags = GET_SCNHDR_FLAGS (abfd, scnhdr_ext->s_flags);
   scnhdr_int->s_nreloc = GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc);
   scnhdr_int->s_nlnno = GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno);
-#ifdef I960
-  scnhdr_int->s_align = GET_SCNHDR_ALIGN (abfd, scnhdr_ext->s_align);
-#endif
 #ifdef COFF_ADJUST_SCNHDR_IN_POST
   COFF_ADJUST_SCNHDR_IN_POST (abfd, ext, in);
 #endif
 #ifdef COFF_ADJUST_SCNHDR_IN_POST
   COFF_ADJUST_SCNHDR_IN_POST (abfd, ext, in);
 #endif
@@ -794,10 +770,6 @@ coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
   PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr);
   PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr);
   PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
   PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr);
   PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr);
   PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
-#if defined(M88)
-  H_PUT_32 (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
-  H_PUT_32 (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
-#else
   if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO)
     PUT_SCNHDR_NLNNO (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
   else
   if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO)
     PUT_SCNHDR_NLNNO (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
   else
@@ -806,10 +778,10 @@ coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
 
       memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
       buf[sizeof (scnhdr_int->s_name)] = '\0';
 
       memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
       buf[sizeof (scnhdr_int->s_name)] = '\0';
-      (*_bfd_error_handler)
-       (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
-        bfd_get_filename (abfd),
-        buf, scnhdr_int->s_nlnno);
+      _bfd_error_handler
+       /* xgettext:c-format */
+       (_("%pB: warning: %s: line number overflow: 0x%lx > 0xffff"),
+        abfd, buf, scnhdr_int->s_nlnno);
       PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno);
     }
 
       PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno);
     }
 
@@ -821,18 +793,14 @@ coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
 
       memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
       buf[sizeof (scnhdr_int->s_name)] = '\0';
 
       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),
-                            buf, scnhdr_int->s_nreloc);
+      /* xgettext:c-format */
+      _bfd_error_handler (_("%pB: %s: reloc overflow: 0x%lx > 0xffff"),
+                         abfd, buf, scnhdr_int->s_nreloc);
       bfd_set_error (bfd_error_file_truncated);
       PUT_SCNHDR_NRELOC (abfd, 0xffff, scnhdr_ext->s_nreloc);
       ret = 0;
     }
       bfd_set_error (bfd_error_file_truncated);
       PUT_SCNHDR_NRELOC (abfd, 0xffff, scnhdr_ext->s_nreloc);
       ret = 0;
     }
-#endif
 
 
-#ifdef I960
-  PUT_SCNHDR_ALIGN (abfd, scnhdr_int->s_align, scnhdr_ext->s_align);
-#endif
 #ifdef COFF_ADJUST_SCNHDR_OUT_POST
   COFF_ADJUST_SCNHDR_OUT_POST (abfd, in, out);
 #endif
 #ifdef COFF_ADJUST_SCNHDR_OUT_POST
   COFF_ADJUST_SCNHDR_OUT_POST (abfd, in, out);
 #endif
This page took 0.026825 seconds and 4 git commands to generate.