目录 ← 首页
CS61C

Summary

And 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.

  • 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 .o files 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.

Textbook Readings

P&H 2.12

Exercises

Check your knowledge!

Conceptual Review