gccの実行過程
gccはcc1とかasとかldなどのコマンドを呼出しているラッパーなんだけど、実際それぞれのコマンドをどんなオプションを付けて呼び出しているんだろう。
こういう場合、-vオプションを付けるとよい。gcc(1)にはこんな風に書かれている。
-v Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the com- piler driver program and of the preprocessor and the compiler proper.
以下実行例。
$ cat > hoge.c int main(int argc, char *argv[]) { return 0; } $ gcc -v hoge.c Using built-in specs. Configured with: /home/nick/work/netbsd/src/tools/gcc/../../gnu/dist/gcc/configure --enable-long-long --disable-multilib --enable-threads --disable-symvers --build=i386-unknown-netbsdelf --host=i386--netbsdelf --target=i386--netbsdelf Thread model: posix gcc version 3.3.3 (NetBSD nb3 20040520) /usr/bin/../libexec/cc1 -quiet -v -iprefix /usr/bin/../libexec/ -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 hoge.c -quiet -dumpbase hoge.c -auxbase hoge -version -o /var/tmp//ccdGbG6c.s GNU C version 3.3.3 (NetBSD nb3 20040520) (i386--netbsdelf) compiled by GNU C version 3.3.3 (NetBSD nb3 20040520). GGC heuristics: --param ggc-min-expand=38 --param ggc-min-heapsize=15489 ignoring nonexistent directory "/usr/libexec/include" #include "..." search starts here: #include <...> search starts here: /usr/include End of search list. as -o /var/tmp//ccyt3E7i.o /var/tmp//ccdGbG6c.s ld -dc -dp -e __start -dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/bin/../libexec /var/tmp//ccyt3E7i.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/crtend.o /usr/lib/crtn.o