Re: [uClinux-dev] m68k-elf section problem?

From: Carlos Manuel Duclos Vergara (carlos@embedded.cl)
Date: Tue Jul 09 2002 - 03:10:24 EDT


Hi,

i don't know the exact answer but knowing how the register asignation
is,
the problem seems very logic.

> int global;
> main()
> {
>         int local=1;
>         static int slocal;
>         global=local++;
>         slocal=global;
>         return;
> }

in this case you're using global as a temp variable and probably the
optimizing part has think that it's not necesary to do the job (after
all nothing depends on it).

> int global=1;
> main()
> {
>         int local=1;
>         static int slocal;
>         global=local++;
>         slocal=global;
>         return;
> }

int this case you're using global as a variable but with a specific
value. And the compiler must keep this value, so it needs to keep this
in memory at least.

if you look closer, you will see that there is an interesting size
increase
between those two binaries (4 bytes, mmmm smells like teen spirit....)

before:
text    data     bss     dec     hex filename
     24       0       4      28      1c tseg.o

after:
text    data     bss     dec     hex filename
     24       4       4      32      20 tseg.o

so, in your memory allocation you're having 4 bytes more due to your new
integer....

if you don't like that it is in data section, change it using a script
for the linker.

bye

-- 
"tu realmente no eres un tipo de persona a la cual alguien desea tenerla
como amigo, ya que , tu humanidad es muy baja,tu materialismo es muy
alto,tu intelectualidad relativamente poca"
Opinion Anonima acerca de mi
This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/


This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:21:30 EDT