Search notes:
object file
The default suffix for an object file is .o
.
Information about object files can be dumped with
objdump
. (TODO: Compare with
nm
).
Object files might be created by an
assembler.
Object files are fed to a
linker which then creates a runnable program (executable) from them.
Contents of an object file can be copied to another object file with objcopy
.
General layout
Header
Location and size of pieces (segments?)
Location of entry point (if exists)
Text segment
Executable instructions.
Data segment
Variables, constants etc.
Debug info
map of address to line number
Relocation information
Used by linker to patch addresses instructions and data that depend on location of object file in memery after loading.
Symbol table
Exported references
Unresolved imported references
TODO - executable formats
COFF (Common Object File Format) was introduced with Unix System V.
Definitions of PE format is found in WINNT.h
.
ELF (Executable and Link Format), favored by modern Unix derivates.
Mach-o (Mach object), for Mac OS X.