Re: some questions about the output of gcc -v

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I have copied gcc output of a simple C program as follows.
> COLLECT_GCC_OPTIONS has been repeated 3 times. Does it mean the
> compilation has 3 passes?

Mhhhh, a kind of. COLLECT_GCC_OPTIONS is just an environment variable
which is passed to all GCC sub-processes (compiler, assembler, linker) and
its value is just repeated before each sub-process invocation.

> Which of them is considered for compilation and when?

See the description of the different phases below.

>  as -V -Qy -o /tmp/ccb2pBgG.o /tmp/ccQNR8AL.s

This is the invocation of the assembler (e.g. GNU assembler from the
binutils package)


A short explanation of the output:

[GCC DRIVER]
> 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='-v' '-o' 'prog1' '-mtune=generic' '-march=i686'


[Invocation of the compiler proper, cc1]
>  /usr/libexec/gcc/i686-redhat-linux/4.4.2/cc1 -quiet -v prog1.c -quiet
> -dumpbase prog1.c -mtune=generic -march=i686 -auxbase prog1 -version
> -o /tmp/ccQNR8AL.s

[COMPILER OUTPUT]
> 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.
> 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

[GCC DRIVER]
> COLLECT_GCC_OPTIONS='-v' '-o' 'prog1' '-mtune=generic' '-march=i686'

[Assembler invocation]
>  as -V -Qy -o /tmp/ccb2pBgG.o /tmp/ccQNR8AL.s
> GNU assembler version 2.19.51.0.14 (i686-redhat-linux) using BFD
> version version 2.19.51.0.14-34.fc12 20090722

[GCC DRIVER]
> 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='-v' '-o' 'prog1' '-mtune=generic' '-march=i686'

[Invocation of collect2, which usually calls the linker 'ld']
>  /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 prog1
> /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/ccb2pBgG.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
> -------------------------------------------

Though, you got in total 3 phases which all get called by compiler driver
program 'gcc':

* compiler: cc1
* assembler: as
* linker: collect2/ld

Andi


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux