summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-04-15 14:26:06 +0000
committerNick Clifton <nickc@redhat.com>2003-04-15 14:26:06 +0000
commita9eecf8cd9388216d14cd24178e7fc0bf826dc01 (patch)
tree4161181ad7cf3d893ae6835c8d97bdb793a7eb69
parent480d067b372b0d3fe4977bbe0741ed5c45454800 (diff)
downloadgdb-a9eecf8cd9388216d14cd24178e7fc0bf826dc01.tar.gz
If a section holds uninitialized data and is from an object file or from an
executable image that has not initialized the s_size field, or if the physical size is padded, use the virtual size (stored in s_paddr) instead.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/peicode.h17
2 files changed, 17 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b253ee62cec..3edd91d3e4d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2003-04-15 Brian Ford <ford@vss.fsi.com>
+
+ * peicode.h (coff_swap_scnhdr_in): If a section holds
+ uninitialized data and is from an object file or from an
+ executable image that has not initialized the s_size field, or if
+ the physical size is padded, use the virtual size (stored in
+ s_paddr) instead.
+
2003-04-15 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_add_object_symbols): Properly report
diff --git a/bfd/peicode.h b/bfd/peicode.h
index c5df62df468..b3c1f29910b 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -256,15 +256,16 @@ coff_swap_scnhdr_in (abfd, ext, in)
}
#ifndef COFF_NO_HACK_SCNHDR_SIZE
- /* If this section holds uninitialized data, use the virtual size
- (stored in s_paddr) instead of the physical size. */
- if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
- && (scnhdr_int->s_paddr > 0))
+ /* If this section holds uninitialized data and is from an object file
+ or from an executable image that has not initialized the field,
+ or if the physical size is padded, use the virtual size (stored in
+ s_paddr) instead. */
+ if (scnhdr_int->s_paddr > 0
+ && (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
+ && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0))
+ || scnhdr_int->s_size > scnhdr_int->s_paddr))
{
- /* Always set it for non pe-obj files, and don't overwrite it
- if it's zero for object files. */
- if (! bfd_pe_executable_p (abfd) || !scnhdr_int->s_size)
- scnhdr_int->s_size = scnhdr_int->s_paddr;
+ scnhdr_int->s_size = scnhdr_int->s_paddr;
/* This code used to set scnhdr_int->s_paddr to 0. However,
coff_set_alignment_hook stores s_paddr in virt_size, which