This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PE/COFF _raw_size 2003-04-15 BFD patch breaks my project
Hi Brian, Hi Edouard,
> Agreed. How about simply "only remove the padding when the bfd
> represents an executable"?
What, something like the patch below ? (This patch is completely
untested by me, but if it does work, let me know and I can apply it).
Cheers
Nick
2003-10-21 Nick Clifton <nickc@redhat.com>
* peicode.h (coff_swap_scnhdr_in): Only remove padding when
creating an executable.
Index: bfd/peicode.h
===================================================================
RCS file: /cvs/src/src/bfd/peicode.h,v
retrieving revision 1.37
diff -c -3 -p -r1.37 peicode.h
*** bfd/peicode.h 15 Apr 2003 14:26:06 -0000 1.37
--- bfd/peicode.h 21 Oct 2003 12:16:35 -0000
*************** coff_swap_scnhdr_in (abfd, ext, in)
*** 258,269 ****
#ifndef COFF_NO_HACK_SCNHDR_SIZE
/* 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))
{
scnhdr_int->s_size = scnhdr_int->s_paddr;
--- 258,269 ----
#ifndef COFF_NO_HACK_SCNHDR_SIZE
/* 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 this is an executable file and 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))
! || (bfd_pe_executable_p (abfd) && scnhdr_int->s_size > scnhdr_int->s_paddr)))
{
scnhdr_int->s_size = scnhdr_int->s_paddr;