This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
bfd/peicode.h: Handle binaries produced by the latest M$oft compilers
- To: binutils at gcc dot gnu dot org
- Subject: bfd/peicode.h: Handle binaries produced by the latest M$oft compilers
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 05 Jul 2001 11:51:12 +0100
Hi Guys,
I am applying the patch below so that LD for ming32w can cope with
the binaries being produced by the latest versions of Microsoft's
compilers. These compielrs store the size of the .bss section in
the s_scnlen field of the section's symbol and not in the s_size of
the section header.
There is code in peicode.h to handle this situation, but it was
being overridden by the code covered with COFF_NO_HACK_SCNHDR_SIZE
which was resetting the section's size back to zero. The patch
fixes this back checking for a zero value before assigning it to the
section's size.
Cheers
Nick
2001-07-05 Nick Clifton <nickc@cambridge.redhat.com>
* peicode.h (coff_swap_scnhdr_in): For sections containing
uninitialised data, only set their size to s_paddr if this does
not reset their size to zero. MS's latest compilers will set
s_paddr to zero.
Index: bfd/peicode.h
===================================================================
RCS file: /cvs/src/src/bfd/peicode.h,v
retrieving revision 1.29
diff -p -r1.29 peicode.h
*** peicode.h 2001/03/08 21:04:01 1.29
--- peicode.h 2001/07/05 10:37:10
*************** coff_swap_scnhdr_in (abfd, ext, in)
*** 275,281 ****
#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_size = scnhdr_int->s_paddr;
/* This code used to set scnhdr_int->s_paddr to 0. However,
--- 275,282 ----
#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))
{
scnhdr_int->s_size = scnhdr_int->s_paddr;
/* This code used to set scnhdr_int->s_paddr to 0. However,