Bug 60016 - gcc-nm does not report static symbols
Summary: gcc-nm does not report static symbols
Alias: None
Product: gcc
Classification: Unclassified
Component: lto (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2014-01-31 23:58 UTC by Andi Kleen
Modified: 2016-09-12 13:32 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Andi Kleen 2014-01-31 23:58:43 UTC
The LTO symbol table read by the linker plugin does not contain static symbols.
This is fine for the linker, but changes behavior of gcc-nm (which also uses the linker plugin) drastically. Normally nm prints all static symbols too.

This is a problem for example if a program wants to get the full symbols for debugging purposes. 

The ltosymtab should probably add this information, but only output it for nm
Comment 1 Jan Hubicka 2016-09-11 09:58:19 UTC
Hmm, I am not sure how useful this would be: the static symbols are to be quite aggressively optimized/renamed before they hit the final binary. What would be a resonable use of this information?
Comment 2 Andi Kleen 2016-09-12 13:32:09 UTC
This is needed for example to generate backtraces, if the symbol table should be built in instead of read from the binary.

The Linux kernel cannot read its own binary, so the symbol table has to built in.