This may not be helpful at all, but I wondered about the processing passes of gcc
. The abridged (pared down mostly to exec/fork calls) output from 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
has all the applicable logic. I imagine that is a complex program, especially after typing:
/usr/libexec/gcc/i686-redhat-linux/4.6.1/cc1 --help
and
/usr/libexec/gcc/i686-redhat-linux/4.6.1/cc1 --help=C