aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/libcoff-in.h2
-rw-r--r--bfd/libcoff.h2
-rw-r--r--bfd/peXXigen.c5
-rw-r--r--bfd/peicode.h42
-rw-r--r--include/coff/internal.h2
-rw-r--r--include/coff/msdos.h2
-rw-r--r--include/coff/pe.h2
7 files changed, 22 insertions, 35 deletions
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index eacfcb3..b707108 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -147,7 +147,7 @@ typedef struct pe_tdata
int dll;
int has_reloc_section;
int dont_strip_reloc;
- int dos_message[16];
+ char dos_message[64];
/* The timestamp to insert into the output file.
If the timestamp is -1 then the current time is used. */
int timestamp;
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index ad6138e..dfe3800 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -151,7 +151,7 @@ typedef struct pe_tdata
int dll;
int has_reloc_section;
int dont_strip_reloc;
- int dos_message[16];
+ char dos_message[64];
/* The timestamp to insert into the output file.
If the timestamp is -1 then the current time is used. */
int timestamp;
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);
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 1ff13b0..72adce1 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -258,40 +258,28 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
static bool
pe_mkobject (bfd * abfd)
{
- pe_data_type *pe;
- size_t amt = sizeof (pe_data_type);
-
- abfd->tdata.pe_obj_data = (struct pe_tdata *) bfd_zalloc (abfd, amt);
-
- if (abfd->tdata.pe_obj_data == 0)
+ /* Some x86 code followed by an ascii string. */
+ static const char default_dos_message[64] = {
+ 0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd,
+ 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68,
+ 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72,
+ 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f,
+ 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e,
+ 0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20,
+ 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a,
+ 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ pe_data_type *pe = bfd_zalloc (abfd, sizeof (*pe));
+ abfd->tdata.pe_obj_data = pe;
+ if (pe == NULL)
return false;
- pe = pe_data (abfd);
-
pe->coff.pe = 1;
/* in_reloc_p is architecture dependent. */
pe->in_reloc_p = in_reloc_p;
- /* Default DOS message string. */
- pe->dos_message[0] = 0x0eba1f0e;
- pe->dos_message[1] = 0xcd09b400;
- pe->dos_message[2] = 0x4c01b821;
- pe->dos_message[3] = 0x685421cd;
- pe->dos_message[4] = 0x70207369;
- pe->dos_message[5] = 0x72676f72;
- pe->dos_message[6] = 0x63206d61;
- pe->dos_message[7] = 0x6f6e6e61;
- pe->dos_message[8] = 0x65622074;
- pe->dos_message[9] = 0x6e757220;
- pe->dos_message[10] = 0x206e6920;
- pe->dos_message[11] = 0x20534f44;
- pe->dos_message[12] = 0x65646f6d;
- pe->dos_message[13] = 0x0a0d0d2e;
- pe->dos_message[14] = 0x24;
- pe->dos_message[15] = 0x0;
-
- memset (& pe->pe_opthdr, 0, sizeof pe->pe_opthdr);
+ memcpy (pe->dos_message, default_dos_message, sizeof (pe->dos_message));
bfd_coff_long_section_names (abfd)
= coff_backend_info (abfd)->_bfd_coff_long_section_names;
diff --git a/include/coff/internal.h b/include/coff/internal.h
index 7a566ca..f33817e 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -54,7 +54,7 @@ struct internal_extra_pe_filehdr
unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */
unsigned short e_res2[10]; /* Reserved words, all 0x0 */
bfd_vma e_lfanew; /* File address of new exe header, 0x80 */
- unsigned int dos_message[16]; /* Text which always follows DOS header. */
+ char dos_message[64]; /* Text which always follows DOS header. */
bfd_vma nt_signature; /* required NT signature, 0x4550 */
};
diff --git a/include/coff/msdos.h b/include/coff/msdos.h
index b879e45..5f09c76 100644
--- a/include/coff/msdos.h
+++ b/include/coff/msdos.h
@@ -48,7 +48,7 @@ struct external_DOS_hdr
char e_oeminfo[2]; /* OEM information. */
char e_res2[10][2]; /* Reserved words, all 0x0. */
char e_lfanew[4]; /* File address of new exe header, usually 0x80. */
- char dos_message[16][4]; /* Other stuff, always follow DOS header. */
+ char dos_message[64]; /* Other stuff, always follow DOS header. */
};
/* The actual DOS header only includes up to the e_ovno field. */
diff --git a/include/coff/pe.h b/include/coff/pe.h
index 6b26d53..7e69e6f 100644
--- a/include/coff/pe.h
+++ b/include/coff/pe.h
@@ -218,7 +218,7 @@ struct external_PEI_filehdr
char e_oeminfo[2]; /* OEM information; e_oemid specific, 0x0. */
char e_res2[10][2]; /* Reserved words, all 0x0. */
char e_lfanew[4]; /* File address of new exe header, usually 0x80. */
- char dos_message[16][4]; /* Other stuff, always follow DOS header. */
+ char dos_message[64]; /* Other stuff, always follow DOS header. */
/* Note: additional bytes may be inserted before the signature. Use
the e_lfanew field to find the actual location of the NT signature. */