This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
obj-coff.c: coff_frob_section patch
- To: binutils at sourceware dot cygnus dot com
- Subject: obj-coff.c: coff_frob_section patch
- From: "Mark E." <snowball3 at bigfoot dot com>
- Date: Tue, 11 Jul 2000 16:32:56 -0400
Hi guys,
When the last section is aligned for a COFF target using BFD, garbage is
written out unless padding is added.
gas/Changelog:
2000-07-11 Mark Elbrecht <snowball3@bigfoot.com>
* config/obj-coff.c (coff_frob_section): Add padding to the last
section when aligning it increases its size.
Index: src/gas/config/obj-coff.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff.c,v
retrieving revision 1.28
diff -c -p -r1.28 obj-coff.c
*** obj-coff.c 2000/07/06 17:21:00 1.28
--- obj-coff.c 2000/07/11 20:30:58
*************** coff_frob_section (sec)
*** 1489,1496 ****
#if !defined(TICOFF)
if (size & mask)
{
! size = (size + mask) & ~mask;
! bfd_set_section_size (stdoutput, sec, size);
}
#endif
--- 1489,1508 ----
#if !defined(TICOFF)
if (size & mask)
{
! bfd_vma new_size;
! fragS *last;
!
! new_size = (size + mask) & ~mask;
! bfd_set_section_size (stdoutput, sec, new_size);
!
! /* If the size had to be rounded up, add some padding in
! the last non-empty frag. */
! fragp = seg_info (sec)->frchainP->frch_root;
! last = seg_info (sec)->frchainP->frch_last;
! while (fragp->fr_next != last)
! fragp = fragp->fr_next;
! last->fr_address = size;
! fragp->fr_offset += new_size - size;
}
#endif