This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Fix ihex records crossing 64K boundaries
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: 16 Apr 2002 11:17:11 +0100
- Subject: Fix ihex records crossing 64K boundaries
Hi Guys,
The recent patch to ihex.c to stop records from crossing a 64K
boundary was broken. It was using the wrong value to check for
overflow and then computing the wrong size when overflow did occur.
The following patch fixes both of these problems.
Applied to the mainline sources, not the branch.
Cheers
Nick
2002-04-16 Nick Clifton <nickc@cambridge.redhat.com>
* ihex.c (ihex_write_object_contents): Fix check for records
crossing 64K boundaries.
Index: bfd/ihex.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/ihex.c,v
retrieving revision 1.16.126.1
diff -c -3 -p -w -r1.16.126.1 ihex.c
*** ihex.c 2002/04/10 10:20:28 1.16.126.1
--- ihex.c 2002/04/16 10:10:52
*************** ihex_write_object_contents (abfd)
*** 871,878 ****
rec_addr = where - (extbase + segbase);
/* Output records shouldn't cross 64K boundaries. */
! if (rec_addr + now > 0xfffff)
! now = 0xffff - rec_addr;
if (! ihex_write_record (abfd, now, rec_addr, 0, p))
return false;
--- 871,878 ----
rec_addr = where - (extbase + segbase);
/* Output records shouldn't cross 64K boundaries. */
! if (rec_addr + now > 0xffff)
! now = 0x10000 - rec_addr;
if (! ihex_write_record (abfd, now, rec_addr, 0, p))
return false;