public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/53572] New: Some public symbols don't get to serialized LTO
@ 2012-06-04 12:37 tetra2005 at gmail dot com
  2012-06-04 12:53 ` [Bug lto/53572] " rguenth at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: tetra2005 at gmail dot com @ 2012-06-04 12:37 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53572
           Summary: Some public symbols don't get to serialized LTO
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tetra2005@gmail.com


Created attachment 27553
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27553
This archive includes Makefile, header and two cpps which illustrate the
problem

The attached small project builds successfully by default

  ygribov@ygribov-desktop:~/test/repro-x86$ make CC=<path-to-gcc> clean all
  rm -f prog main.o lib.a lib.o
  gcc  -O2 -DNDEBUG -frtti -c -o main.o main.cpp
  gcc -O2 -DNDEBUG -frtti -c -o lib.o lib.cpp
  ar rcs lib.a lib.o
  gcc  main.o -L. lib.a -o prog -lsupc++

but fails if I compile with LTO enabled:

  ygribov@ygribov-desktop:~/test/repro-x86/jni$ make CC=<path-to-gcc> LTO=-flto
clean all
  rm -f prog main.o lib.a lib.o
  gcc -flto -O2 -DNDEBUG -frtti -save-temps -c -o main.o main.cpp
  gcc -O2 -DNDEBUG -frtti -save-temps -c -o lib.o lib.cpp
  ar rcs lib.a lib.o
  gcc -flto main.o -L. lib.a -o prog -lsupc++
  `_ZTI1A' referenced in section `.rodata._ZTV1A[_ZTV1A]' of lib.a(lib.o):
defined in discarded section `.text' of main.o (symbol from plugin)
  collect2: error: ld returned 1 exit status
  make: *** [prog] Error 1

_ZTI1A is a weak definition of vtable for class A which is defined both in
main.cpp and in lib.cpp (because they both include common.h which defines thus
class). Main.cpp is compiled with -flto and _ZTI1A then gets into main.o's LTO
symtab. As main.o is the first file in the list which declares to provide
definition for this weak symbol linker assumes that it should come from main.o.
But for some reason the actual GIMPLE tree for _ZTI1A is not stored in main.o's
LTO sections and this causes errors during linking (linker can't find symbol
promised by main.o's LTO symtab).

I tried to compile both with gcc 4.6 and gcc trunk and every time it failed in
the same way.

I have to include a tgz instead of single source file because problem manifests
itself only when I link several files.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2012-09-07 13:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-04 12:37 [Bug lto/53572] New: Some public symbols don't get to serialized LTO tetra2005 at gmail dot com
2012-06-04 12:53 ` [Bug lto/53572] " rguenth at gcc dot gnu.org
2012-06-04 14:11 ` hubicka at gcc dot gnu.org
2012-06-04 14:19 ` hubicka at gcc dot gnu.org
2012-06-04 14:38 ` rguenth at gcc dot gnu.org
2012-06-04 19:53 ` hubicka at ucw dot cz
2012-06-05 10:54 ` tetra2005 at gmail dot com
2012-06-12 10:43 ` rguenth at gcc dot gnu.org
2012-06-25 15:07 ` hubicka at gcc dot gnu.org
2012-06-26 10:15 ` hubicka at gcc dot gnu.org
2012-07-23 12:54 ` Christopher.Hite at partner dot commerzbank.com
2012-09-04 23:49 ` matt at use dot net
2012-09-07 13:06 ` rguenth at gcc dot gnu.org
2012-09-07 13:07 ` rguenth at gcc dot gnu.org
2012-09-07 13:08 ` rguenth at gcc dot gnu.org

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).