This is the mail archive of the
crossgcc@cygnus.com
mailing list for the crossgcc project.
Re: Newlib 1.8.1 vfprintf problem on embedded PowerPC
>>>>> Scott Howard <scott@objsw.com> writes:
> Printf works fine, but the startup code supplied with newlib (see
> libgloss/rs6000/*crt0.S) doesn't clear memory in the 'sbss'
> section to all zeros, it only clears the 'bss' section. This is
> what's sending printf etc. into the weeds.
Well, that would certainly do it. But this is what my crt0.S looks
like -- it certainly appears to clear sbss:
/* clear bss and sbss */
lwz r6,.Lbss_start(r5) /* calculate beginning of the BSS */
lwz r7,.Lend(r5) /* calculate end of the BSS */
add r6,r6,r4 /* adjust pointers */
add r7,r7,r4
cmplw 1,r6,r7
bc 4,4,.Ldone1
subf r8,r6,r7 /* number of bytes to zero */
srwi r9,r8,2 /* number of words to zero */
mtctr r9
li r0,0 /* zero to clear memory */
addi r6,r6,-4 /* adjust so we can use stwu */
.Lloop:
stwu r0,4(r6) /* zero bss */
bdnz .Lloop
.Ldone1:
lwz r6,.Lsbss_start(r5) /* calculate beginning of the SBSS */
lwz r7,.Lsbss_end(r5) /* calculate end of the SBSS */
add r6,r6,r4 /* adjust pointers */
add r7,r7,r4
cmplw 1,r6,r7
bc 4,4,.Ldone
subf r8,r6,r7 /* number of bytes to zero */
srwi r9,r8,2 /* number of words to zero */
mtctr r9
li r0,0 /* zero to clear memory */
addi r6,r6,-4 /* adjust so we can use stwu */
.Lloop2:
stwu r0,4(r6) /* zero bss */
bdnz .Lloop2
.Ldone:
My map file shows
0x0002c464 PROVIDE (__sbss_start, .)
0x0002c46c PROVIDE (__sbss_end, .)
0x0002c470 PROVIDE (__bss_start, .)
0x0002c498 PROVIDE (end, .)
which seems about right for my test code. Do you see a bug?
--
Roger Williams finger me for my PGP public key
Coelacanth Engineering Inc consulting & turnkey product development
Middleborough, Massachusetts wireless * datacomm * DSP * ATE
tel +1 508 947-5585 * fax +1 508 861-0278 * http://www.coelacanth.com/
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.