bug in newlib-1.8.0
Stefan Althoefer
as@janzag.de
Mon Feb 16 04:11:00 GMT 1998
Hi newlib maintainers,
I think there is a (minor) bug in libgloss/m68k/crt0.S:
When blanking the .bss section, the code blanks one charcter
too much. As the bss is the last section, this should not
normally harm very much.
I think the code should be as follows:
----------------------------------------------------------
*** crt0.S Sun Feb 1 12:36:31 1998
--- crt0-n.S Thu Feb 5 20:58:15 1998
***************
*** 75,102 ****
/*
* zero out the bss section.
*/
movel IMM(__bss_start), d1
movel IMM(_end), d0
cmpl d0, d1
jbeq 3f
movl d1, a0
subl d1, d0
2:
clrb (a0)+
#ifndef __mcf5200__
dbra d0, 2b
clrw d0
subql IMM(1), d0
jbcc 2b
#else
subql IMM(1), d0
! jne 2b
#endif
3:
/*
* initialize target specific stuff. Only execute these
* functions it they exist.
*/
lea SYM (hardware_init_hook), a0
--- 75,103 ----
/*
* zero out the bss section.
*/
movel IMM(__bss_start), d1
movel IMM(_end), d0
cmpl d0, d1
jbeq 3f
movl d1, a0
subl d1, d0
+ subql IMM(1), d0
2:
clrb (a0)+
#ifndef __mcf5200__
dbra d0, 2b
clrw d0
subql IMM(1), d0
jbcc 2b
#else
subql IMM(1), d0
! jmi 2b
#endif
3:
/*
* initialize target specific stuff. Only execute these
* functions it they exist.
*/
lea SYM (hardware_init_hook), a0
-----------------------------------------------------
The coldfire part seemed to be o.k. before the change. As I'm not
familiare with those CPUs, I hope my change does not
impact this part.
For performance improvement, I would additionally suggest to
clear long-words at a time. This would of course require an
additional ALIGN() statement in all linker scripts ...
mfg
Stefan Althoefer
------------------------------------------------------------------
JANZ Computer AG voice: +49 5251 1550-13 'Black holes
Im Doerener Feld 8 fax: +49 5251 1550-90 are where God
D-33100 Paderborn e-mail: as@janzag.de is dividing
URL: http:\\www.janzag.de by zero'
------------------------------------------------------------------
More information about the Newlib
mailing list