summaryrefslogtreecommitdiff
path: root/gas/config/obj-coff.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-07-12 16:45:46 +0000
committerNick Clifton <nickc@redhat.com>2000-07-12 16:45:46 +0000
commitd6337ca2501a66bd8f0746d92273150f312e07e0 (patch)
tree944c9499d48155c5e40dea6abd82cb62741d7252 /gas/config/obj-coff.c
parent24db0a44f05f4e747af539689478d20a02dd4c32 (diff)
downloadbinutils-redhat-d6337ca2501a66bd8f0746d92273150f312e07e0.tar.gz
Add padding to the last section when aligning it increases its size.
Diffstat (limited to 'gas/config/obj-coff.c')
-rw-r--r--gas/config/obj-coff.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index 018f32b560..41fc595eaf 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -1489,8 +1489,20 @@ coff_frob_section (sec)
#if !defined(TICOFF)
if (size & mask)
{
- size = (size + mask) & ~mask;
- bfd_set_section_size (stdoutput, sec, size);
+ 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