]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Tidy pe flag in coff_data
authorAlan Modra <amodra@gmail.com>
Fri, 6 Jan 2023 09:04:15 +0000 (19:34 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 6 Jan 2023 10:36:15 +0000 (21:06 +1030)
Make it a bool, use obj_pe accessor everywhere.

bfd/coff-arm.c
bfd/coff-mcore.c
bfd/coffgen.c
bfd/cofflink.c
bfd/coffswap.h
bfd/libcoff-in.h
bfd/libcoff.h
bfd/peicode.h
ld/emultempl/beos.em
ld/emultempl/pe.em
ld/emultempl/pep.em

index c0b2b04b26a63cc22c3f065fd127915629e2f8b0..694ae8daa08d278c6ed6bb0fd00c9c6942afe0f7 100644 (file)
@@ -953,7 +953,7 @@ arm_emit_base_file_entry (struct bfd_link_info *info,
                  + input_section->output_offset
                  + input_section->output_section->vma);
 
-  if (coff_data (output_bfd)->pe)
+  if (obj_pe (output_bfd))
      addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
   if (fwrite (&addr, sizeof (addr), 1, (FILE *) info->base_file) == 1)
     return true;
index 561333d596b5d9e2894454b9d99ecbb68fcf0d39..e360d5efe140bcb492fe5d11dcdce14d90dbf4f4 100644 (file)
@@ -220,7 +220,7 @@ mcore_emit_base_file_entry (struct bfd_link_info *info,
                 + input_section->output_offset
                 + input_section->output_section->vma;
 
-  if (coff_data (output_bfd)->pe)
+  if (obj_pe (output_bfd))
      addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
 
   if (fwrite (&addr, sizeof (addr), 1, (FILE *) info->base_file) == 1)
index 74636a9e3051a8151f32c99b457dee69ae3f87e6..f21cf2ca523c56110cd295acd232d1eba569bc45 100644 (file)
@@ -1826,8 +1826,7 @@ coff_get_normalized_symtab (bfd *abfd)
              /* Ordinary short filename, put into memory anyway.  The
                 Microsoft PE tools sometimes store a filename in
                 multiple AUX entries.  */
-             if (internal_ptr->u.syment.n_numaux > 1
-                 && coff_data (abfd)->pe)
+             if (internal_ptr->u.syment.n_numaux > 1 && obj_pe (abfd))
                internal_ptr->u.syment._n._n_n._n_offset =
                  ((uintptr_t)
                   copy_name (abfd,
@@ -1842,7 +1841,7 @@ coff_get_normalized_symtab (bfd *abfd)
            }
 
          /* Normalize other strings available in C_FILE aux entries.  */
-         if (!coff_data (abfd)->pe)
+         if (!obj_pe (abfd))
            for (int numaux = 1; numaux < internal_ptr->u.syment.n_numaux; numaux++)
              {
                aux = internal_ptr + numaux + 1;
index d6ccae4ffe20e0f572b63bd2cbc21599603a30b4..07226882e0d1d97448c858e2aef93d83df8e35b3 100644 (file)
@@ -1168,7 +1168,7 @@ _bfd_coff_final_link (bfd *abfd,
 static char *
 dores_com (char *ptr, bfd *output_bfd, int heap)
 {
-  if (coff_data(output_bfd)->pe)
+  if (obj_pe (output_bfd))
     {
       int val = strtoul (ptr, &ptr, 0);
 
@@ -1400,7 +1400,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
   output_index = syment_base;
   outsym = flaginfo->outsyms;
 
-  if (coff_data (output_bfd)->pe
+  if (obj_pe (output_bfd)
       && ! process_embedded_commands (output_bfd, flaginfo->info, input_bfd))
     return false;
 
@@ -3057,7 +3057,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
                           - input_section->vma
                           + input_section->output_offset
                           + input_section->output_section->vma);
-             if (coff_data (output_bfd)->pe)
+             if (obj_pe (output_bfd))
                addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
              if (fwrite (&addr, 1, sizeof (bfd_vma), (FILE *) info->base_file)
                  != sizeof (bfd_vma))
index e809deaf0ef760fdfadc271d276759923588583d..03f52bd048670dafc20e85fd9ca9aa2a8d5477d7 100644 (file)
@@ -426,7 +426,7 @@ coff_swap_aux_in (bfd *abfd,
 #if FILNMLEN != E_FILNMLEN
 #error we need to cope with truncating or extending FILNMLEN
 #else
-         if (numaux > 1 && coff_data (abfd)->pe)
+         if (numaux > 1 && obj_pe (abfd))
            {
              if (indx == 0)
                memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname,
index d27e5d4394f3fe57b9e5068a13b47a8194878396..a0d286d37f4a960ffc5c63dae13156df0ef9e9a7 100644 (file)
@@ -101,7 +101,7 @@ typedef struct coff_tdata
   bool go32;
 
   /* Is this a PE format coff file?  */
-  int pe;
+  bool pe;
 
   /* Copy of some of the f_flags bits in the COFF filehdr structure,
      used by ARM code.  */
index f03330fcfa06f987add36365ded350a8f3476925..c2c1f4add3aaf9e8c7c5a0a2c2e683141bb7bf6f 100644 (file)
@@ -105,7 +105,7 @@ typedef struct coff_tdata
   bool go32;
 
   /* Is this a PE format coff file?  */
-  int pe;
+  bool pe;
 
   /* Copy of some of the f_flags bits in the COFF filehdr structure,
      used by ARM code.  */
index cc5a54e18439af62a2091522040d1747cbbbfe61..06642c3db5a11ca7f7d08fd4f9661c32cd18a543 100644 (file)
@@ -1090,7 +1090,7 @@ pe_ILF_build_a_bfd (bfd *     abfd,
   if (bfd_coff_mkobject_hook (abfd, (void *) & internal_f, NULL) == NULL)
     goto error_return;
 
-  coff_data (abfd)->pe = 1;
+  obj_pe (abfd) = true;
 #ifdef THUMBPEMAGIC
   if (vars.magic == THUMBPEMAGIC)
     /* Stop some linker warnings about thumb code not supporting interworking.  */
index 1f3b67b6372a3d5f25e5abccd11d2d91fde3b5e3..521d92797ecb0edcdf4e8bb63d01c2001a5067c7 100644 (file)
@@ -379,7 +379,7 @@ gld${EMULATION_NAME}_after_open (void)
   /* Pass the wacky PE command line options into the output bfd.
      FIXME: This should be done via a function, rather than by
      including an internal BFD header.  */
-  if (!coff_data(link_info.output_bfd)->pe)
+  if (!obj_pe (link_info.output_bfd))
     {
       einfo (_("%F%P: PE operations on non PE file\n"));
     }
index d201a97dac18731b61ec8d149a01e80cc3434e6d..bce1d1b9052bd17fcaaacd2fa35b363245ca7e4e 100644 (file)
@@ -1515,7 +1515,7 @@ gld${EMULATION_NAME}_after_open (void)
 
   if (bfd_get_flavour (link_info.output_bfd) != bfd_target_coff_flavour
       || coff_data (link_info.output_bfd) == NULL
-      || coff_data (link_info.output_bfd)->pe == 0)
+      || !obj_pe (link_info.output_bfd))
     einfo (_("%F%P: cannot perform PE operations on non PE output file '%pB'\n"),
           link_info.output_bfd);
 
index d61cab86d75791a79f0016a65a574f59c76ce178..69b1c3ec79bdb5cc93b958550472ab81ecfe7b98 100644 (file)
@@ -1519,7 +1519,7 @@ gld${EMULATION_NAME}_after_open (void)
 
   if (bfd_get_flavour (link_info.output_bfd) != bfd_target_coff_flavour
       || coff_data (link_info.output_bfd) == NULL
-      || coff_data (link_info.output_bfd)->pe == 0)
+      || !obj_pe (link_info.output_bfd))
     einfo (_("%F%P: cannot perform PE operations on non PE output file '%pB'\n"),
           link_info.output_bfd);