LOGBOOK

HELP

Quiz Entry - updated: 2026.07.10

What is an object file and what does it contain?

An object file (.o) holds compiled machine code that is not yet runnable — it still needs the linker to resolve external references and assign final addresses.

An object file as a container of code, data, symbol table and relocation entries.

* A .o is machine code plus bookkeeping (symbols and relocations) — not runnable until the linker resolves external references and fixes addresses. *

After assembly you have machine code, but it's an island: it may call printf without knowing where printf lives, and its internal addresses are relative placeholders. The object file therefore bundles the code together with the metadata the linker needs to finish the job.

Contents:

  1. Machine code — the compiled instructions (.text section)
  2. Initialized data — globals/statics with values (.data)
  3. Uninitialized data — space reserved for zero-initialized data (.bss)
  4. Symbol table — the names of functions and variables it defines or needs
  5. Relocation entries — the spots whose addresses must be patched at link time

Why it isn't directly executable: external calls (printf, malloc) are unresolved, addresses are relative, and multiple .o files still need to be combined.

You can dissect one with objdump -d file.o (disassemble), objdump -t file.o (symbols), or readelf -a file.o (everything).

Go deeper:

From Quiz: REVE1 / The Processor Interface | Updated: Jul 10, 2026