I am trying to understand more about the "general" section of an executable file, and I noticed that when executed objdumpon compiled code, I can see variables placed in the general code only in object files ( *.o) not on executable files.
Why is this?
int i[1000];
int main(){return 0;}
build command:
> gcc -g0 -fcommon -c test.c
> gcc -g0 -fcommon test.c
objdumpshows iin the general section of the symbol table:
> objdump -x test.o
...
SYMBOL TABLE:
...
00000fa0 O *COM* 00000020 i
If I did not run it in the executable:
> objdump -x a.out
...
SYMBOL TABLE:
...
0804a040 g O .bss 00000fa0 i
If I rebuild the object file with the flag -fno-common, it will appear in the segment .bssjust like in the executable file. Does the last executable file have this section "GENERAL"?
source
share