Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1And in Conclusion\dots

We spent one chapter covering one figure:

"Vertical flowchart of the translation and load pipeline: C source foo.c is compiled to assembly foo.s, assembled to object file foo.o, linked with lib.o to produce executable a.out, then loaded into memory. Each stage appears as a color-coded box with arrows showing inputs and outputs between files and the Compiler, Assembler, Linker, and Loader."

Flow chart for steps for compiling and running a C program.

2Textbook Readings

P&H 2.12

3Exercises

Check your knowledge!

3.1Conceptual Review

Solution to Exercise 1 #

Two: The first finds all the label addresses, and the second resolves forward references while using these label addresses.

Solution to Exercise 2 #

The assembler usually handles relative addressing. The linker handles absolute addressing, resolving the references to memory locations outside.

Solution to Exercise 3 #
  • 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