This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Warning for unknown PE section flags.


On Wed, Feb 21, 2001 at 06:39:15PM +0100, CoreDump wrote:
> "H . J . Lu" wrote:
> 
> > On Wed, Feb 21, 2001 at 01:26:04AM +0100, CoreDump wrote:
> > > #strings quicktimeinstaller.exx
> > > BFD: BFD internal error, aborting at coffcode.h line 747 in
> > > styp_to_sec_flags
> > >
> > > BFD: Please report this bug.
> > Please put it somewhere I can download. If you cannot do that, email
> > it to me. Thanks.
> >
> > --
> > H.J. Lu (hjl@valinux.com)
> 
> I've managed to reduce the filesize drastically. The first 3 'lines' of
> the file successfully reproduce the bug.
> It is a 'standard' win32 exe file
> 

Thanks for your testcase.  Here is a patch.


-- 
H.J. Lu (hjl@valinux.com)
---
2001-02-21  H.J. Lu  <hjl@gnu.org>

	* coffcode.h (styp_to_sec_flags): Issue a warning for section
	flags we don't know what to do instead of abort.

Index: coffcode.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/coffcode.h,v
retrieving revision 1.1.1.30
diff -u -p -r1.1.1.30 coffcode.h
--- coffcode.h	2001/01/23 18:59:36	1.1.1.30
+++ coffcode.h	2001/02/21 18:18:02
@@ -719,16 +719,25 @@ styp_to_sec_flags (abfd, hdr, name, sect
   flagword sec_flags = 0;
 
   if (styp_flags & STYP_DSECT)
-    abort ();  /* Don't know what to do */
+    /* Don't know what to do */
+    (*_bfd_error_handler)
+      (_("%s (%s): Section flag STYP_DSECT (0x%x) ignored"),
+	bfd_get_filename (abfd), name, STYP_DSECT);
 #ifdef SEC_NEVER_LOAD
   if (styp_flags & STYP_NOLOAD)
     sec_flags |= SEC_NEVER_LOAD;
 #endif
   if (styp_flags & STYP_GROUP)
-    abort ();  /* Don't know what to do */
+    /* Don't know what to do */
+    (*_bfd_error_handler)
+      (_("%s (%s): Section flag STYP_GROUP (0x%x) ignored"),
+	bfd_get_filename (abfd), name, STYP_GROUP);
   /* skip IMAGE_SCN_TYPE_NO_PAD */
   if (styp_flags & STYP_COPY)
-    abort ();  /* Don't know what to do */
+    /* Don't know what to do */
+    (*_bfd_error_handler)
+      (_("%s (%s): Section flag STYP_COPY (0x%x) ignored"),
+	bfd_get_filename (abfd), name, STYP_COPY);
   if (styp_flags & IMAGE_SCN_CNT_CODE)
     sec_flags |= SEC_CODE | SEC_ALLOC | SEC_LOAD;
   if (styp_flags & IMAGE_SCN_CNT_INITIALIZED_DATA)
@@ -736,7 +745,10 @@ styp_to_sec_flags (abfd, hdr, name, sect
   if (styp_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
     sec_flags |= SEC_ALLOC;
   if (styp_flags & IMAGE_SCN_LNK_OTHER)
-    abort ();  /* Don't know what to do */
+    /* Don't know what to do */
+    (*_bfd_error_handler)
+      (_("%s (%s): Section flag IMAGE_SCN_LNK_OTHER (0x%x) ignored"),
+	bfd_get_filename (abfd), name, IMAGE_SCN_LNK_OTHER);
   if (styp_flags & IMAGE_SCN_LNK_INFO)
     {
       /* We mark these as SEC_DEBUGGING, but only if COFF_PAGE_SIZE is
@@ -750,7 +762,10 @@ styp_to_sec_flags (abfd, hdr, name, sect
 #endif
     }
   if (styp_flags & STYP_OVER)
-    abort ();  /* Don't know what to do */
+    /* Don't know what to do */
+    (*_bfd_error_handler)
+      (_("%s (%s): Section flag STYP_OVER (0x%x) ignored"),
+	bfd_get_filename (abfd), name, STYP_OVER);
   if (styp_flags & IMAGE_SCN_LNK_REMOVE)
     sec_flags |= SEC_EXCLUDE;
 
@@ -760,9 +775,15 @@ styp_to_sec_flags (abfd, hdr, name, sect
   if (styp_flags & IMAGE_SCN_MEM_DISCARDABLE)
     sec_flags |= SEC_DEBUGGING;
   if (styp_flags & IMAGE_SCN_MEM_NOT_CACHED)
-    abort ();/* Don't know what to do */
+    /* Don't know what to do */
+    (*_bfd_error_handler)
+      (_("%s (%s): Section flag IMAGE_SCN_MEM_NOT_CACHED (0x%x) ignored"),
+	bfd_get_filename (abfd), name, IMAGE_SCN_MEM_NOT_CACHED);
   if (styp_flags & IMAGE_SCN_MEM_NOT_PAGED)
-    abort (); /* Don't know what to do */
+    /* Don't know what to do */
+    (*_bfd_error_handler)
+      (_("%s (%s): Section flag IMAGE_SCN_MEM_NOT_PAGED (0x%x) ignored"),
+	bfd_get_filename (abfd), name, IMAGE_SCN_MEM_NOT_PAGED);
 
   /* We infer from the distinct read/write/execute bits the settings
      of some of the bfd flags; the actual values, should we need them,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]