Tcc 源码分析:第一步编译 (Tcc Source code analysis: First Step Compiling)

Tcc 源码分析:第一步编译
Tcc Source code analysis: First Step Compiling

Tiny C Compiler

  1. http://bellard.org/tcc/ 下载地址(download URL)
  2. 解压缩 tcc (decompress tcc)
  3. 像编译其他开源软件那样编译,tcc 规模较小 ( compiled as other open source, tcc is small size software)
  4. 复制编译好的libtcc1.a到/usr/local/lib/tcc/ (after compiling finished, copy libtcc1.a to /usr/local/lib/tcc)
    cp libtcc1.a /usr/local/lib/tcc

编译直接./configure && make (compile use command ./configure && make)

可以配置-g打开调试配置,以方便后续用gdb调试 (use -g to enable debug for gdb)

./tcc 1.c -o 1 来生成执行文件 (./tcc 1.c -o 1 to generate executable file)

[code]

#include <stdlib.h>

int main(int argc,char **argv)
{
int x = 0;
printf(“%d”,x);
return 0;
}

[/code]

Leave a Reply