Once we have our initial binary, we start building on the knowledge that we have of the ELF format to continue our understanding of memory utilization. The text, data, and bss fields are a foundation on which the heap and stack are laid. The heap begins at the end of the .bss and .data bits and grows continuously to form larger memory addresses.
The stack is an allocation of contiguous blocks of memory. This allocation happens automatically within the function call stack. When a function is called, its variables get memory allocated on the stack. After the function call is completed, the variable's memory is deallocated. The stack has a fixed size and can only be determined at compile time. Stack allocation is inexpensive from an allocation perspective because it only needs to push to the stack and pull from the stack for allocation.
The heap...