Tuesday, October 21, 2008

Ever wonder just what gcc does?

Terry@vectra-$ cat > test.c
#include <stdio.h>

int
main(int argc, char **argv) {

        int i;

        printf("%s ", argv[0]);
        for (i=1; i < argc; ++i) {
                if (argv[i][0] != '\0') {
                        printf("%s ", argv[i]);
                }
        }
        return printf("\n");
}

Terry@vectra-$ gcc -v test.c -o test-bin
Reading specs from /usr/lib/gcc-lib/i386-unknown-openbsd4.3/3.3.5/specs
Configured with:
Thread model: single
gcc version 3.3.5 (propolice)
 /usr/lib/gcc-lib/i386-unknown-openbsd4.3/3.3.5/cc1 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=5 test.c -quiet -dumpbase test.c -auxbase test -Wall -W -Wpointer-arith -Wbad-function-cast -std=c99 -version -o /tmp//ccj26536.s
GNU C version 3.3.5 (propolice) (i386-unknown-openbsd4.3)
        compiled by GNU C version 3.3.5 (propolice).
GGC heuristics: --param ggc-min-expand=46 --param ggc-min-heapsize=30393
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
End of search list.
 as -o /tmp//cca26536.o /tmp//ccj26536.s
 /usr/lib/gcc-lib/i386-unknown-openbsd4.3/3.3.5/collect2 --eh-frame-hdr -e __start -Bdynamic -dynamic-linker /usr/libexec/ld.so -o test-bin /usr/lib/crt0.o /usr/lib/crtbegin.o -L/usr/lib/gcc-lib/i386-unknown-openbsd4.3/3.3.5 /tmp//cca26536.o -lgcc -lc -lgcc /usr/lib/crtend.o
Terry@vectra-$ ./test-bin arg1 arg2 arg3 arg4 arg5
./test-bin arg1 arg2 arg3 arg4 arg5
Terry@vectra-$

No comments:

Post a Comment