Fix ihex records crossing 64K boundaries

Nick Clifton nickc@cambridge.redhat.com
Tue Apr 16 03:17:00 GMT 2002


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;



More information about the Binutils mailing list