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

  • For example to load the math library with your program
    the -lm option must be included when you perform the
    load operation
  • A small assembler program is also loaded with your
    program, this program sets up the environment for
    executing your C program, it sets the stack pointer, sets
    up the values of argc and argv and transfers control to
    your main() procedure


Properties of the a.out File

  • The output from ld is often called an a.out file, since
    this is the default name of the file
  • This is the executable version of the program, which is
    divided into 3 basic sections:
  1. text - the machine language or instructions for the
    program
  1. initialized data - the global variables in the program that
    have been given initial values. This region also includes all
    constants, like the literal string "Brian", or the number 5.5
  1. uninitialized data - the global variables that haven't been
    assigned initial values
  • The a.out file also has a header that specifies how the
    program is to be executed, see man a.out for a detailed
    description of this

March 3, 1998

Page 7

C201/TAM