This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]