a question about gcc -v
Kai Ruottu
kai.ruottu@wippies.com
Tue Oct 19 09:48:00 GMT 2010
19.10.2010 12:05, ali hagigat kirjoitti:
> -v Print (on standard error output) the commands executed to run the stages of
> compilation. Also print the version number of the compiler driver program and
> of the preprocessor and the compiler proper.
> ------------------------------------------------------------------------------------------------------------------
> I just copied 3 lines of GCC manual in the above. What is the compiler
> driver program?
It is the '/usr/bin/gcc' which starts 'cc1' (the preprocessor/compiler),
'as' (the assembler) and 'collect2' & 'ld' (the linker) as subprocesses.
> I have Linux, Fedora 12 and after executing the following command:
> gcc -o my.o -v my.c
> I got the following output on the screen. Which message is the version
> of the preprocessor? Which message is the version of the compiler
> proper? Which message is the version of the compiler driver program?
>
> ------------------------------------------------------------------------------------------------------------------
> Using built-in specs.
> Target: i686-redhat-linux
> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info
> --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap
> --enable-shared --enable-threads=posix --enable-checking=release
> --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions --enable-gnu-unique-object
> --enable-languages=c,c++,objc,obj-c++,java,fortran,ada
> --enable-java-awt=gtk --disable-dssi --enable-plugin
> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
> --enable-libgcj-multifile --enable-java-maintainer-mode
> --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
> --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic
> --with-arch=i686 --build=i686-redhat-linux
> Thread model: posix
> gcc version 4.4.2 20091222 (Red Hat 4.4.2-20) (GCC)
> COLLECT_GCC_OPTIONS='-o' 'my.o' '-v' '-mtune=generic' '-march=i686'
The previous should come from 'gcc'...
> /usr/libexec/gcc/i686-redhat-linux/4.4.2/cc1 -quiet -v my.c -quiet
> -dumpbase my.c -mtune=generic -march=i686 -auxbase my -version -o
> /tmp/cc6TePcE.s
Just as this, showing how and from where 'cc1' was started...
> ignoring nonexistent directory
> "/usr/lib/gcc/i686-redhat-linux/4.4.2/include-fixed"
> ignoring nonexistent directory
> "/usr/lib/gcc/i686-redhat-linux/4.4.2/../../../../i686-redhat-linux/include"
> #include "..." search starts here:
> #include<...> search starts here:
> /usr/local/include
> /usr/lib/gcc/i686-redhat-linux/4.4.2/include
> /usr/include
> End of search list.
The preprocessor part of 'cc1' gives the previous...
> GNU C (GCC) version 4.4.2 20091222 (Red Hat 4.4.2-20) (i686-redhat-linux)
> compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP
> version 4.3.1, MPFR version 2.4.1.
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> Compiler executable checksum: ce871bdaf8715137a79dafbeccd13c96
> COLLECT_GCC_OPTIONS='-o' 'my.o' '-v' '-mtune=generic' '-march=i686'
This then came from the C compiler part...
> as -V -Qy -o /tmp/ccQBskTq.o /tmp/cc6TePcE.s
> GNU assembler version 2.19.51.0.14 (i686-redhat-linux) using BFD
> version version 2.19.51.0.14-34.fc12 20090722
The assembler ('as') gave this...
> COMPILER_PATH=/usr/libexec/gcc/i686-redhat-linux/4.4.2/:/usr/libexec/gcc/i686-redhat-linux/4.4.2/:/usr/libexec/gcc/i686-redhat-linux/:/usr/lib/gcc/i686-redhat-linux/4.4.2/:/usr/lib/gcc/i686-redhat-linux/:/usr/libexec/gcc/i686-redhat-linux/4.4.2/:/usr/libexec/gcc/i686-redhat-linux/:/usr/lib/gcc/i686-redhat-linux/4.4.2/:/usr/lib/gcc/i686-redhat-linux/
> LIBRARY_PATH=/usr/lib/gcc/i686-redhat-linux/4.4.2/:/usr/lib/gcc/i686-redhat-linux/4.4.2/:/usr/lib/gcc/i686-redhat-linux/4.4.2/../../../:/lib/:/usr/lib/
> COLLECT_GCC_OPTIONS='-o' 'my.o' '-v' '-mtune=generic' '-march=i686'
> /usr/libexec/gcc/i686-redhat-linux/4.4.2/collect2 --eh-frame-hdr
> --build-id -m elf_i386 --hash-style=gnu -dynamic-linker
> /lib/ld-linux.so.2 -o my.o
> /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crt1.o
> /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crti.o
> /usr/lib/gcc/i686-redhat-linux/4.4.2/crtbegin.o
> -L/usr/lib/gcc/i686-redhat-linux/4.4.2
> -L/usr/lib/gcc/i686-redhat-linux/4.4.2
> -L/usr/lib/gcc/i686-redhat-linux/4.4.2/../../.. /tmp/ccQBskTq.o -lgcc
> --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s
> --no-as-needed /usr/lib/gcc/i686-redhat-linux/4.4.2/crtend.o
> /usr/lib/gcc/i686-redhat-linux/4.4.2/../../../crtn.o
The linker ('collect2' & 'ld') gave this...
So the preprocessor and the real compiler are nowadays integrated
into the 'cc1' executable in '$prefix/libexec/gcc/$target/$gcc_version'.
More information about the Gcc-help
mailing list