GNU Compilation

    Cards (19)

    • When a program is written, it is stored as a source program. The source program is a sequence of bytes that each represent a text character.
    • Source programs in C have the .c extension
    • Most source programs are encoded using the ASCII standard.
    • The Compilation Process Steps
      1. Pre-processor
      2. Compiler
      3. Assembler
      4. Linker
    • The preprocessor modifies the original source program into a modified source program. The modifications are specified by preprocessor directives that begin with #.
    • Modified source programs have the .i extension instead of .c
    • The compiler translates the modified source progrram into an assembly language program.
    • The assembly language program consists of basic instructions that designate CPU register operations and the detailed execution of the program.
    • Assembly programs (.s) are human readable.
    • The assembler converts the assembly program into a relocatable object file.
    • The relocatable object file is a binary file and not human readable. It also cannot be directly run until the linker resolves all conflicts.
    • Object files are written as machine language and have the .o extension.
    • The linker merges relocatable object files with shared object files and creates an executable object file that can be loaded up and run in the system.
    • Static libraries are compiled into the application itself, while dynamic libraries are linked at runtime.
    • A static library has the .a extension, while a dynamic library has the .so extension.
    • Java, C, and Python are examples of high-level languages.
    • Assembly language is specific to the processor architecture. RISC and CISC architectures have different instruction sets and thus, different encodings for their assembly programs.
    • To translate a source program into an assembly program, use the command,
      gcc -S program.c
    • To translate the assembly program to a machine program, use the command,
      gcc -c program.s
    See similar decks