Skip to content

Commit 10df41b

Browse files
committed
Tidy pe flag in coff_data
Make it a bool, use obj_pe accessor everywhere.
1 parent 22a95e1 commit 10df41b

File tree

11 files changed

+14
-15
lines changed

11 files changed

+14
-15
lines changed

bfd/coff-arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ arm_emit_base_file_entry (struct bfd_link_info *info,
953953
+ input_section->output_offset
954954
+ input_section->output_section->vma);
955955

956-
if (coff_data (output_bfd)->pe)
956+
if (obj_pe (output_bfd))
957957
addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
958958
if (fwrite (&addr, sizeof (addr), 1, (FILE *) info->base_file) == 1)
959959
return true;

bfd/coff-mcore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ mcore_emit_base_file_entry (struct bfd_link_info *info,
220220
+ input_section->output_offset
221221
+ input_section->output_section->vma;
222222

223-
if (coff_data (output_bfd)->pe)
223+
if (obj_pe (output_bfd))
224224
addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
225225

226226
if (fwrite (&addr, sizeof (addr), 1, (FILE *) info->base_file) == 1)

bfd/coffgen.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,8 +1826,7 @@ coff_get_normalized_symtab (bfd *abfd)
18261826
/* Ordinary short filename, put into memory anyway. The
18271827
Microsoft PE tools sometimes store a filename in
18281828
multiple AUX entries. */
1829-
if (internal_ptr->u.syment.n_numaux > 1
1830-
&& coff_data (abfd)->pe)
1829+
if (internal_ptr->u.syment.n_numaux > 1 && obj_pe (abfd))
18311830
internal_ptr->u.syment._n._n_n._n_offset =
18321831
((uintptr_t)
18331832
copy_name (abfd,
@@ -1842,7 +1841,7 @@ coff_get_normalized_symtab (bfd *abfd)
18421841
}
18431842

18441843
/* Normalize other strings available in C_FILE aux entries. */
1845-
if (!coff_data (abfd)->pe)
1844+
if (!obj_pe (abfd))
18461845
for (int numaux = 1; numaux < internal_ptr->u.syment.n_numaux; numaux++)
18471846
{
18481847
aux = internal_ptr + numaux + 1;

bfd/cofflink.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ _bfd_coff_final_link (bfd *abfd,
11681168
static char *
11691169
dores_com (char *ptr, bfd *output_bfd, int heap)
11701170
{
1171-
if (coff_data(output_bfd)->pe)
1171+
if (obj_pe (output_bfd))
11721172
{
11731173
int val = strtoul (ptr, &ptr, 0);
11741174

@@ -1400,7 +1400,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
14001400
output_index = syment_base;
14011401
outsym = flaginfo->outsyms;
14021402

1403-
if (coff_data (output_bfd)->pe
1403+
if (obj_pe (output_bfd)
14041404
&& ! process_embedded_commands (output_bfd, flaginfo->info, input_bfd))
14051405
return false;
14061406

@@ -3057,7 +3057,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
30573057
- input_section->vma
30583058
+ input_section->output_offset
30593059
+ input_section->output_section->vma);
3060-
if (coff_data (output_bfd)->pe)
3060+
if (obj_pe (output_bfd))
30613061
addr -= pe_data(output_bfd)->pe_opthdr.ImageBase;
30623062
if (fwrite (&addr, 1, sizeof (bfd_vma), (FILE *) info->base_file)
30633063
!= sizeof (bfd_vma))

bfd/coffswap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ coff_swap_aux_in (bfd *abfd,
426426
#if FILNMLEN != E_FILNMLEN
427427
#error we need to cope with truncating or extending FILNMLEN
428428
#else
429-
if (numaux > 1 && coff_data (abfd)->pe)
429+
if (numaux > 1 && obj_pe (abfd))
430430
{
431431
if (indx == 0)
432432
memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname,

bfd/libcoff-in.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ typedef struct coff_tdata
101101
bool go32;
102102

103103
/* Is this a PE format coff file? */
104-
int pe;
104+
bool pe;
105105

106106
/* Copy of some of the f_flags bits in the COFF filehdr structure,
107107
used by ARM code. */

bfd/libcoff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ typedef struct coff_tdata
105105
bool go32;
106106

107107
/* Is this a PE format coff file? */
108-
int pe;
108+
bool pe;
109109

110110
/* Copy of some of the f_flags bits in the COFF filehdr structure,
111111
used by ARM code. */

bfd/peicode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ pe_ILF_build_a_bfd (bfd * abfd,
10901090
if (bfd_coff_mkobject_hook (abfd, (void *) & internal_f, NULL) == NULL)
10911091
goto error_return;
10921092

1093-
coff_data (abfd)->pe = 1;
1093+
obj_pe (abfd) = true;
10941094
#ifdef THUMBPEMAGIC
10951095
if (vars.magic == THUMBPEMAGIC)
10961096
/* Stop some linker warnings about thumb code not supporting interworking. */

ld/emultempl/beos.em

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ gld${EMULATION_NAME}_after_open (void)
379379
/* Pass the wacky PE command line options into the output bfd.
380380
FIXME: This should be done via a function, rather than by
381381
including an internal BFD header. */
382-
if (!coff_data(link_info.output_bfd)->pe)
382+
if (!obj_pe (link_info.output_bfd))
383383
{
384384
einfo (_("%F%P: PE operations on non PE file\n"));
385385
}

ld/emultempl/pe.em

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ gld${EMULATION_NAME}_after_open (void)
15151515

15161516
if (bfd_get_flavour (link_info.output_bfd) != bfd_target_coff_flavour
15171517
|| coff_data (link_info.output_bfd) == NULL
1518-
|| coff_data (link_info.output_bfd)->pe == 0)
1518+
|| !obj_pe (link_info.output_bfd))
15191519
einfo (_("%F%P: cannot perform PE operations on non PE output file '%pB'\n"),
15201520
link_info.output_bfd);
15211521

0 commit comments

Comments
 (0)