why do global variables lose effect
Posted: Thu Aug 09, 2007 5:59 pm
Hi,everyone.
When I defined global variables and local variables shown below, why would the local one work while the global one not?
This is mapfile
Thanks!
When I defined global variables and local variables shown below, why would the local one work while the global one not?
Code: Select all
char testa[10]="hello";
int main()
{
char testb[10]="world";
//print(testa); //Well, this piece of code doesn't print anything.
print(testb); //when using this one instead, it works and print out "world";
..............
}
Code: Select all
............
.init_array
*(.init_array)
0x00011000 PROVIDE (__init_array_end, .)
0x00011000 PROVIDE (__fini_array_start, .)
.fini_array
*(.fini_array)
0x00011000 PROVIDE (__fini_array_end, .)
.data 0x00011000 0x16
*(.data .data.* .gnu.linkonce.d.*)
.data 0x00011000 0xa kernel/global.o
0x00011000 teststring
*fill* 0x0001100a 0x2 00
.data 0x0001100c 0xa kernel/main.o
0x0001100c testa
..................