http://sourceware.org/bugzilla/show_bug.cgi?id=12944
Summary: GNU LD incorrectly optimize away COMDAT sections refered from data sections. Product: binutils Version: 2.22 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassig...@sources.redhat.com ReportedBy: hubi...@gcc.gnu.org Compiling the following testcase: #include <stdio.h> #include "x.h" __attribute__ ((noinline)) void aa(class A *a) { a->test(); } __attribute__ ((noinline)) void bb(class B *b) { b->test(); } int main(void) { class A a; class B b; aa (&a); bb (&b); } with LTO and GNU LD: /abuild/jh/trunk-install/bin/g++ x.cc -O2 -flto -fuse-linker-plugin -flto-partition=none Leads to typeinfo being taken away by GNU LD: 00000000004005d2 W _ZTI1A 00000000004005d2 W _ZTI1B 00000000004005d2 W _ZTS1A 00000000004005d2 W _ZTS1B 0000000000400720 r _ZTV1A 0000000000400740 r _ZTV1B As one can verify the second pointers of _ZTV1A and _ZTV1B are equilvalent even though they should be different typeinfos: evans:/abuild/jh/dealIIb/:[0]# gdb a.out (gdb) p ((void **)0x400720)[0] $1 = (void *) 0x0 (gdb) p ((void **)0x400720)[1] $2 = (void *) 0x4005d2 (gdb) p ((void **)0x400720)[2] $3 = (void *) 0x4006f0 (gdb) p ((void **)0x400740)[0] $4 = (void *) 0x0 (gdb) p ((void **)0x400740)[1] $5 = (void *) 0x4005d2 (gdb) p ((void **)0x400740)[2] $6 = (void *) 0x4006e0 (gdb) Thinks works well with GOLD: 0000000000400720 V _ZTI1A 0000000000400700 V _ZTI1B 0000000000400730 V _ZTS1A 0000000000400710 V _ZTS1B 00000000004006c0 r _ZTV1A 00000000004006e0 r _ZTV1B (gdb) p ((void **)0x4006c0)[0] $1 = (void *) 0x0 (gdb) p ((void **)0x4006c0)[1] $2 = (void *) 0x400720 (gdb) p ((void **)0x4006c0)[2] $3 = (void *) 0x400590 (gdb) p ((void **)0x4006e0)[0] $4 = (void *) 0x0 (gdb) p ((void **)0x4006e0)[1] $5 = (void *) 0x400700 (gdb) p ((void **)0x4006e0)[2] $6 = (void *) 0x400580 This is what breaks DealII SPEC2k6 benchmark. Honza -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils