Bug 12369 - Symbols present in LTO symbol table resolved as PREVAILING_DEF_IRONLY and optimized out appears in final symbol table.
Summary: Symbols present in LTO symbol table resolved as PREVAILING_DEF_IRONLY and opt...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-05 22:48 UTC by Jan Hubicka
Modified: 2012-12-07 20:10 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Hubicka 2011-01-05 22:48:25 UTC
As observed in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47183

jh@evans:/abuild/jh/trunk-3/build-inst2/gcc> cat t.C
struct S {
  virtual ~S() { }
};

int main(void)
{
  S t;
  return 0;
}
h@evans:/abuild/jh/trunk-3/build-inst2/gcc> ./g++ -B ./ -O2 t.C -save-temps
-flto -fuse-linker-plugin
[Leaving LTRANS /abuild/jh/tmp//ccoul7Xo.args]
[Leaving LTRANS /abuild/jh/tmp//ccT1KSUO.ltrans.out]
[Leaving LTRANS /abuild/jh/tmp//ccOM6q7y.args]
[Leaving LTRANS /abuild/jh/tmp//ccT1KSUO.ltrans0.o]
jh@evans:/abuild/jh/trunk-3/build-inst2/gcc> cat *.s
        .file   "ccT1KSUO.ltrans0.o"
        .section        .text.startup,"ax",@progbits
        .p2align 4,,15
        .globl  main
        .type   main, @function
main:
.LFB0:
        .cfi_startproc
        xorl    %eax, %eax
        ret
        .cfi_endproc
.LFE0:
        .size   main, .-main
        .ident  "GCC: (GNU) 4.6.0 20110105 (experimental)"
        .section        .note.GNU-stack,"",@progbits


it is optimized out. 

With GNU LD I get
jh@evans:/abuild/jh/trunk-3/build-inst2/gcc> nm a.out
0000000000600748 d _DYNAMIC
0000000000600910 d _GLOBAL_OFFSET_TABLE_
000000000040067c R _IO_stdin_used
                 w _Jv_RegisterClasses
0000000000400582 W _ZTI1S
0000000000400582 W _ZTS1S
                 U _ZTVN10__cxxabiv117__class_type_infoE@@CXXABI_1.3
                 U _ZdlPv@@GLIBCXX_3.4
0000000000600728 d __CTOR_END__
0000000000600720 d __CTOR_LIST__
0000000000600738 D __DTOR_END__
0000000000600730 d __DTOR_LIST__
0000000000400700 r __FRAME_END__
0000000000600740 d __JCR_END__
0000000000600740 d __JCR_LIST__
0000000000600940 A __bss_start
0000000000600930 D __data_start
0000000000400630 t __do_global_ctors_aux
00000000004004f0 t __do_global_dtors_aux
0000000000600938 D __dso_handle
                 w __gmon_start__
0000000000600720 d __init_array_end
0000000000600720 d __init_array_start
0000000000400590 T __libc_csu_fini
00000000004005a0 T __libc_csu_init
                 U __libc_start_main@@GLIBC_2.2.5
0000000000600940 A _edata
0000000000600950 A _end
000000000040066c T _fini
0000000000400460 T _init
00000000004004a4 T _start
00000000004004d0 t call_gmon_start
0000000000600940 b completed.5822
0000000000600930 W data_start
0000000000600948 b dtor_idx.5824
0000000000400560 t frame_dummy
00000000004004a0 T main

typeinfo for S and friends should not appear in the symbol table, they are not in the linker plugin output (but was originally
Comment 1 H.J. Lu 2011-01-05 23:23:46 UTC
Works for me on hjl/lto-mixed branch at

http://git.kernel.org/?p=devel/binutils/hjl/x86.git;a=summary
Comment 2 H.J. Lu 2012-12-07 20:10:39 UTC
Works in 2.23 and tracked by "LTO 9 symbol" test.