From: Nick Clifton Date: Fri, 20 Aug 2010 14:41:48 +0000 (+0000) Subject: * merge.c (sec_merge_emit): Do not zero pad sections that do not X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=736cba80b31789271770d7e7716e873695336c3b;p=binutils-gdb.git * merge.c (sec_merge_emit): Do not zero pad sections that do not have an alignment. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cfe91d979bf..9a52165d796 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2010-08-20 Nick Clifton + + * merge.c (sec_merge_emit): Do not zero pad sections that do not + have an alignment. + 2010-08-18 Pedro Alves PR corefile/8210 diff --git a/bfd/merge.c b/bfd/merge.c index 7aa088ff947..180af267a21 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -307,6 +307,9 @@ sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry) len = -off & (entry->alignment - 1); if (len != 0) { + /* We should never have an entry with an alignment + greater than the section's alignment. */ + BFD_ASSERT (len <= (bfd_size_type) (1 << alignment_power)); if (bfd_bwrite (pad, len, abfd) != len) goto err; off += len; @@ -324,6 +327,7 @@ sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry) /* Trailing alignment needed? */ off = sec->size - off; if (off != 0 + && alignment_power && bfd_bwrite (pad, off, abfd) != off) goto err;