Likely because .gnu.lto_* sections remain in the final executables (like for example cc1-dummy) bootstrap with BOOT_CFLAGS="-O2 -flto -g" BOOT_LDFLAGS="-flto" currently fails at comparing stage2 and stage3. Comparing stage2 and stage3 cc1-dummy readelf -S output reveals: --- a 2009-08-15 17:25:19.000000000 +0200 +++ b 2009-08-15 17:25:22.000000000 +0200 @@ -1,4 +1,4 @@ -There are 13739 section headers, starting at offset 0x67e1b6c: +There are 13739 section headers, starting at offset 0x67e3424: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al @@ -29,13718 +29,13718 @@ [24] .bss NOBITS 08b090c0 ac00c0 06f6b8 00 WA 0 0 32 [25] .gnu.lto_.referen PROGBITS 00000000 ac00c0 0019c6 00 0 0 4 [26] .gnu.lto_.purecon PROGBITS 00000000 ac1a88 008daa 00 0 0 4 - [27] .gnu.lto_init_adj PROGBITS 00000000 aca834 0005db 00 0 0 4 + [27] .gnu.lto_init_adj PROGBITS 00000000 aca834 0005d9 00 0 0 4 [28] .gnu.lto_.cgraph PROGBITS 00000000 acae10 0eaea1 00 0 0 4 [29] .gnu.lto_.statics PROGBITS 00000000 bb5cb4 002a22 00 0 0 4 - [30] .gnu.lto_.decls PROGBITS 00000000 bb86d8 1ecd2ce 00 0 0 4 (further all is different due to offset and size mismatches) The offset difference of the section headers is odd as well. Program headers are the same.
The lto sections are because we link with the static libraries even if they contain lto sections. As the linker doesn't know about them they are not stripped either. I guess a linker script could help here ... or archive support for lto.
Like forcing -Wl,-Tltoscript if using GNU ld with ltoscript being SECTIONS { /DISCARD/ : { *(.gnu.lto_*) } } INSERT BEFORE .text placing this in the std GCC private library path should be enough together with adjusting the default specs.
With that added to BOOT_LDFLAGS the cc1 binaries compare ok (the comparison still fails as it only considers .o files which obviously differ).
on x86_64-*-* the bootstrap comparison succeeds, even with lto sections in the executables and .o files.
Confirmed.
Subject: Bug 41079 Author: rguenth Date: Mon Aug 24 15:33:35 2009 New Revision: 151057 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151057 Log: 2009-08-24 Richard Guenther <rguenther@suse.de> PR lto/41079 * lto-streamer-out.c (output_gimple_stmt): Only stream needed fields. Do not stream pointer garbage. * lto-streamer-in.c (output_gimple_stmt): Adjust accordingly. Structure like output_gimple_stmt. Do not needlessly zero fields. Modified: branches/lto/gcc/ChangeLog.lto branches/lto/gcc/lto-streamer-in.c branches/lto/gcc/lto-streamer-out.c
The bootstrap comparison issues have all been fixed. The lto sections appearing in the final executables have been dealt with in upstream ld following what gold does. Thus, fixed.