diff options
author | Alan Modra <amodra@gmail.com> | 2013-05-22 06:13:59 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2013-05-22 06:13:59 +0000 |
commit | 5b3905f13af1f55f88b9aa056323ed2f866d4c12 (patch) | |
tree | 59aae0de55eedada7b94cc0e09ea79a2027e0742 /bfd/srec.c | |
parent | 65bff914eefa44ee459e49f14f672c2a6c271342 (diff) | |
download | binutils-5b3905f13af1f55f88b9aa056323ed2f866d4c12.zip binutils-5b3905f13af1f55f88b9aa056323ed2f866d4c12.tar.gz binutils-5b3905f13af1f55f88b9aa056323ed2f866d4c12.tar.bz2 |
PR binutils/15474
* srec.c (srec_set_section_contents): Properly convert size
and offset to address when octets_per_byte is not unity.
Diffstat (limited to 'bfd/srec.c')
-rw-r--r-- | bfd/srec.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -870,6 +870,7 @@ srec_set_section_contents (bfd *abfd, file_ptr offset, bfd_size_type bytes_to_do) { + int opb = bfd_octets_per_byte (abfd); tdata_type *tdata = abfd->tdata.srec_data; srec_data_list_type *entry; @@ -892,16 +893,16 @@ srec_set_section_contents (bfd *abfd, regardless of the siez of the addresses. */ if (S3Forced) tdata->type = 3; - else if ((section->lma + offset + bytes_to_do - 1) <= 0xffff) + else if ((section->lma + (offset + bytes_to_do) / opb - 1) <= 0xffff) ; /* The default, S1, is OK. */ - else if ((section->lma + offset + bytes_to_do - 1) <= 0xffffff + else if ((section->lma + (offset + bytes_to_do) / opb - 1) <= 0xffffff && tdata->type <= 2) tdata->type = 2; else tdata->type = 3; entry->data = data; - entry->where = section->lma + offset; + entry->where = section->lma + offset / opb; entry->size = bytes_to_do; /* Sort the records by address. Optimize for the common case of |