aboutsummaryrefslogtreecommitdiff
path: root/bfd/merge.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2010-08-20 14:41:48 +0000
committerNick Clifton <nickc@redhat.com>2010-08-20 14:41:48 +0000
commit736cba80b31789271770d7e7716e873695336c3b (patch)
tree90a0a411df69975d56576afb641b7c07bbae84e2 /bfd/merge.c
parent97b4be1cc0a42ea9964a912bb1513974e7aa7613 (diff)
downloadgdb-736cba80b31789271770d7e7716e873695336c3b.zip
gdb-736cba80b31789271770d7e7716e873695336c3b.tar.gz
gdb-736cba80b31789271770d7e7716e873695336c3b.tar.bz2
* merge.c (sec_merge_emit): Do not zero pad sections that do not
have an alignment.
Diffstat (limited to 'bfd/merge.c')
-rw-r--r--bfd/merge.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/merge.c b/bfd/merge.c
index 7aa088f..180af26 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;