[uClinux-dev] m68k-elf section problem?

From: zhanglei (zl@imail.com.cn)
Date: Mon Jul 08 2002 - 22:32:54 EDT


Dear all:
I make use of m68k-elf-gcc as my crosscompiler. After compiling a simple program, I got confused with section.
Options from my makefile is as below:
LIBC = -lc
LIBCRYPT = -lcrypt
CFLAGS := -O2 -g -fomit-frame-pointer -fno-builtin -m68000 -D__UCLINUX__
CFLAGS += -DEMBED
LDFLAGS = $(CFLAGS) -Wl,-elf2flt
LDLIBS = $(LIBC)
Firstly, the program is below: 
int global;
main()
{
        int local=1;
        static int slocal;
        global=local++;
        slocal=global;
        return;
}
After compiling , I make use of m68k-elf-size to get the size.The result is:
text    data     bss     dec     hex filename
     24       0       4      28      1c tseg.o
Why the data section is empty ?
Then, I change the program as below(Just set global=1.):
int global=1;
main()
{
        int local=1;
        static int slocal;
        global=local++;
        slocal=global;
        return;
}
The result from m68k-elf-size is:
text    data     bss     dec     hex filename
     24       4       4      32      20 tseg.o
Why the "global" has been put into the data section ?
Does this means that I could make change in text section when program has been loaded into the memory ?
Thanks.
Zhang Lei



LittleBoy.GIF 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