一通りの機能を網羅した GCC フロントエンドを作っていきます.
コンパイルには gcc 本体のソース (4.x 以降) が必要です.
開発ブログ : http://alohakun.blog7.fc2.com/blog-category-35.html
This is a minimal frontend sample.
For any input .bl file, this frontend only output an executable file or assembly source code correcponding to the following c source code :
int main() {return 0;}
For example :
$ cat null.bl
$ ../bin/gcc null.bl
$ ls
a.out null.bl
$ ./a.out
$ ../bin/gcc -S null.bl
$ cat null.s
.file "null.bl"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
movl $0, %eax
popl %ebp
ret
.size main, .-main
.ident "GCC: (GNU) 4.3.0"
.section .note.GNU-stack,"",@progbits
Build example
$ mkdir -p /usr/local/build-gcc/build-bl
$ tar jxvf gcc-4.3.0.tar.bz2 -C /usr/local/build-gcc
$ tar jxvf bl-minimal-4.3.0.tar.bz2 -C /usr/local/build-gcc/gcc/
$ cd /usr/local/build-gcc/build-bl
$ ../gcc-4.3.0/configure --prefix=/usr/local/build-gcc/build-bl --enable-languages=bl --enable-checking=all --disable-nls --disable-bootstrap
$ make && make install