summaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-06-13 07:58:05 +0000
committerNick Clifton <nickc@redhat.com>2001-06-13 07:58:05 +0000
commit2fdcda5a56111761e1880d4ccb8ffb40b422c227 (patch)
tree5878bd401b29c1c411e233b4872467e10b8cd372 /bfd/aoutx.h
parent15f53346b1d2bdc123763d7c3977bee5966cd805 (diff)
downloadgdb-2fdcda5a56111761e1880d4ccb8ffb40b422c227.tar.gz
Only pad the tesxt section if the data section is going to follow it.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r--bfd/aoutx.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 93b939a415e..6119564e237 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1006,10 +1006,14 @@ adjust_z_magic (abfd, execp)
}
if (abdp && abdp->zmagic_mapped_contiguous)
{
- text_pad = (obj_datasec(abfd)->vma
- - obj_textsec(abfd)->vma
- - obj_textsec(abfd)->_raw_size);
- obj_textsec(abfd)->_raw_size += text_pad;
+ asection * text = obj_textsec (abfd);
+ asection * data = obj_datasec (abfd);
+
+ text_pad = data->vma - (text->vma + text->_raw_size);
+ /* Only pad the text section if the data
+ section is going to be placed after it. */
+ if (text_pad > 0)
+ text->_raw_size += text_pad;
}
obj_datasec(abfd)->filepos = (obj_textsec(abfd)->filepos
+ obj_textsec(abfd)->_raw_size);