且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么交叉编译器有两个阶段的编译?

更新时间:2023-09-16 10:19:46

我不确定为什么gcc具有如此复杂的构建过程。我基于clang / LLVM的ELLCC( http://ellcc.org )跨工具链项目的构建如下:

I'm not sure why gcc has such a complicated build process. My clang/LLVM based ELLCC (http://ellcc.org) cross tool chain project builds like this:


  1. 编译编译器(使用gcc或网站上提供的ELLCC编译器的预构建版本。)

  2. 使用编译器为所有目标构建C ++和C库。

  3. 为所有目标构建binutils和gdb(对于所有目标:请勿创建目标特定的实用工具, ld,gdb,objdump等都支持此功能)。

  4. (可选)使用新构建的编译器为所有目标交叉构建。

  1. Compile the compiler (using either gcc or a pre-built version of the ELLCC compiler available from the web site.).
  2. Use the compiler to build the C++ and C libraries for all targets.
  3. Build binutils and gdb for all targets (for all targets: don't make target specific utilitities except for the assemblers. ld, gdb, objdump, etc. all support this)
  4. (optional) Use your newly built compiler to cross build itself for all the targets.

BTW,ELLCC当前支持适用于Linux和裸机执行环境的ARM,Microblaze,Mips,PowerPC和x86目标。

BTW, ELLCC currently supports ARM, Microblaze, Mips, PowerPC, and x86 targets for Linux and bare metal execution environments.