6.2.1. Program layout

Linux is 32-bit, runs in protected mode, has flat memory model, and uses the ELF format for binaries.

A program can be divided into sections: .text for your code (read-only), .data for your data (read-write), .bss for uninitialized data (read-write); there can actually be a few other standard sections, as well as some user-defined sections, but there's rare need to use them and they are out of our interest here. A program must have at least .text section.

Now we will write our first program. Here is sample code: