I’m reading this course on the structure of an executable and it says there are three data sections in an executable:
- code section — where the instructions are stored
- data section
- .data — stores initialized global data
- .bss — stores uninitialized global data
- .rodata — stores read-only data, such as literals
My question is, why is the distinction made between initialized and uninitialized global data?
(We use C in class, but I guess this is a language agnostic subject.)
Image size. The program image has to contain the initialization data for .data, but it does not have to contain .bss.