Study Sheet - Chapter 7

Disclaimer: This study sheet covers important terms and concepts that I found in the text. The absence of a specific item in the text from this list does not mean that you are not responsible for knowing it. Blah, blah, blah.

Assembly coding and assemblers (Sections 7.1-7.3)

QOD on page 509... "assembly code programming... is not for wimps and weaklings"

Terms:

assembler compiler translator
source language target language pure assembly language
pseudo-instructions/assembler directives  
macro definition macro call macro expansion
forward reference problem 2-pass assembler
Instruction Location Counter (ILC)  
symbol table binary search hash table

You should understand:

  • Common format on an assembly language statement
  • Difference between instructions and pseudo-instructions
  • Plusses and minuses of writing assembly code
  • Macros are different than functions, they are:
    • Expanded during assembly, not execution
    • Placed in-line, not called like functions
    • Don't have return values
  • The two passes of an assembler:
    • What each pass does
    • The forward reference problem
    • The symbol table

Linking and loading (Section 7.4)

Terms:

linker loader object module executable
relocation problem external reference problem relocation constant entry points
external symbols binding time position independent dynamic linking
Dynamic Link Library (DLL) implicit linking import library explicit linking
shared library host library target library  

Key points:

  • Understand the process of creating an executable: source files, translators, object files and libraries, linker (as in Fig 7-13 on page 531)
  • The basic problems solved by the linker:
    • relocation problem - setting the starting address of a module and adjusting all references by a relocation constant
    • external reference problem - finding the address of external functions and variables
    • all the goodies in the example shown in section 7.4
  • Six parts of an object module:
    1. Identification - name of the module other accounting information
    2. Entry point table - public objects (like .globl in our assembly code)
    3. External reference table - symbols that are defined outside this module (.extrn)
    4. Machine instructions and constants - the code
    5. Relocation dictionary - list of addresses in part 4 that need to be relocated
    6. End of module- checksum, parity check
  • Six possibilities for binding time, when program is 1) written, 2) translated, 3) linked, 4) loaded, 5) base register is loaded, 6) executed
  • Dynamic linking using DLL's