diff options
author | Alan Modra <amodra@gmail.com> | 2023-08-27 21:17:05 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-08-27 21:21:38 +0930 |
commit | 6785fd72d503fd13bfec31a2897694f1590031eb (patch) | |
tree | fe86bf1be8d09d2ebe79083349fcdb67db04eb5d /bfd/peXXigen.c | |
parent | 8606b47e94078e77a53f3cd714272c853d2add22 (diff) | |
download | gdb-6785fd72d503fd13bfec31a2897694f1590031eb.zip gdb-6785fd72d503fd13bfec31a2897694f1590031eb.tar.gz gdb-6785fd72d503fd13bfec31a2897694f1590031eb.tar.bz2 |
PE dos_message
I was looking at dos_message and wondering why we have H_PUT_32
in _bfd_XXi_only_swap_filehdr_out but no H_GET_32 in pe_bfd_object_p.
On a big-endian machine this would result in scrambling the code and
strings constained in dos_message. Rather than fix the lack of
H_GET_32 in pe_bfd_object_p, I decided it doesn't make sense to store
dos_message internally as an array of ints.
include/
* coff/internal.h (struct internal_extra_pe_filehdr): Make
dos_message a char array.
* coff/msdos.h (struct external_DOS_hdr): Flatten dos_message.
* coff/pe.h (struct external_PEI_filehdr): Likewise.
bfd/
* libcoff-in.h (struct pe_tdata): Make dos_message a char array.
* libcoff.h: Regenerate.
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): memcpy dos_message
to output.
* peicode.h (pe_mkobject): Don't memset already zeroed pe_opthdr.
Tidy allocation of tdata.pe_obj_data. Set up dos_message from..
(default_dos_message): ..this. New static array.
Diffstat (limited to 'bfd/peXXigen.c')
-rw-r--r-- | bfd/peXXigen.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 3243393..2f2968d 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -890,9 +890,8 @@ _bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out) H_PUT_32 (abfd, filehdr_in->pe.e_lfanew, filehdr_out->e_lfanew); - for (idx = 0; idx < 16; idx++) - H_PUT_32 (abfd, filehdr_in->pe.dos_message[idx], - filehdr_out->dos_message[idx]); + memcpy (filehdr_out->dos_message, filehdr_in->pe.dos_message, + sizeof (filehdr_out->dos_message)); /* Also put in the NT signature. */ H_PUT_32 (abfd, filehdr_in->pe.nt_signature, filehdr_out->nt_signature); |