If a section holds uninitialized data and is from an object file or from an
authorNick Clifton <nickc@redhat.com>
Tue, 15 Apr 2003 14:26:06 +0000 (14:26 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 15 Apr 2003 14:26:06 +0000 (14:26 +0000)
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.

bfd/ChangeLog
bfd/peicode.h

index b253ee62cecb4cf37377894d2905d133210a0420..3edd91d3e4df921e6c88c4f7184755bbb6e23f14 100644 (file)
@@ -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
index c5df62df468539642f3a357006b037b32ae9de99..b3c1f29910b4aef4a184773f8866ea1f45e8a1c1 100644 (file)
@@ -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
This page took 0.032568 seconds and 4 git commands to generate.