Created attachment 5211 [details] Testcase
Fixed by commit 4262a95979771a18d1030d3ed544af28442fea43 on hjl/lto-mixed branch.
With ld.dk (ld.bfd with patch <http://gcc.gnu.org/ml/gcc/2011-02/msg00003.html>): $ nm prog [...] 080483a2 T bar 0804838e t bar.1988 [...] `bar' is not needed.
ld.hjl --cref gives "symbol `...' missing from main hash table" errors and prints garbage to stdout.
(In reply to comment #2) > With ld.dk (ld.bfd with patch > <http://gcc.gnu.org/ml/gcc/2011-02/msg00003.html>): > > $ nm prog > [...] > 080483a2 T bar > 0804838e t bar.1988 > [...] > > `bar' is not needed. Yes, although note that it's just a symbol, not the actual function, and the program is correct. There are left-over stray symbols from the LTO symtabs in the final exe, when ltrans decides to remove a function that was present in the IR object file. I'll see if I can find a way to remove them, but as far as I know, the only potential harm they can do is that if they have non-default visibility, we get PR12277.
(In reply to comment #3) > ld.hjl --cref gives "symbol `...' missing from main hash table" errors and > prints garbage to stdout. It is fixed by commit 9de3db977572464608623fe46cd7b39c66d4c1eb on hjl/lto-mixed branch.
Works in 2.23 and tracked by "LTO 13" test.