Bug 41079 - Bootstrap comparison fails, collect2 links against lto archives
Summary: Bootstrap comparison fails, collect2 links against lto archives
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: lto
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-15 15:58 UTC by Richard Biener
Modified: 2009-08-24 15:34 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-08-19 06:14:55


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2009-08-15 15:58:04 UTC
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.
Comment 1 Richard Biener 2009-08-16 12:47:59 UTC
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.
Comment 2 Richard Biener 2009-08-16 17:13:38 UTC
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.
Comment 3 Richard Biener 2009-08-16 18:42:18 UTC
With that added to BOOT_LDFLAGS the cc1 binaries compare ok (the comparison
still fails as it only considers .o files which obviously differ).
Comment 4 Richard Biener 2009-08-17 16:13:47 UTC
on x86_64-*-* the bootstrap comparison succeeds, even with lto sections in
the executables and .o files.
Comment 5 Ben Elliston 2009-08-19 06:14:55 UTC
Confirmed.
Comment 6 Richard Biener 2009-08-24 15:33:50 UTC
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

Comment 7 Richard Biener 2009-08-24 15:34:29 UTC
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.