From Wikipedia:
The BSS segment, also known as uninitialized data, is usually adjacent to the data segment. The BSS segment contains all global variables and static variables that are initialized to zero or do not have explicit initialization in source code. For instance, a variable defined as static int i; would be contained in the BSS segment.
I know the difference between BSS segment and DATA segment.Do a simple test:
root@ubuntu:/tmp# echo "char array[1024*1024*64] = {'A'}; int main() {return 0;}" | gcc -x c - -o data
root@ubuntu:/tmp# ls -lh data
-rwxr-xr-x 1 root root 65M 9月 5 15:55 data
root@ubuntu:/tmp# echo "char array[1024*1024*64]; int main() {return 0;}" | gcc -x c - -o bss
root@ubuntu:/tmp# ls -lh bss
-rwxr-xr-x 1 root root 8.0K 9月 5 15:55 bss
Since uninitialized data is all zero in memory, and in runtime the value is configured in heap section, why do we need it in executable?
Are all the pointers themselves stored in stack section?