public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "davek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/47274] [4.6 regression] ICE in lto_varpool_replace_node, at lto-symtab.c:306
Date: Tue, 01 Feb 2011 07:00:00 -0000	[thread overview]
Message-ID: <bug-47274-4-V3yRAIJ4jN@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47274-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47274

--- Comment #28 from Dave Korn <davek at gcc dot gnu.org> 2011-02-01 06:59:58 UTC ---
It looks like the problem is much earlier than the linker; it looks like the IR
symtabs in the input object files are being generated incorrectly.  Here are
the real symbol tables:

$ ./obj/binutils/.libs/nm-new.exe *.o

abs-1-lib.o:
00000001 C __gnu_lto_v1
         U abort
00000000 T abs
         U abs_called
         U inside_main
00000024 T labs

abs-1.o:
00000001 C __gnu_lto_v1
         U abort
         U abs
00000000 B abs_called
00000000 T main_test

main.o:
00000001 C __gnu_lto_v1
00000004 C inside_main
00000000 T main
         U main_test


And here are the IR symtabs (I built a cross GCC just far enough to get the
liblto_plugin):

$ ./obj/binutils/.libs/nm-new.exe --plugin ./obj-xgcc/lto-plugin/.libs/cyglto_p
lugin-0.dll *.o

abs-1-lib.o:
00000000 T abs
00000000 T abs_called
00000000 T inside_main

abs-1.o:
00000000 T abs
00000000 T abs_called
00000000 T main_test

main.o:
00000000 T inside_main
00000000 T main
00000000 T main_test

To confirm that the symtabs really are wrong in the object files, rather than
that the plugin is misreading them, here's a binary dump from one:

$ ./obj/binutils/.libs/objdump.exe -h abs-1-lib.o

abs-1-lib.o:     file format elf32-hppa-linux

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000058  00000000  00000000  00000034  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
  1 .data         00000000  00000000  00000000  0000008c  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  0000008c  2**0
                  ALLOC
  3 .gnu.lto_.jmpfuncs.29f392e1 00000019  00000000  00000000  0000008c  2**0
                  CONTENTS, READONLY, EXCLUDE
  4 .gnu.lto_.pureconst.29f392e1 00000016  00000000  00000000  000000a5  2**0
                  CONTENTS, READONLY, EXCLUDE
  5 .gnu.lto_abs.29f392e1 00000192  00000000  00000000  000000bb  2**0
                  CONTENTS, READONLY, EXCLUDE
  6 .gnu.lto_labs.29f392e1 00000189  00000000  00000000  0000024d  2**0
                  CONTENTS, READONLY, EXCLUDE
  7 .gnu.lto_.cgraph.29f392e1 0000003c  00000000  00000000  000003d6  2**0
                  CONTENTS, READONLY, EXCLUDE
  8 .gnu.lto_.vars.29f392e1 00000018  00000000  00000000  00000412  2**0
                  CONTENTS, READONLY, EXCLUDE
  9 .gnu.lto_.refs.29f392e1 0000001b  00000000  00000000  0000042a  2**0
                  CONTENTS, READONLY, EXCLUDE
 10 .gnu.lto_.statics.29f392e1 00000014  00000000  00000000  00000445  2**0
                  CONTENTS, READONLY, EXCLUDE
 11 .gnu.lto_.decls.29f392e1 000002ab  00000000  00000000  00000459  2**0
                  CONTENTS, READONLY, EXCLUDE
 12 .gnu.lto_.symtab.29f392e1 00000048  00000000  00000000  00000704  2**0
                  CONTENTS, READONLY, EXCLUDE
 13 .gnu.lto_.opts 00000012  00000000  00000000  0000074c  2**0
                  CONTENTS, READONLY, EXCLUDE
 14 .PARISC.unwind 00000020  00000000  00000000  00000760  2**2
                  CONTENTS, ALLOC, LOAD, RELOC, READONLY, DATA
 15 .comment      00000042  00000000  00000000  00000780  2**0
                  CONTENTS, READONLY

$ ./obj/binutils/.libs/objcopy.exe -j .gnu.lto_.symtab.29f392e1 abs-1-lib.o sym
s-abs-1-lib.o

$ ./obj/binutils/.libs/objdump.exe -s syms-abs-1-lib.o

syms-abs-1-lib.o:     file format elf32-hppa-linux

Contents of section .gnu.lto_.symtab.29f392e1:
 0000 61627300 00000000 00000000 00000000  abs.............
 0010 00004669 6e736964 655f6d61 696e0000  ..Finside_main..
 0020 00000000 00000000 00000000 00656162  .............eab
 0030 735f6361 6c6c6564 00000000 00000000  s_called........
 0040 00000000 00000067                    .......g

  The format of the IR symtab entries is: 
(variable-length) NUL-terminated name
(variable-length) NUL-terminated comdat group
(1 byte) symbol kind from LDPK_ enumeration
(1 byte) symbol visibility from LDPV_ enumeration
(8 bytes) 64-bit symbol size
(4 bytes) 32-bits symbol aux info.

  As you can see, this symtab claims that abs-1-lib.o defines inside_main

 0000 61627300 00000000 00000000 00000000  abs.............
 0010 00004669 6e736964 655f6d61 696e0000  ..Finside_main..
            \/ \/\/\/\/ \/\/\/\/ \/\/\/\/
name--------++++++++++++++++++++++++++ +
comdat---------------------------------+
 0020 00000000 00000000 00000000 00656162  .............eab
      \/\/
kind--+ +   0 = LDPK_DEF
vis-----+   0 = LDPV_DEFAULT
 0030 735f6361 6c6c6564 00000000 00000000  s_called........
 0040 00000000 00000067                    .......g


So the problem is that the object files are being written incorrectly in the
first place, I think.  Indeed, the contents of abs-1-lib.s look that way:

    .section    .gnu.lto_.symtab.29f392e1,"",@progbits
    .stringz    "abs"
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    "Finside_main"
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    "eabs_called"
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .stringz    ""
    .ascii    "g"
    .text

No attempt there to put anything but zeros for the symbol kind.  So, LTO is
streaming out symtabs that say every object file defines every symbol... no
wonder the linker/plugin get confused!

This now needs somebody with a full compiler for the target to debug; I've only
got (cross) binutils and lto-plugin.


  parent reply	other threads:[~2011-02-01  7:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 23:54 [Bug lto/47274] New: " schwab@linux-m68k.org
2011-01-13 11:01 ` [Bug lto/47274] " rguenth at gcc dot gnu.org
2011-01-13 16:59 ` schwab@linux-m68k.org
2011-01-15  2:28 ` anton at samba dot org
2011-01-15  6:39 ` howarth at nitro dot med.uc.edu
2011-01-15 22:55 ` schwab@linux-m68k.org
2011-01-17 14:09 ` rguenth at gcc dot gnu.org
2011-01-17 15:53 ` danglin at gcc dot gnu.org
2011-01-17 16:11 ` hubicka at ucw dot cz
2011-01-17 16:14 ` hubicka at ucw dot cz
2011-01-17 17:00 ` rguenth at gcc dot gnu.org
2011-01-17 17:02 ` rguenth at gcc dot gnu.org
2011-01-17 19:07 ` dave at hiauly1 dot hia.nrc.ca
2011-01-17 19:16 ` dave at hiauly1 dot hia.nrc.ca
2011-01-18  1:37 ` dave at hiauly1 dot hia.nrc.ca
2011-01-18  1:37 ` dave at hiauly1 dot hia.nrc.ca
2011-01-20  2:25 ` dave at hiauly1 dot hia.nrc.ca
2011-01-20 14:31 ` jakub at gcc dot gnu.org
2011-01-27 16:02 ` hubicka at gcc dot gnu.org
2011-01-27 17:21 ` dave at hiauly1 dot hia.nrc.ca
2011-01-27 17:27   ` Jan Hubicka
2011-01-27 17:28 ` hubicka at ucw dot cz
2011-01-27 19:44 ` dave at hiauly1 dot hia.nrc.ca
2011-01-31 17:43 ` hubicka at gcc dot gnu.org
2011-01-31 17:57 ` davek at gcc dot gnu.org
2011-01-31 19:41 ` davek at gcc dot gnu.org
2011-01-31 20:22 ` dave at hiauly1 dot hia.nrc.ca
2011-01-31 20:28 ` davek at gcc dot gnu.org
2011-02-01  0:27 ` dave at hiauly1 dot hia.nrc.ca
2011-02-01  0:37 ` dave at hiauly1 dot hia.nrc.ca
2011-02-01  7:00 ` davek at gcc dot gnu.org [this message]
2011-02-01 19:43 ` hubicka at ucw dot cz
2011-02-01 21:05 ` davek at gcc dot gnu.org
2011-02-02 16:08 ` jakub at gcc dot gnu.org
2011-02-02 16:42 ` schwab@linux-m68k.org
2011-02-02 16:48 ` schwab@linux-m68k.org
2011-02-02 16:57 ` jakub at gcc dot gnu.org
2011-02-03 10:49 ` jakub at gcc dot gnu.org
2011-02-03 10:59 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-47274-4-V3yRAIJ4jN@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).