Quiz Entry - updated: 2026.07.14
What are the three types of object files in the ELF format?
Relocatable (.o), executable, and shared object (.so) — all three use the ELF format, differing mainly in how their addresses are represented.
| Type | Extension | Description |
|---|---|---|
| Relocatable | .o |
Compiled from one source file; contains code and data that can be combined with other .o files |
| Executable | a.out (or named) |
Fully linked; ready to be copied into memory and executed |
| Shared | .so |
Special relocatable object that can be loaded dynamically at load-time or run-time |
Key differences:
- Relocatable: Symbols have relative addresses (not final)
- Executable: All symbols resolved to absolute addresses
- Shared: Position-independent code (PIC); can be loaded at any address
Windows equivalent: Shared objects are called DLLs (Dynamic Link Libraries)
Tip: All three use the same ELF format - the differences are in what sections they contain and how addresses are represented.
Go deeper:
Object file (Wikipedia) — relocatable, executable and shared objects and the sections they carry.
elf(5) — the ELF format man page — the on-disk structures behind all three file types.