这可能根本没有帮助,但我想知道gcc
. 删节的(主要减少到 exec/fork 调用)输出来自strace -f -o gcc.strace gcc -c tstamp.c
:
7141 execve("/usr/bin/gcc", ["gcc", "-c", "tstamp.c"], [/* 52 vars */]) = 0
7141 open("/tmp/ccqzaCI4.s", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = 3
7141 close(3) = 0
7141 vfork( <unfinished ...>
7142 execve("/usr/libexec/gcc/i686-redhat-linux/4.6.1/cc1", ["/usr/libexec/gcc/i686-redhat-lin"..., "-quiet", "tstamp.c", "-quiet", "-dumpbase", "tstamp.c", "-mtune=generic", "-march=i686", "-auxbase", "tstamp", "-o", "/tmp/ccqzaCI4.s"], [/* 55 vars */] <unfinished ...>
7141 <... vfork resumed> ) = 7142
7141 waitpid(7142, <unfinished ...>
7142 <... execve resumed> ) = 0
7142 open("tstamp.c", O_RDONLY|O_NOCTTY|O_LARGEFILE) = 3
7142 close(3) = 0
7142 open("/tmp/ccqzaCI4.s", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
7142 open("/usr/include/stdio.h", O_RDONLY|O_NOCTTY|O_LARGEFILE) = 4
... (opens and closes every include file)
7142 close(4) = 0
7142 close(3) = 0
7142 exit_group(0) = ?
7141 <... waitpid resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 7142
7141 vfork( <unfinished ...>
7143 execve("/usr/bin/as", ["as", "--32", "-o", "tstamp.o", "/tmp/ccqzaCI4.s"], [/* 55 vars */] <unfinished ...>
7141 <... vfork resumed> ) = 7143
7141 waitpid(7143, <unfinished ...>
7143 <... execve resumed> ) = 0
7143 unlink("tstamp.o") = 0
7143 open("tstamp.o", O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
7143 open("/tmp/ccqzaCI4.s", O_RDONLY|O_LARGEFILE) = 4
7143 close(4) = 0
7143 close(3) = 0
7143 exit_group(0) = ?
7141 <... waitpid resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0) = 7143
7141 unlink("/tmp/ccqzaCI4.s") = 0
7141 exit_group(0) = ?
cc1
具有所有适用的逻辑。我想这是一个复杂的程序,尤其是在输入以下内容后:
/usr/libexec/gcc/i686-redhat-linux/4.6.1/cc1 --help
和
/usr/libexec/gcc/i686-redhat-linux/4.6.1/cc1 --help=C