1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

  • We already know the first thing that happens is that the
    C preprocessor scans the source form of the program and
    produces a new source file with all the preprocessor
    directives removed, macros expanded, include files
    included in the source file, etc.
  • This modified version of the source file is then passed to
    the C compiler to produce the object form of the program,
    if the name of the source file is xxx.c then the name of the
    object file will be xxx.o
  • The .o file contains relocatable machine language--that is,
    there is enough information in the .o file to place the
    machine language code anywhere in the address space of
    the machine
  • The next process is loading or link editing the program


LOADING

  • The program ld performs the loading of your C
    program, the input to this program is a collection of .o
    files and libraries and the output is an executable program
  • You usually don't invoke ld directly, the C compiler can
    do it for you - the C compiler knows the special libraries
    and startup code that is required for C programs, you
    don't need to remember this stuff

March 3, 1998

Page 5

C201/TAM