On Tue, Dec 29, 2009 at 6:50 PM, Rafael Espindola <espind...@google.com> wrote: >> I have the lto1 command line, yes. But that gives a different failure. >> When run from gcc, lto1 crashes with an ICE, and when I run lto1 >> standalone, it crashes with an error reading a hex number. > > Do you have a backtrace of that? > You can also copy the gcc line and pass -wrapper to it.
Here's what I'm trying to do: stev...@iowa:~/devel/build/gcc$ ./xgcc -B. -O2 -flto -c -o t.o t.c stev...@iowa:~/devel/build/gcc$ ./xgcc -B. -O2 -flto -r -o t.o t.c -nostdlib In file included from :0:0: t.c: In function 'foo': t.c:7:6: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: ././xgcc returned 1 exit status collect2: lto-wrapper returned 1 exit status stev...@iowa:~/devel/build/gcc$ ./xgcc -B. -O2 -flto -c -o t.o t.c stev...@iowa:~/devel/build/gcc$ ./xgcc -B. -O2 -flto -r -o t.o t.c -nostdlib -save-temps t.o: file not recognized: File truncated collect2: ld returned 1 exit status stev...@iowa:~/devel/build/gcc$ stev...@iowa:~/devel/build/gcc$ ./xgcc -B. -O2 -flto -r -o t.o t.c -nostdlib -Wl,-debug -v Reading specs from ./specs COLLECT_GCC=./xgcc COLLECT_LTO_WRAPPER=./lto-wrapper Target: ia64-unknown-linux-gnu Configured with: ../trunk/configure --with-gmp=/home/stevenb --with-mpfr=/home/stevenb --with-mpc=/home/stevenb --enable-languages=c --disable-nls --disable-bootstrap --disable-libmudflap --disable-checking Thread model: posix gcc version 4.5.0 20091229 (experimental) [trunk revision 155504] (GCC) COLLECT_GCC_OPTIONS='-B.' '-O2' '-flto' '-r' '-o' 't.o' '-nostdlib' '-v' ./cc1 -quiet -v -iprefix /home/stevenb/devel/build/gcc/../lib/gcc/ia64-unknown-linux-gnu/4.5.0/ -isystem ./include -isystem ./include-fixed t.c -quiet -dumpbase t.c -auxbase t -O2 -version -flto -o /tmp/ccrkWvWJ.s GNU C (GCC) version 4.5.0 20091229 (experimental) [trunk revision 155504] (ia64-unknown-linux-gnu) compiled by GNU C version 4.3.4, GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/home/stevenb/devel/build/gcc/../lib/gcc/ia64-unknown-linux-gnu/4.5.0/include" ignoring nonexistent directory "/home/stevenb/devel/build/gcc/../lib/gcc/ia64-unknown-linux-gnu/4.5.0/include-fixed" ignoring nonexistent directory "/home/stevenb/devel/build/gcc/../lib/gcc/ia64-unknown-linux-gnu/4.5.0/../../../../ia64-unknown-linux-gnu/include" ignoring nonexistent directory "/home/stevenb/devel/build/gcc/../lib/gcc/../../lib/gcc/ia64-unknown-linux-gnu/4.5.0/include" ignoring nonexistent directory "/home/stevenb/devel/build/gcc/../lib/gcc/../../lib/gcc/ia64-unknown-linux-gnu/4.5.0/include-fixed" ignoring nonexistent directory "/home/stevenb/devel/build/gcc/../lib/gcc/../../lib/gcc/ia64-unknown-linux-gnu/4.5.0/../../../../ia64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: ./include ./include-fixed /usr/local/include /usr/include End of search list. GNU C (GCC) version 4.5.0 20091229 (experimental) [trunk revision 155504] (ia64-unknown-linux-gnu) compiled by GNU C version 4.3.4, GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 32e44dfa726727a33cceaeab86c3ae9a COLLECT_GCC_OPTIONS='-B.' '-O2' '-flto' '-r' '-o' 't.o' '-nostdlib' '-v' ./as -x -o /tmp/ccKl30Yq.o /tmp/ccrkWvWJ.s COMPILER_PATH=./ LIBRARY_PATH=./:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-B.' '-O2' '-flto' '-r' '-o' 't.o' '-nostdlib' '-v' ./collect2 -flto -dynamic-linker /lib/ld-linux-ia64.so.2 -o t.o -r -L. /tmp/ccKl30Yq.o -debug Convert string './' into prefixes, separator = ':' - add prefix: ./ Convert string '/home/stevenb/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games' into prefixes, separator = ':' - add prefix: /home/stevenb/bin/ - add prefix: /usr/local/bin/ - add prefix: /usr/bin/ - add prefix: /bin/ - add prefix: /usr/bin/X11/ - add prefix: /usr/games/ Looking for 'real-ld' Looking for 'collect-ld' Looking for 'gnm' Looking for 'gnm' Looking for 'nm' Looking for 'gstrip' Looking for 'gstrip' Looking for 'strip' Looking for 'strip' Looking for './xgcc' collect2 version 4.5.0 20091229 (experimental) [trunk revision 155504] (IA-64) Linux ld_file_name = ./collect-ld c_file_name = ././xgcc nm_file_name = ./nm strip_file_name = /usr/bin/strip c_file = /tmp/ccZ1OjzU.c o_file = /tmp/ccssBfZE.o COLLECT_GCC_OPTIONS = '-B.' '-O2' '-flto' '-r' '-o' 't.o' '-nostdlib' '-v' COLLECT_GCC = ./xgcc COMPILER_PATH = ./ LIBRARY_PATH = ./:/lib/:/usr/lib/ ./collect-ld -dynamic-linker /lib/ld-linux-ia64.so.2 -o t.o -r -L. /tmp/ccKl30Yq.o ./nm -n /tmp/ccKl30Yq.o nm output with LTO info marker symbol. 0000000000000000 T foo 0000000000000001 C gnu_lto_v1 ./lto-wrapper ././xgcc -B. -O2 -flto -r -o t.o -nostdlib -v -debug /tmp/ccKl30Yq.o ././xgcc @/tmp/ccKuqXmD.args Reading specs from ./specs COLLECT_GCC=././xgcc COLLECT_LTO_WRAPPER=./lto-wrapper Target: ia64-unknown-linux-gnu Configured with: ../trunk/configure --with-gmp=/home/stevenb --with-mpfr=/home/stevenb --with-mpc=/home/stevenb --enable-languages=c --disable-nls --disable-bootstrap --disable-libmudflap --disable-checking Thread model: posix gcc version 4.5.0 20091229 (experimental) [trunk revision 155504] (GCC) COLLECT_GCC_OPTIONS='-combine' '-c' '-o' '/tmp/ccSrQtLT.lto.o' '-B.' '-O2' '-r' '-nostdlib' '-v' ./lto1 -quiet -dumpbase ccKl30Yq.o -auxbase-strip /tmp/ccSrQtLT.lto.o -O2 -version @/tmp/cc9NtICT -o /tmp/ccguEU3C.s GNU GIMPLE (GCC) version 4.5.0 20091229 (experimental) [trunk revision 155504] (ia64-unknown-linux-gnu) compiled by GNU C version 4.3.4, GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU GIMPLE (GCC) version 4.5.0 20091229 (experimental) [trunk revision 155504] (ia64-unknown-linux-gnu) compiled by GNU C version 4.3.4, GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 In file included from :0:0: t.c: In function 'foo': t.c:7:6: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: ././xgcc returned 1 exit status [Leaving LTRANS /tmp/ccSrQtLT.lto.o] [Leaving LTRANS /tmp/ccKuqXmD.args] collect2: lto-wrapper returned 1 exit status [Leaving /tmp/ccZ1OjzU.c] [Leaving /tmp/ccssBfZE.o] [Leaving /tmp/ccZ0Yspp.ld] [Leaving /tmp/ccYvlGN9.le] [Leaving t.o] stev...@iowa:~/devel/build/gcc$ (BTW, why is the "GNU GIMPLE ..." written twice by lto1?) At this point, I would like to do "././xgcc @/tmp/ccITy4iP.args" with -wrapper. But since compiling with -save-temps didn't work, the .args file references the wrong files (or something -- anyway it doesn't work): stev...@iowa:~/devel/build/gcc$ ././xgcc @/tmp/ccITy4iP.args xgcc: /tmp/cck6JT4A.o: No such file or directory xgcc: warning: '-x lto' after last input file has no effect xgcc: no input files Then I tried (somewhat naive, I suppose) to run lto1 like so: stev...@iowa:~/devel/build/gcc$ ./lto1 -quiet -dumpbase ccKl30Yq.o -auxbase-strip /tmp/ccSrQtLT.lto.o -O2 -version @/tmp/cc9NtICT -o /tmp/ccguEU3C.s GNU GIMPLE (GCC) version 4.5.0 20091229 (experimental) [trunk revision 155504] (ia64-unknown-linux-gnu) compiled by GNU C version 4.3.4, GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 lto1: internal compiler error: could not parse hex number Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. stev...@iowa:~/devel/build/gcc$ Thinking about it now, this of course also fails because the referenced files in /tmp do not exist. Anyway, that should still not ICE. Backtrace for that looks like this: Starting program: /home/stevenb/devel/build/gcc/lto1 -quiet -dumpbase ccKl30Yq.o -auxbase-strip /tmp/ccSrQtLT.lto.o -O2 -version @/tmp/cc9NtICT -o /tmp/ccguEU3C.s GNU GIMPLE (GCC) version 4.5.0 20091229 (experimental) [trunk revision 155504] (ia64-unknown-linux-gnu) compiled by GNU C version 4.3.4, GMP version 4.2.4, MPFR version 2.4.1, MPC version 0.8 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Breakpoint 2, internal_error (gmsgid=0x400000000164a460 "could not parse hex number") at ../../trunk/gcc/diagnostic.c:672 672 va_start (ap, gmsgid); (gdb) bt 10 #0 internal_error (gmsgid=0x400000000164a460 "could not parse hex number") at ../../trunk/gcc/diagnostic.c:672 #1 0x40000000000e5b70 in lto_parse_hex (p=0x60000fffffe43957 "mp/cc9NtICT") at ../../trunk/gcc/lto/lto.c:268 #2 0x40000000000f6230 in lto_elf_file_open (filename=0x60000fffffe43954 "@/tmp/cc9NtICT", writable=0 '\0') at ../../trunk/gcc/lto/lto-elf.c:563 #3 0x40000000000f1c80 in lto_read_all_file_options () at ../../trunk/gcc/lto/lto.c:1748 #4 0x40000000000c3210 in lto_post_options (pfilename=0x60000000000995f8) at ../../trunk/gcc/lto/lto-lang.c:669 #5 0x4000000000ab76b0 in process_options () at ../../trunk/gcc/toplev.c:1788 #6 0x4000000000aba220 in do_compile () at ../../trunk/gcc/toplev.c:2371 #7 0x4000000000aba5f0 in toplev_main (argc=11, argv=0x60000fffffe43698) at ../../trunk/gcc/toplev.c:2429 #8 0x40000000000f97e0 in main (argc=11, argv=0x60000fffffe43698) at ../../trunk/gcc/main.c:35 (gdb) Hope this helps... Ciao! Steven