CS 361 Lecture-Module #13:
Details of Compilation



Plan for this module:
discuss compilation
    preparing for project-management

$ 
/home/mcguire/public_html/teaching/361/lectures/13/
$ 
$ 
/* |factorial.c|: program demonstrating |factorial()| of program argument" */

#include <stdlib.h>
#include <stdio.h>

int factorial(int);
 
int
main(int argc, char * argv[])
{
  if( argc != 1 + 1 ) {
    fprintf(stderr, "%s requires one integer argument\n", argv[0]);
    return  EXIT_FAILURE;
    }
  int n = atoi(argv[1]);
  printf("factorial(%i) == %i\n", n, factorial(n));
  return  EXIT_SUCCESS;
}

/* |factorial()|: calculate the factorial "n!" for the given integer n */
int
factorial(int n)
{
  return  n == 0  ?  1  :  n * factorial(n - 1);
}
$ 
$ 
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
[...]
GNU CPP version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (cpplib) (i386 Linux/ELF)
[...]
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include
 /usr/include
End of search list.
[...]
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=2 -D__GXX_ABI_VERSION=102 -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -D__i386 -D__i386__ -D__tune_i386__ factorial.c -quiet -dumpbase factorial.c -g -Wall -std=c99 -version -o /tmp/ccRpqwe3.s
GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) (i386-redhat-linux)
        compiled by GNU C version 3.2.2 20030222 (Red Hat Linux 3.2.2-5).
 as -V -Qy -o /tmp/ccA8GRr1.o /tmp/ccRpqwe3.s
GNU assembler version 2.13.90.0.18 (i386-redhat-linux) using BFD version 2.13.90.0.18 20030206
 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtbegin.o -L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2 -L/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../.. /tmp/ccA8GRr1.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crtn.o
$ 
$ 
factorial.c     a.out
$ 
$ 
factorial(5) == 120
$ 
steps of compilation:
prog.c
  |
  | C preprocessor  
  |     removes comments,
  |     handles  #comp_ctrl compilation-control commands
  |       including:
  |     #include header-file(s):  /.../include/whatever [.h] ,
  |     /                       your own  whatever.h
  |  __/
  | /  
  |/
  V
prog.i               pure C code
  |
  | C compiler  
  |
  V
prog.s                assembly-code
  |
  | assembler  
  |
  V
prog.o                object-code
  |
  | link-editor    /  ld  combines object-code with:
  |
  |    given libraries  /lib/libc.a  ,  libm.a  , ...
  |       containing  .o  files 
  |    libraries of  .o  files you may create
  |     /
  |  __/
  | /  
  |/
  |
  V
a.out

  |
  | -o  option or  mv
  |
  V
prog

for extensive information see  gcc  documentation

many steps done automatically by  gcc
options/flags for finer control:

-v
    show the steps

-E
    Stop after the preprocessing stage  cpp; do not run the compiler proper.
    The output is in the form of preprocessed source code

-S
    Stop after the stage of compilation proper; do not assemble.
    The output is in the form of an assembler code file for each
    non-assembler input file specified.
    By default, the assembler file name for a source file is made by
    replacing the suffix '.c', '.i', etc., with '.s'.


    Compile or assemble the source files, but do not link. The linking stage
    simply is not done.
    The ultimate output is in the form of an object file for each source file.
    By default, the object file name for a source file is made by replacing
    the suffix '.c', '.i', '.s', etc., with '.o'.

-c  most significant e.g. with  make  for managing program with multiple source-modules a.k.a. ""

example continuing from above:
$ 
$ 
$ 
blank space from comment: /* "factorial.c": program demonstrating |factorial()| of program argument */

inclusion of <iostream>
  found in  /fs/net/pkg/GNU/gcc/gcc-2.95.2/i386-SunOS5.7/lib/gcc-lib/i386-pc-solaris2.7/2.95.2/../../../../include/gcc-3/
  had stuff such as:
    comments which appear as blank space
    (other) compiler-directives processed and removed by  cpp
    other header-files sub-included

material still appearing from that inclusion:
typedef long _G_clock_t;
typedef unsigned long _G_dev_t;
typedef long _G_fpos_t;
typedef long _G_gid_t;
typedef unsigned long _G_ino_t;
typedef unsigned long _G_mode_t;
typedef unsigned long _G_nlink_t;
typedef long _G_off_t;
typedef long _G_pid_t;

typedef unsigned int _G_size_t;
typedef long _G_time_t;
typedef long _G_uid_t;
typedef long int _G_wchar_t;


struct _IO_FILE {
  int _flags;            


   
   
  char* _IO_read_ptr;    
  char* _IO_read_end;    
  char* _IO_read_base;   
  char* _IO_write_base;  
  char* _IO_write_ptr;   
  char* _IO_write_end;   
  char* _IO_buf_base;    
  char* _IO_buf_end;     
   
  char *_IO_save_base;  
  char *_IO_backup_base;   
  char *_IO_save_end;  

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;
  int _blksize;



  _G_off_t  _offset;



   
  unsigned short _cur_column;
  char _unused;
  char _shortbuf[1];


};


[...] _IO_stdin_, _IO_stdout_, _IO_stderr_;


[...]

inclusion of <stdlib.h>
  found in  /fs/net/pkg/GNU/gcc/gcc-2.95.2/i386-SunOS5.7/lib/gcc-lib/i386-pc-solaris2.7/2.95.2/../../../../include/gcc-3/
  had stuff such as:
    #define EXIT_FAILURE    1
    #define EXIT_SUCCESS    0
      noted and removed by  cpp
    extern int atoi(const char *);
    extern double atof(const char *);
    extern long int atol(const char *);
    extern void exit(int);

[...]


int factorial(int);
 
int
main(int argc, char * argv[])
{
  int  n;

  if( argc != 1 + 1 ) {
    fprintf(stderr, "%s requires one integer argument\n", argv[0]);
    return  1 ;         EXIT_FAILURE replaced with its value by cpp
    }
  n = atoi(argv[1]);
  printf("factorial(%i) == %i\n", n, factorial(n));
  return  0 ;           EXIT_SUCCESS replaced with its value by cpp

}
 
 
blank space from comment: /* "factorial()": calculate the factorial "n!" for the given integer n */
int
factorial(int n)
{
  return   n == 0  ?  1  :  n * factorial(n - 1) ;
}
$ 
$ 
$ 
$ 
        .file   "factorial.c"
        .file 1 "factorial.c"
        .section        .debug_abbrev,"",@progbits
.Ldebug_abbrev0:
        .section        .debug_info,"",@progbits
.Ldebug_info0:
        .section        .debug_line,"",@progbits
.Ldebug_line0:
        .text
.Ltext0:
        .file 2 "/usr/include/stdlib.h"
        .file 3 "/usr/include/bits/types.h"
        .file 4 "/usr/include/wchar.h"
        .file 5 "/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stddef.h"
        .file 6 "/usr/include/_G_config.h"
        .file 7 "/usr/include/gconv.h"
        .file 8 "/usr/include/libio.h"
        .file 9 "/usr/include/stdio.h"
        .section        .rodata
        .align 32
.LC0:
        .string "%s requires one integer argument\n"
.LC1:
        .string "factorial(%i) == %i\n"
        .text
.globl main
        .type   main,@function
main:
.LFB2:
        .loc 1 10 0
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        subl    $8, %esp
.LCFI2:
        andl    $-16, %esp
        movl    $0, %eax
        subl    %eax, %esp
.LBB2:
        .loc 1 11 0
        cmpl    $2, 8(%ebp)
        je      .L2
        .loc 1 12 0
        subl    $4, %esp
        movl    12(%ebp), %eax
        pushl   (%eax)
        pushl   $.LC0
        pushl   stderr
.LCFI3:
        call    fprintf
        addl    $16, %esp
        .loc 1 13 0
        movl    $1, -8(%ebp)
        jmp     .L1
.L2:
        .loc 1 15 0
        movl    12(%ebp), %eax
        addl    $4, %eax
        subl    $12, %esp
        pushl   (%eax)
        call    atoi
        addl    $16, %esp
        movl    %eax, -4(%ebp)
        .loc 1 16 0
        subl    $4, %esp
        subl    $8, %esp
        pushl   -4(%ebp)
.LCFI4:
        call    factorial
        addl    $12, %esp
        pushl   %eax
        pushl   -4(%ebp)
        pushl   $.LC1
.LCFI5:
        call    printf
        addl    $16, %esp
        .loc 1 17 0
        movl    $0, -8(%ebp)
.LBE2:
        .loc 1 18 0
.L1:
        movl    -8(%ebp), %eax
        leave
        ret
.LFE2:
.Lfe1:
        .size   main,.Lfe1-main
.globl factorial
        .type   factorial,@function
factorial:
.LFB4:
        .loc 1 23 0
        pushl   %ebp
.LCFI6:
        movl    %esp, %ebp
.LCFI7:
        subl    $4, %esp
.LCFI8:
        .loc 1 24 0
        cmpl    $0, 8(%ebp)
        je      .L4
        subl    $12, %esp
        movl    8(%ebp), %eax
        decl    %eax
        pushl   %eax
.LCFI9:
        call    factorial
        addl    $16, %esp
        imull   8(%ebp), %eax
        movl    %eax, -4(%ebp)
        jmp     .L5
.L4:
        movl    $1, -4(%ebp)
.L5:
        movl    -4(%ebp), %eax
        .loc 1 25 0
        leave
        ret
.LFE4:
.Lfe2:
        .size   factorial,.Lfe2-factorial
        .file 10 "/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/include/stdarg.h"
        .section        .debug_frame,"",@progbits
.Lframe0:
        .long   .LECIE0-.LSCIE0
.LSCIE0:
        .long   0xffffffff
        .byte   0x1
        .string ""
        .uleb128 0x1
        .sleb128 -4
        .byte   0x8
        .byte   0xc
        .uleb128 0x4
        .uleb128 0x4
        .byte   0x88
        .uleb128 0x1
        .align 4
.LECIE0:
.LSFDE0:
        .long   .LEFDE0-.LASFDE0
.LASFDE0:
        .long   .Lframe0
        .long   .LFB2
        .long   .LFE2-.LFB2
        .byte   0x4
        .long   .LCFI0-.LFB2
        .byte   0xe
        .uleb128 0x8
        .byte   0x85
        .uleb128 0x2
        .byte   0x4
        .long   .LCFI1-.LCFI0
        .byte   0xd
        .uleb128 0x5
        .byte   0x4
        .long   .LCFI3-.LCFI1
        .byte   0x2e
        .uleb128 0x10
        .byte   0x4
        .long   .LCFI4-.LCFI3
        .byte   0x2e
        .uleb128 0xc
        .byte   0x4
        .long   .LCFI5-.LCFI4
        .byte   0x2e
        .uleb128 0x10
        .align 4
.LEFDE0:
.LSFDE2:
        .long   .LEFDE2-.LASFDE2
.LASFDE2:
        .long   .Lframe0
        .long   .LFB4
        .long   .LFE4-.LFB4
        .byte   0x4
        .long   .LCFI6-.LFB4
        .byte   0xe
        .uleb128 0x8
        .byte   0x85
        .uleb128 0x2
        .byte   0x4
        .long   .LCFI7-.LCFI6
        .byte   0xd
        .uleb128 0x5
        .byte   0x4
        .long   .LCFI9-.LCFI7
        .byte   0x2e
        .uleb128 0x10
        .align 4
.LEFDE2:
        .text
.Letext0:
        .section        .debug_info
        .long   0xcc4
        .value  0x2
        .long   .Ldebug_abbrev0
        .byte   0x4
        .uleb128 0x1
        .long   .Ldebug_line0
        .long   .Letext0
        .long   .Ltext0
        .long   .LC193
        .long   .LC194
        .long   .LC195
        .byte   0x1
        .uleb128 0x2
        .long   0x4a
        .byte   0x8
        .byte   0x2
        .byte   0x63
        .uleb128 0x3
        .long   .LC2
            .
            .          1620 lines
            .
        .byte   0x9
        .byte   0x90
        .long   0x7c4
        .byte   0x1
        .byte   0x1
        .byte   0x0
        .section        .debug_abbrev
        .uleb128 0x1
        .uleb128 0x11
        .byte   0x1
        .uleb128 0x10
        .uleb128 0x6
        .uleb128 0x12
        .uleb128 0x1
        .uleb128 0x11
        .uleb128 0x1
        .uleb128 0x3
        .uleb128 0xe
        .uleb128 0x1b
        .uleb128 0xe
        .uleb128 0x25
            .
            .          370 lines
            .
        .uleb128 0x3f
        .uleb128 0xc
        .uleb128 0x3c
        .uleb128 0xc
        .byte   0x0
        .byte   0x0
        .byte   0x0
        .section        .debug_pubnames,"",@progbits
        .long   0x25
        .value  0x2
        .long   .Ldebug_info0
        .long   0xcc8
        .long   0x823
        .string "main"
        .long   0x86d
        .string "factorial"
        .long   0x0
        .section        .debug_aranges,"",@progbits
        .long   0x1c
        .value  0x2
        .long   .Ldebug_info0
        .byte   0x4
        .byte   0x0
        .value  0x0
        .value  0x0
        .long   .Ltext0
        .long   .Letext0-.Ltext0
        .long   0x0
        .long   0x0
        .section        .debug_str,"MS",@progbits,1
.LC180:
        .string "_G_int32_t"
.LC75:
        .string "_sbuf"
.LC150:
        .string "__time_t"
.LC25:
        .string "__GCONV_INCOMPLETE_INPUT"
.LC153:
        .string "__daddr_t"
.LC130:
        .string "__int32_t"
.LC50:
        .string "__gconv_init_fct"
.LC89:
        .string "_IO_save_end"
.LC178:
        .string "_G_iconv_t"
.LC114:
        .string "factorial"
.LC148:
        .string "__rlim64_t"
.LC26:
        .string "__GCONV_ILLEGAL_DESCRIPTOR"
.LC68:
        .string "__gconv_info"
.LC93:
        .string "_flags2"
.LC109:
        .string "short unsigned int"
.LC67:
        .string "unsigned char"
.LC94:
        .string "_old_offset"
.LC77:
        .string "_IO_FILE"
.LC151:
        .string "__useconds_t"
.LC43:
        .string "__counter"
.LC47:
        .string "__fct"
.LC5:
        .string "__val"
.LC11:
        .string "__value"
.LC185:
        .string "_IO_jump_t"
.LC69:
        .string "__nsteps"
.LC179:
        .string "_G_int16_t"
.LC38:
        .string "size_t"
.LC55:
        .string "__max_needed_from"
.LC48:
        .string "__gconv_btowc_fct"
.LC13:
        .string "__off_t"
.LC165:
        .string "__ssize_t"
.LC65:
        .string "__statep"
.LC163:
        .string "__fsfilcnt_t"
.LC98:
        .string "_IO_lock_t"
.LC70:
        .string "__steps"
.LC164:
        .string "__fsfilcnt64_t"
.LC82:
        .string "_IO_write_base"
.LC159:
        .string "__blkcnt_t"
.LC73:
        .string "_IO_marker"
.LC158:
        .string "__blksize_t"
.LC194:
        .string "/home/mcguire/public_html/teaching/361/lectures/10"
.LC171:
        .string "FILE"
.LC174:
        .string "_G_fpos64_t"
.LC177:
        .string "__gconv_t"
.LC35:
        .string "__trans_end_fct"
.LC122:
        .string "__u_int"
.LC196:
        .string "__codecvt_result"
.LC116:
        .string "div_t"
.LC162:
        .string "__fsblkcnt64_t"
.LC24:
        .string "__GCONV_ILLEGAL_INPUT"
.LC176:
        .string "__gconv_trans_init_fct"
.LC184:
        .string "__gconv_loaded_object"
.LC45:
        .string "__to_name"
.LC191:
        .string "fpos_t"
.LC95:
        .string "_cur_column"
.LC133:
        .string "__uint64_t"
.LC111:
        .string "argc"
.LC183:
        .string "__gnuc_va_list"
.LC149:
        .string "__id_t"
.LC22:
        .string "__GCONV_EMPTY_INPUT"
.LC112:
        .string "argv"
.LC71:
        .string "__cd"
.LC118:
        .string "lldiv_t"
.LC140:
        .string "__ino_t"
.LC19:
        .string "__GCONV_NOCONV"
.LC63:
        .string "__invocation_counter"
.LC144:
        .string "__pid_t"
.LC121:
        .string "__u_short"
.LC124:
        .string "long unsigned int"
.LC10:
        .string "__count"
.LC135:
        .string "__quad_t"
.LC123:
        .string "__u_long"
.LC145:
        .string "__fsid_t"
.LC23:
        .string "__GCONV_FULL_OUTPUT"
.LC57:
        .string "__max_needed_to"
.LC157:
        .string "__timer_t"
.LC58:
        .string "__stateful"
.LC131:
        .string "__uint32_t"
.LC155:
        .string "__key_t"
.LC120:
        .string "__u_char"
.LC91:
        .string "_chain"
.LC2:
        .string "quot"
.LC101:
        .string "__pad1"
.LC102:
        .string "__pad2"
.LC40:
        .string "__gconv_step"
.LC41:
        .string "__shlib_handle"
.LC56:
        .string "__min_needed_to"
.LC188:
        .string "__io_write_fn"
.LC128:
        .string "short int"
.LC137:
        .string "__dev_t"
.LC4:
        .string "long long int"
.LC39:
        .string "__gconv_trans_data"
.LC88:
        .string "_IO_backup_base"
.LC60:
        .string "__outbuf"
.LC83:
        .string "_IO_write_ptr"
.LC113:
        .string "main"
.LC134:
        .string "long long unsigned int"
.LC138:
        .string "__uid_t"
.LC8:
        .string "__wchb"
.LC129:
        .string "__uint16_t"
.LC12:
        .string "wint_t"
.LC9:
        .string "char"
.LC107:
        .string "__codecvt_error"
.LC117:
        .string "ldiv_t"
.LC136:
        .string "__u_quad_t"
.LC193:
        .string "factorial.c"
.LC79:
        .string "_IO_read_ptr"
.LC90:
        .string "_markers"
.LC34:
        .string "__gconv_trans_end_fct"
.LC62:
        .string "__flags"
.LC61:
        .string "__outbufend"
.LC72:
        .string "__combined"
.LC87:
        .string "_IO_save_base"
.LC51:
        .string "__init_fct"
.LC42:
        .string "__modname"
.LC33:
        .string "__trans_context_fct"
.LC80:
        .string "_IO_read_end"
.LC103:
        .string "_mode"
.LC195:
        .string "GNU C 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
.LC31:
        .string "__trans_fct"
.LC186:
        .string "_IO_FILE_plus"
.LC147:
        .string "__rlim_t"
.LC7:
        .string "__wch"
.LC104:
        .string "_unused2"
.LC86:
        .string "_IO_buf_end"
.LC78:
        .string "_flags"
.LC169:
        .string "__intptr_t"
.LC76:
        .string "_pos"
.LC152:
        .string "__suseconds_t"
.LC141:
        .string "__ino64_t"
.LC115:
        .string "wchar_t"
.LC97:
        .string "_shortbuf"
.LC187:
        .string "__io_read_fn"
.LC172:
        .string "__FILE"
.LC28:
        .string "__GCONV_IS_LAST"
.LC85:
        .string "_IO_buf_base"
.LC160:
        .string "__blkcnt64_t"
.LC110:
        .string "signed char"
.LC105:
        .string "__codecvt_ok"
.LC142:
        .string "__mode_t"
.LC167:
        .string "__qaddr_t"
.LC119:
        .string "__compar_fn_t"
.LC14:
        .string "__pos"
.LC52:
        .string "__gconv_end_fct"
.LC6:
        .string "unsigned int"
.LC108:
        .string "__codecvt_noconv"
.LC64:
        .string "__internal_use"
.LC20:
        .string "__GCONV_NODB"
.LC146:
        .string "__clock_t"
.LC190:
        .string "__io_close_fn"
.LC59:
        .string "__gconv_step_data"
.LC192:
        .string "stderr"
.LC175:
        .string "__gconv_trans_query_fct"
.LC170:
        .string "__socklen_t"
.LC74:
        .string "_next"
.LC132:
        .string "__int64_t"
.LC189:
        .string "__io_seek_fn"
.LC21:
        .string "__GCONV_NOMEM"
.LC17:
        .string "__off64_t"
.LC49:
        .string "__btowc_fct"
.LC99:
        .string "_lock"
.LC173:
        .string "_G_fpos_t"
.LC125:
        .string "__int8_t"
.LC81:
        .string "_IO_read_base"
.LC18:
        .string "__GCONV_OK"
.LC161:
        .string "__fsblkcnt_t"
.LC182:
        .string "_G_uint32_t"
.LC143:
        .string "__nlink_t"
.LC154:
        .string "__swblk_t"
.LC84:
        .string "_IO_write_end"
.LC100:
        .string "_offset"
.LC27:
        .string "__GCONV_INTERNAL_ERROR"
.LC15:
        .string "__mbstate_t"
.LC139:
        .string "__gid_t"
.LC156:
        .string "__clockid_t"
.LC92:
        .string "_fileno"
.LC16:
        .string "__state"
.LC32:
        .string "__gconv_trans_context_fct"
.LC37:
        .string "__next"
.LC29:
        .string "__GCONV_IGNORE_ERRORS"
.LC106:
        .string "__codecvt_partial"
.LC53:
        .string "__end_fct"
.LC66:
        .string "__trans"
.LC126:
        .string "__uint8_t"
.LC46:
        .string "__gconv_fct"
.LC44:
        .string "__from_name"
.LC54:
        .string "__min_needed_from"
.LC30:
        .string "__gconv_trans_fct"
.LC96:
        .string "_vtable_offset"
.LC3:
        .string "long int"
.LC36:
        .string "__data"
.LC168:
        .string "__caddr_t"
.LC181:
        .string "_G_uint16_t"
.LC166:
        .string "__loff_t"
.LC127:
        .string "__int16_t"
        .ident  "GCC: (GNU) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)"
$ 
$ 
$ 
$ 
factorial.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped
$ 
$ 
000000 464c457f 00010101 00000000 00000000
000010 00030001 00000001 00000000 00000000
000020 00001bdc 00000000 00000034 00280000
000030 00130016 83e58955 e48308ec 0000b8f0
000040 c4290000 02087d83 ec832474 0c458b04
000050 006830ff ff000000 00000035 fffce800
000060 c483ffff f845c710 00000001 458b3feb
000070 04c0830c ff0cec83 fffce830 c483ffff
000080 fc458910 8304ec83 75ff08ec fffce8fc
000090 c483ffff 75ff500c 002268fc fce80000
0000a0 83ffffff 45c710c4 000000f8 f8458b00
0000b0 8955c3c9 04ec83e5 00087d83 ec831974
0000c0 08458b0c fce85048 83ffffff af0f10c4
0000d0 45890845 c707ebfc 0001fc45 458b0000
0000e0 00c3c9fc 10011101 11011206 1b0e0301
0000f0 130e250e 0200000b 13010113 0b3a0b0b
000100 00000b3b 03000d03 3b0b3a0e 3813490b
000110 0400000a 0803000d 0b3b0b3a 0a381349
000120 24050000 0b080300 000b3e0b 00240600
000130 0b0b0e03 00000b3e 01010107 00134913
000140 00210800 0b2f1349 17090000 0b130101
000150 3b0b3a0b 0a00000b 0e030016 053b0b3a
000160 00001349 03000d0b 3b0b3a0e 0013490b
000170 00160c00 0b3a0e03 13490b3b 040d0000
000180 0b130101 3b0b3a0b 0e00000b 0e030028
000190 00000b1c 0101130f 0b0e0313 3b0b3a0b
0001a0 1000000b 0b0b000f 00001349 01011511
0001b0 490c2713 12000013 13490005 0f130000
0001c0 000b0b00 00261400 00001349 01011515
0001d0 000c2713 00131600 0c3c0e03 21170000
0001e0 00134900 000d1800 0b3a0e03 1349053b
0001f0 00000a38 03001619 3b0b3a0e 1a00000b
000200 13010104 0b0b0e03 0b3b0b3a 2e1b0000
000210 3f130101 3a0e030c 270b3b0b 1113490c
000220 40011201 1c00000a 0e030005 0b3b0b3a
000230 0a021349 341d0000 3a080300 490b3b0b
000240 000a0213 00051e00 0b3a0803 13490b3b
000250 00000a02 0000261f 00342000 0b3a0e03
000260 13490b3b 0c3c0c3f 01000000 06100011
000270 01120111 081b0803 05130825 c4000000
000280 0200000c 00000000 00010400 af000000
000290 00000000 ed000000 db000004 8e000001
0002a0 01000005 00004a02 63020800 0003e203
0002b0 4a610200 02000000 72040023 02006d65
0002c0 00004a62 04230200 6e690500 05040074
0002d0 00007602 6b020800 0003e203 76690200
0002e0 02000000 72040023 02006d65 0000766a
0002f0 04230200 09040600 05040000 0000a202
000300 77021000 0003e203 a2750200 02000000
000310 72040023 02006d65 0000a276 08230200
000320 04410600 05080000 0000c002 8d030800
000330 00010803 c08d0300 02000000 07000023
000340 000000d0 0000004a 0000d008 06000100
000350 000006c8 02090704 04000001 bf0a4e04
    .
    .   200 lines
    .
000fe0 64756c63 69622f65 2f007374 2f727375
000ff0 2f62696c 2d636367 2f62696c 36383369
001000 6465722d 2d746168 756e696c 2e332f78
001010 2f322e32 6c636e69 00656475 63616600
001020 69726f74 632e6c61 00000000 6c647473
001030 682e6269 00000100 65707974 00682e73
001040 77000002 72616863 0100682e 74730000
001050 66656464 0300682e 475f0000 6e6f635f
001060 2e676966 00010068 6f636700 682e766e
001070 00000100 6962696c 00682e6f 73000001
001080 6f696474 0100682e 74730000 67726164
001090 0300682e 00000000 00000205 09030000
0010a0 0864f001 56088f9c 5a72fe08 10290264
0010b0 01000202 00000001 00000000 00000000
0010c0 72207325 69757165 20736572 20656e6f
0010d0 65746e69 20726567 75677261 746e656d
0010e0 6166000a 726f7463 286c6169 20296925
0010f0 25203d3d 00000a69 00000010 ffffffff
001100 7c010001 04040c08 00000188 00000020
001110 00000000 00000000 0000007e 85080e41
001120 050d4202 70102e66 2e510c2e 00000010
001130 00000018 00000000 0000007e 00000031
001140 85080e41 050d4202 00102e51 00000025
001150 00000002 0cc80000 08230000 616d0000
001160 6d006e69 66000008 6f746361 6c616972
001170 00000000 00000000 0000001c 00000002
001180 00040000 00000000 00000000 000000af
001190 00000000 00000000 0000001c 00000002
0011a0 00040000 00000000 00000000 000000af
0011b0 00000000 00000000 695f475f 3233746e
    .
    .   350 lines
    .
0027a0 00000c01 00000cb0 00000c01 00000cbb
0027b0 00000c01 00000cce 00000501 00000cd4
0027c0 00000701 00000cd8 00000201 00000cdc
0027d0 00000201 000000e6 00000201 00000018
0027e0 00000901 0000001c 00000201 0000003c
0027f0 00000901 00000040 00000201 00000006
002800 00000601 00000006 00000601 00000010
002810 00000201 00000026 00000601 00000030
002820 00000201
002824
$ 
$ 
$ 
$ 
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped
$ 
$ 
...
$ 
$ 
factorial(5) == 120
$ 
$ 
$ 
$ 
factorial(5) == 120
$ 
that demonstrates individual steps one at a time
actually can do several at once
the flag  -S  or  -c  (or nothing) says simply stop at specified stage
can start from any prior stage
e.g.:

for things we'll be doing rem. particularly from  .c  to  .o :





summary of this lecture-module

details of compilation:


(Copyright © 2008 by Hugh McGuire   — for thoughts about this, see   http://www.cis.gvsu.edu/~mcguire/teaching/copyright_thoughts.html .)