* peicode.h (coff_swap_filehdr_in): can't use e_magic because we
authorDJ Delorie <dj@redhat.com>
Fri, 30 Jun 2000 21:54:03 +0000 (21:54 +0000)
committerDJ Delorie <dj@redhat.com>
Fri, 30 Jun 2000 21:54:03 +0000 (21:54 +0000)
can't assume the PE header is at 0x80.
* coff/pe.h: clarify a comment

bfd/peicode.h
include/ChangeLog
include/coff/pe.h

index 8f64453a3f463cf9929196870648f1e2616e2b37..9071c72b29e9668ad5e443f43c55a733851bc0b2 100644 (file)
@@ -220,8 +220,13 @@ coff_swap_filehdr_in (abfd, src, dst)
      correctly for a PEI file, check the e_magic number here, and, if
      it doesn't match, clobber the f_magic number so that we don't get
      a false match.  */
+#if 0
+  /* We can't assume that the PE header is at offset 0x80.  When it
+     isn't, the DOS header isn't read correctly, so we can't assume
+     e_magic is set even for valid PE files. */
   if (bfd_h_get_16 (abfd, (bfd_byte *) filehdr_src->e_magic) != DOSMAGIC)
     filehdr_dst->f_magic = -1;
+#endif
 #endif
 
   /* Other people's tools sometimes generate headers with an nsyms but
index 2440179b236b230164dc5f1199ae6fe84ca326e9..29c27d1269770b7bcb9eabd6211560e3475c7f8f 100644 (file)
@@ -1,3 +1,7 @@
+2000-06-30  DJ Delorie  <dj@cygnus.com>
+
+       * coff/pe.h: clarify a comment
+
 2000-06-18  Stephane Carrez  <stcarrez@worldnet.fr>
 
        * dis-asm.h (print_insn_m68hc12): Define.
index e65562eee8a608177d1aa516cb4337ef60f452e3..9b7f1f20cfa587b6f1eaa3d7d384b56bc2819d35 100644 (file)
 
 struct external_PEI_filehdr
 {
-  /* DOS header fields */
+  /* DOS header fields - always at offset zero in the EXE file */
   char e_magic[2];             /* Magic number, 0x5a4d */
   char e_cblp[2];              /* Bytes on last page of file, 0x90 */
   char e_cp[2];                        /* Pages in file, 0x3 */
@@ -129,8 +129,12 @@ struct external_PEI_filehdr
   char e_oemid[2];             /* OEM identifier (for e_oeminfo), 0x0 */
   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, 0x80 */
+  char e_lfanew[4];            /* File address of new exe header, usually 0x80 */
   char dos_message[16][4];     /* 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 */
+
   char nt_signature[4];                /* required NT signature, 0x4550 */ 
 
   /* From standard header */  
This page took 0.027189 seconds and 4 git commands to generate.