The BSS section of the static memory layout is [supposed to be] for "Uninitialized global variables" or "Global variables set to 0".
I was running some tests and suddenly noticed that local static variables are also increasing the size of the BSS segment.
Example :-
Before any static variables
int main (int argc, char argv[])
{
return 0;
}
data/repos/e-c
❯ size a.out
text data bss dec hex filename
1418 544 8 1970 7b2 a.out
After static variables
int main (int argc, char *argv[])
{
static int a, b, c;
return 0;
}
data/repos/e-c
❯ !s
size a.out
text data bss dec hex filename
1418 544 16 1978 7ba a.out
Those variables are certainly not global variables, then why's the BSS segment increasing? Or is the idea of "Segment for uninitialized global variables" not entirely correct?
Currently I'm on Linux, and using the GCC compiler (version 9.3.0).