This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

[PATCH 2/2] pe/coff: Don't try to interpret the contents of sections with no contents for 'objdump -p'


Don't try to interpret the contents of sections with no contents for 'objdump -p'.
The meaning of a series of zeros is not very interesting.

bfd/Changelog:

2014-03-18  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* peXXigen.c (pe_print_idata, pe_print_edata, pe_print_reloc)
	(rsrc_print_section): Don't bother interpreting the contents
	of sections which have no contents.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
---
 bfd/peXXigen.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index d011c0e..539c65c 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1111,6 +1111,14 @@ pe_print_idata (bfd * abfd, void * vfile)
 		   _("\nThere is an import table, but the section containing it could not be found\n"));
 	  return TRUE;
 	}
+
+      if (!(section->flags & SEC_HAS_CONTENTS))
+        {
+	  fprintf (file,
+		   _("\nThere is an import table in %s, but that section has no contents\n"),
+		   section->name);
+	  return TRUE;
+        }
     }
 
   fprintf (file, _("\nThere is an import table in %s at 0x%lx\n"),
@@ -1424,6 +1432,14 @@ pe_print_edata (bfd * abfd, void * vfile)
 	  return TRUE;
 	}
 
+      if (!(section->flags & SEC_HAS_CONTENTS))
+        {
+	  fprintf (file,
+		   _("\nThere is an export table in %s, but that section has no contents\n"),
+		   section->name);
+	  return TRUE;
+        }
+
       dataoff = addr - section->vma;
       datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size;
       if (datasize > section->size - dataoff)
@@ -1937,6 +1953,9 @@ pe_print_reloc (bfd * abfd, void * vfile)
   if (section->size == 0)
     return TRUE;
 
+  if (!(section->flags & SEC_HAS_CONTENTS))
+    return TRUE;
+
   fprintf (file,
 	   _("\n\nPE File Base Relocations (interpreted .reloc section contents)\n"));
 
@@ -2185,6 +2204,9 @@ rsrc_print_section (bfd * abfd, void * vfile)
   if (datasize == 0)
     return TRUE;
 
+  if (!(section->flags & SEC_HAS_CONTENTS))
+    return TRUE;
+
   if (! bfd_malloc_and_get_section (abfd, section, & data))
     {
       if (data != NULL)
-- 
1.8.3.4


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