#computers #os #process
Program memory layout
An object file is divided into sections containing different types of data1.
| section | description |
|---|---|
.text | where code live, as said above. objdump -drS .process.o will show you th |
.data | initialized data: global tables, variables, etc. objdump -s -j .data .process.o will hexdump |
.bss (block started by symbol (or Better Save Space) [^4]). uninitialized arrays and variables. Filled with zeros, or only the length of the section in some platforms. and | |
.rodata | contains read-only initialized data, is packed into the same segment that contains the .text sec |
.comment .note | just comments put there by the compiler/linker too |
.stab .stabstr | debugging symbols & similar infor |
.init | code running before |
.fini | Code run after |
.plt | indirect calls to dynamically linked |
.symtab | s |
Yo can use readelf or objdump to inspect binaries.
Some info was also taken from osdev wiki 2.
All this section story is strongly related to how the linker and the compiler 1a-compilation work3 1.