目前分類:Compiler (5)

瀏覽方式: 標題列表 簡短摘要
1. Build binary utilities
2. Build bootstrap compiler without glibc
3. Build C library

nix 發表在 痞客邦 留言(0) 人氣()

Build a cross compiler for nommu architecture and the cross compiler should be able to generate excutables with ELF or bFLT file format.

OS: Ubuntu 7.10

nix 發表在 痞客邦 留言(0) 人氣()

Platform: i386
OS: Linux

nix 發表在 痞客邦 留言(0) 人氣()

Reference data: The Definitive Guide to GCC, second edition, William von Hagen
Environment: Ubuntu 7.10
Prerequisite: Prepare about 1.5 GB free disk space for building and installing GCC.

nix 發表在 痞客邦 留言(0) 人氣()

  • By default, gcc compiles the source code, assembles the assembly language code the compiler produces, and invokes the UNIX loader, Id, to produce an executable file.
  • Preprocessing: This step resolves directives like #define, #include, and #if. Like many UNIX systems, gcc invokes a separate utility called cpp to do the preprocessing.
  • Compilation: This produces assembly language from the input files; since the assembler is usually invoked right away, the output is not normally saved in files.
  • Assembly: This takes the assembly language as input and produces object files with extensions. While some compilers build in the assembly capability, gcc does it by internally invoking a separate utility called the assembler, gas. GNU assemblers aren't available for all architectures; if the GNU assembler isn't available, gcc invokes the "native" assembler (as).
  • Linking: This is the final stage, where the modules are placed in their proper places in the executable file. Library functions that the program refers to are also placed in the file. (Systems with shared libraries use a slightly more complicated method.)
    UNIX compilers perform this phase by internally invoking the linker, which is called ld
    .
  • gcc also cleans up by deleting any object files that it created from source files (but not any pre-existing object files that you specified on the command line).
  • ld stands for "link editor" initially, but we haven't heard anybody use this term for years. In some early UNIX documentation, ld is also called a "loader," which can be confusing because most people think of loading as reading the executable file into memory at run time.
  • General options:

-o

Naming the output (executable) file.

nix 發表在 痞客邦 留言(0) 人氣()