The programmer's toolkit

The toolkit a real assembly program is written with: macros and their local labels, calling C functions through the System V ABI, gdb on a program with debug information, the ELF format read with readelf, timing, files and the command line the kernel hands to _start.

4.1 Macros a macro with parameters, the template it expands to, and the local labels that keep two expansions apart Open 4.2 Calling C functions extern, linking against libc, the System V argument registers, and printf from assembly Open 4.3 Debugging with GDB debug information, breakpoints, stepping, and reading the registers of a running program Open 4.4 The ELF format the ELF header, readelf and objdump, and the symbols a linked file carries Open 4.5 Time and date syscalls clock_gettime, the timespec struct, and a measurement of elapsed time Open 4.6 File I/O open, read, write and close, the descriptor they return, and the error path Open 4.7 Command-line arguments the stack at _start, argc and argv, and a walk over the argument array Open

Lessons