1And in Conclusion¶
We spent one chapter covering one figure:

Flow chart for steps for compiling and running a C program.
The Compiler converts a single high-level language file into a single assembly language file.
The Assembler removes pseudoinstructions, converts what it can to machine language, creates checklist for the linker (relocation table).
These details are stored in an object file.
The assembler does 2 passes to resolve addresses in the text segment, handling internal references to position-independent code.
The Linker combines several
.ofiles and resolves absolute addresses.The linker enables separate compilation, libraries that need not be compiled, and resolves remaining addresses (more details)
The Loader loads executable into memory and begins execution.
2Textbook Readings¶
P&H 2.12
3Exercises¶
Check your knowledge!
3.1Conceptual Review¶
How many passes through the code does the Assembler have to make? Why?
Solution
Two: The first finds all the label addresses, and the second resolves forward references while using these label addresses.
Which step in CALL resolves relative addressing? Absolute addressing?
Solution
The assembler usually handles relative addressing. The linker handles absolute addressing, resolving the references to memory locations outside.
Describe the six main parts of the object files outputted by the Assembler (Header, Text, Data, Relocation Table, Symbol Table, Debugging Information).
Solution
Header: Sizes and positions of the other parts
Text: The machine code
Data: Binary representation of any data in the source file
Relocation Table: Identifies lines of code that need to be “handled” by the Linker (jumps to external labels (e.g. lib files), references to static data)
Symbol Table: List of file labels and data that can be referenced across files
Debugging Information: Additional information for debuggers