Bug 12439 - Undefined reference error with ld.hjl
Summary: Undefined reference error with ld.hjl
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.22
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-25 23:51 UTC by Dmitry Gorbachev
Modified: 2012-12-07 20:11 UTC (History)
3 users (show)

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


Attachments
Testcase (247 bytes, text/plain)
2011-01-25 23:51 UTC, Dmitry Gorbachev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Gorbachev 2011-01-25 23:51:32 UTC
Created attachment 5211 [details]
Testcase
Comment 1 H.J. Lu 2011-01-26 19:08:53 UTC
Fixed by commit 4262a95979771a18d1030d3ed544af28442fea43 on
hjl/lto-mixed branch.
Comment 2 Dmitry Gorbachev 2011-02-01 12:33:38 UTC
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.
Comment 3 Dmitry Gorbachev 2011-02-01 12:39:34 UTC
ld.hjl --cref gives "symbol `...' missing from main hash table" errors and prints garbage to stdout.
Comment 4 Dave Korn 2011-02-01 18:03:44 UTC
(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.
Comment 5 H.J. Lu 2011-02-01 19:23:11 UTC
(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.
Comment 6 H.J. Lu 2012-12-07 20:11:29 UTC
Works in 2.23 and tracked by "LTO 13" test.