aboutsummaryrefslogtreecommitdiff
path: root/bfd/binary.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-06-11 13:34:13 +0930
committerAlan Modra <amodra@gmail.com>2017-06-11 13:45:18 +0930
commit9b97dfbf8049bed3b2f79c6c785afaf18206dad3 (patch)
tree7da501ce8650a2e97faa3ca4612ac8ca5e04f1c3 /bfd/binary.c
parentc7198f97e026f2a2d53de8dda090c04619355a36 (diff)
downloadgdb-9b97dfbf8049bed3b2f79c6c785afaf18206dad3.zip
gdb-9b97dfbf8049bed3b2f79c6c785afaf18206dad3.tar.gz
gdb-9b97dfbf8049bed3b2f79c6c785afaf18206dad3.tar.bz2
PR 21564, Section start in binary output file incorrect
PR 21564 * binary.c (binary_set_section_contents): Scale lma by octets per byte to set filepos.
Diffstat (limited to 'bfd/binary.c')
-rw-r--r--bfd/binary.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/binary.c b/bfd/binary.c
index ff52f14..0a811cf 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -230,6 +230,7 @@ binary_set_section_contents (bfd *abfd,
if (! abfd->output_has_begun)
{
+ unsigned int opb;
bfd_boolean found_low;
bfd_vma low;
asection *s;
@@ -250,9 +251,10 @@ binary_set_section_contents (bfd *abfd,
found_low = TRUE;
}
+ opb = bfd_octets_per_byte (abfd);
for (s = abfd->sections; s != NULL; s = s->next)
{
- s->filepos = s->lma - low;
+ s->filepos = (s->lma - low) * opb;
/* Skip following warning check for sections that will not
occupy file space. */