- Published on
Investigation · Part 3 of 20 · From source to a running process
Where Your Variables Live in a Binary: .text, .rodata, .data and .bss
I printed the address of every kind of variable in a C program and a Rust program and matched them with nm and readelf. A 16 MiB array of zeros costs nothing in the file, the same array with one byte set to 1 costs 16 MiB, and a Rust const has no address at all.