Bug 42581 - "gcc -v" doesn't work with lto
Summary: "gcc -v" doesn't work with lto
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-02 19:13 UTC by H.J. Lu
Modified: 2010-01-04 17:34 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-01-02 20:26:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2010-01-02 19:13:42 UTC
[hjl@gnu-6 gcc]$ ./xgcc -B. -o t t1.o t2.o  -fwhopr -O -fdump-tree-optimized -v
Reading specs from ./specs
COLLECT_GCC=./xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure --enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.5.0 --with-local-prefix=/usr/local --with-plugin-ld=ld.gold --enable-gold
Thread model: posix
gcc version 4.5.0 20100102 (experimental) (GCC) 
COMPILER_PATH=./
LIBRARY_PATH=./:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-B.' '-o' 't' '-fwhopr' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic'
 ./collect2 -fwhopr --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o t /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o ./crtbegin.o -L. -L/lib/../lib64 -L/usr/lib/../lib64 t1.o t2.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed ./crtend.o /usr/lib/../lib64/crtn.o
Reading specs from ./specs
COLLECT_GCC=././xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure --enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.5.0 --with-local-prefix=/usr/local --with-plugin-ld=ld.gold --enable-gold
Thread model: posix
gcc version 4.5.0 20100102 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-combine' '-c' '-fltrans-output-list=/tmp/ccFzFDK6.ltrans.out' '-fwpa' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic'
 ./lto1 -quiet -dumpbase t1.o -dumpbase t -dumpdir ./ -mtune=generic -auxbase t1 -O -version -fltrans-output-list=/tmp/ccFzFDK6.ltrans.out -fwpa -fdump-tree-optimized @/tmp/cc1mIiH6
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Reading specs from ./specs
COLLECT_GCC=././xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure --enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.5.0 --with-local-prefix=/usr/local --with-plugin-ld=ld.gold --enable-gold
Thread model: posix
gcc version 4.5.0 20100102 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't2.wpa.ltrans.o'
 ./lto1 -quiet -dumpbase t2.wpa.o -dumpbase t -dumpdir ./ -mtune=generic -auxbase-strip t2.wpa.ltrans.o -O -version -fdump-tree-optimized -fltrans t2.wpa.o -o /tmp/ccMCxira.s
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't2.wpa.ltrans.o'
 ./as -V -Qy -o t2.wpa.ltrans.o /tmp/ccMCxira.s
GNU assembler version 2.20.51.0.5 (x86_64-unknown-linux-gnu) using BFD version (Linux/GNU Binutils) 2.20.51.0.5.20091221
COMPILER_PATH=./:./
LIBRARY_PATH=./:/lib/../lib64/../lib64/:/usr/lib/../lib64/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:./:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't2.wpa.ltrans.o'
Reading specs from ./specs
COLLECT_GCC=././xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure --enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.5.0 --with-local-prefix=/usr/local --with-plugin-ld=ld.gold --enable-gold
Thread model: posix
gcc version 4.5.0 20100102 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't1.wpa.ltrans.o'
 ./lto1 -quiet -dumpbase t1.wpa.o -dumpbase t -dumpdir ./ -mtune=generic -auxbase-strip t1.wpa.ltrans.o -O -version -fdump-tree-optimized -fltrans t1.wpa.o -o /tmp/cc0ADOW8.s
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't1.wpa.ltrans.o'
 ./as -V -Qy -o t1.wpa.ltrans.o /tmp/cc0ADOW8.s
GNU assembler version 2.20.51.0.5 (x86_64-unknown-linux-gnu) using BFD version (Linux/GNU Binutils) 2.20.51.0.5.20091221
COMPILER_PATH=./:./
LIBRARY_PATH=./:/lib/../lib64/../lib64/:/usr/lib/../lib64/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:./:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't1.wpa.ltrans.o'
COMPILER_PATH=./:./
LIBRARY_PATH=./:/lib/../lib64/../lib64/:/usr/lib/../lib64/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:./:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-combine' '-c' '-fltrans-output-list=/tmp/ccFzFDK6.ltrans.out' '-fwpa' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic'
[hjl@gnu-6 gcc]$ 

It doesn't show what gcc is doing with lto. I have to add "-Wl,-v":

[hjl@gnu-6 gcc]$ ./xgcc -B. -o t t1.o t2.o  -fwhopr -O -fdump-tree-optimized -v -Wl,-v
Reading specs from ./specs
COLLECT_GCC=./xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure --enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.5.0 --with-local-prefix=/usr/local --with-plugin-ld=ld.gold --enable-gold
Thread model: posix
gcc version 4.5.0 20100102 (experimental) (GCC) 
COMPILER_PATH=./
LIBRARY_PATH=./:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-B.' '-o' 't' '-fwhopr' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic'
 ./collect2 -fwhopr --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o t /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o ./crtbegin.o -L. -L/lib/../lib64 -L/usr/lib/../lib64 t1.o t2.o -v -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed ./crtend.o /usr/lib/../lib64/crtn.o
collect2 version 4.5.0 20100102 (experimental) (x86-64 Linux/ELF)
./collect-ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o t /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o ./crtbegin.o -L. -L/lib/../lib64 -L/usr/lib/../lib64 t1.o t2.o -v -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed ./crtend.o /usr/lib/../lib64/crtn.o
GNU ld (Linux/GNU Binutils) 2.20.51.0.5.20091221
 ./nm -n /usr/lib/../lib64/crt1.o
 ./nm -n /usr/lib/../lib64/crti.o
 ./nm -n ./crtbegin.o
 ./nm -n t1.o
 ./nm -n t2.o
 ./nm -n ./crtend.o
 ./nm -n /usr/lib/../lib64/crtn.o
./lto-wrapper ././xgcc -B. -o t -fwhopr -O -fdump-tree-optimized -v -mtune=generic t1.o t2.o
Reading specs from ./specs
COLLECT_GCC=././xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure --enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.5.0 --with-local-prefix=/usr/local --with-plugin-ld=ld.gold --enable-gold
Thread model: posix
gcc version 4.5.0 20100102 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-combine' '-c' '-fltrans-output-list=/tmp/ccjvu7WH.ltrans.out' '-fwpa' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic'
 ./lto1 -quiet -dumpbase t1.o -dumpbase t -dumpdir ./ -mtune=generic -auxbase t1 -O -version -fltrans-output-list=/tmp/ccjvu7WH.ltrans.out -fwpa -fdump-tree-optimized @/tmp/ccglEdLH
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Reading specs from ./specs
COLLECT_GCC=././xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure --enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.5.0 --with-local-prefix=/usr/local --with-plugin-ld=ld.gold --enable-gold
Thread model: posix
gcc version 4.5.0 20100102 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't2.wpa.ltrans.o'
 ./lto1 -quiet -dumpbase t2.wpa.o -dumpbase t -dumpdir ./ -mtune=generic -auxbase-strip t2.wpa.ltrans.o -O -version -fdump-tree-optimized -fltrans t2.wpa.o -o /tmp/ccn6yo2K.s
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't2.wpa.ltrans.o'
 ./as -V -Qy -o t2.wpa.ltrans.o /tmp/ccn6yo2K.s
GNU assembler version 2.20.51.0.5 (x86_64-unknown-linux-gnu) using BFD version (Linux/GNU Binutils) 2.20.51.0.5.20091221
COMPILER_PATH=./:./
LIBRARY_PATH=./:/lib/../lib64/../lib64/:/usr/lib/../lib64/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:./:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't2.wpa.ltrans.o'
Reading specs from ./specs
COLLECT_GCC=././xgcc
COLLECT_LTO_WRAPPER=./lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /export/gnu/import/git/gcc/configure --enable-languages=c,c++ --disable-bootstrap --prefix=/usr/gcc-4.5.0 --with-local-prefix=/usr/local --with-plugin-ld=ld.gold --enable-gold
Thread model: posix
gcc version 4.5.0 20100102 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't1.wpa.ltrans.o'
 ./lto1 -quiet -dumpbase t1.wpa.o -dumpbase t -dumpdir ./ -mtune=generic -auxbase-strip t1.wpa.ltrans.o -O -version -fdump-tree-optimized -fltrans t1.wpa.o -o /tmp/ccmzHqSJ.s
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU GIMPLE (GCC) version 4.5.0 20100102 (experimental) (x86_64-unknown-linux-gnu)
	compiled by GNU C version 4.4.2 20091222 (Red Hat 4.4.2-20), GMP version 4.3.1, MPFR version 2.4.2, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't1.wpa.ltrans.o'
 ./as -V -Qy -o t1.wpa.ltrans.o /tmp/ccmzHqSJ.s
GNU assembler version 2.20.51.0.5 (x86_64-unknown-linux-gnu) using BFD version (Linux/GNU Binutils) 2.20.51.0.5.20091221
COMPILER_PATH=./:./
LIBRARY_PATH=./:/lib/../lib64/../lib64/:/usr/lib/../lib64/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:./:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-combine' '-c' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic' '-fltrans' '-o' 't1.wpa.ltrans.o'
COMPILER_PATH=./:./
LIBRARY_PATH=./:/lib/../lib64/../lib64/:/usr/lib/../lib64/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/lib/../lib64/:/usr/lib/../lib64/:./:/lib/../lib64/:/usr/lib/../lib64/:/lib/:/usr/lib/:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-combine' '-c' '-fltrans-output-list=/tmp/ccjvu7WH.ltrans.out' '-fwpa' '-B.' '-dumpbase' 't' '-dumpdir' './' '-O' '-fdump-tree-optimized' '-v' '-mtune=generic'
./collect-ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o t /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o ./crtbegin.o -L. -L/lib/../lib64 -L/usr/lib/../lib64 t2.wpa.ltrans.o t1.wpa.ltrans.o -v -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed ./crtend.o /usr/lib/../lib64/crtn.o
GNU ld (Linux/GNU Binutils) 2.20.51.0.5.20091221
[hjl@gnu-6 gcc]$
Comment 1 Richard Biener 2010-01-02 20:26:25 UTC
Confirmed.  But -save-temps also doesn't work completely for -fwhopr (and you
need to set the collect2 env vars for -fwhopr).

The proper fix for 4.6 is to move most of the LTO handling to the gcc driver,
away from collect2, lto-wrapper and lto1.
Comment 2 H.J. Lu 2010-01-03 19:16:11 UTC
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00116.html
Comment 3 hjl@gcc.gnu.org 2010-01-04 14:42:53 UTC
Subject: Bug 42581

Author: hjl
Date: Mon Jan  4 14:42:38 2010
New Revision: 155616

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155616
Log:
Turn on trace in collect2 if needed

2010-01-04  H.J. Lu  <hongjiu.lu@intel.com>

	PR lto/42581
	* collect2.c (main): Turn on trace in collect2 if -v is passed
	to gcc with LTO.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/collect2.c

Comment 4 H.J. Lu 2010-01-04 17:34:24 UTC
I am marking this one fixed.