avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-gcc-list] data segment init code & .data size calculations


From: Bernard Fouché
Subject: RE: [avr-gcc-list] data segment init code & .data size calculations
Date: Mon, 13 Sep 2004 17:43:01 +0200

Well I found what I was looking for: when using
'sprintf(data,"%X",otherdata)' the '%X' is stored in RAM and so must be
initialized, hence .data grows a bit. I move it to PSTR("%X"), and my .data
segment is back to zero.

A few bytes of flash (22) will be spared in the future when avr-gcc/ld sees
that the .data segment is of size zero and then the initializer code is not
necessary any more :-)

-----Message d'origine-----
De : address@hidden
[mailto:address@hidden la part de Joerg Wunsch
Envoyé : vendredi 10 septembre 2004 09:38
À : address@hidden
Objet : Re: [avr-gcc-list] data segment init code & .data size
calculations


Bernard Fouché <address@hidden> wrote:

> 00800100 D __data_start
> 00800104 B __bss_start
> 00800104 D __data_end
> 00800104 D _edata

Since there's no symbol to find, I suspect this comes from a helper
variable of the compiler.  These are usually done by local symbols
(starting with .L) inside the assembler code so the symbol's name
isn't retained in the symbol table afterwards.  This kind of helper
variables is occasionally used by the compiler when it finds it more
convenient to use the address of something.  Just browse through the
generated assembler code to see it (*not* the disassembled code, I
mean).

> ..., the .data segment is zero in size but __do_copy_data,
> __do_copy_data_loop, etc. are still embedded in the final object.

It seems to me that whoever designed the current gcrt1.S file (IIRC
it's been Marek) intented to let the compiler decide whether they need
to be pulled in or not, but the compiler magic for actually detecting
these cases is not yet implemented, so the compiler always emits
references to these loops.

In practice, I've only rarely seen projects where you don't need them,
so it's probably not that terribly important.

> (the same for .bss: if a program is working only with locals: the
> .bss init code is still bundled however I think that this case would
> be very rare!)

Just a nit: .bss is not for `locals', but for global/static variables
that default to the initialization value of 0 (or NULL).

--
J"org Wunsch                                           Unix support engineer
Wir stellen aus! Auf der SYSTEMS 2004  vom 18.-22. Oktober in München
Halle B 3, Stand 320-206 (Partner-Stand von Sun Microsystems)
Halle B 2, Stand 605 "Die Musterfirma"

_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list



reply via email to

[Prev in Thread] Current Thread [Next in Thread]