I don't understand. If a function isn't in the binary I will never need its name, so it does never have to be in the debug information. Likewise for variables.
I think linkers don't go this far to rewrite the debug info. If libstd is used, libstd's debug info is used.
The second problem is dynamic dispatch. The overhead in "hello world" is from printing and panicking machinery (it handles closed stdout), and these features use vtables, so it's even harder to precisely analyze what's actually used and what isn't.
The second problem is dynamic dispatch. The overhead in "hello world" is from printing and panicking machinery (it handles closed stdout), and these features use vtables, so it's even harder to precisely analyze what's actually used and what isn't.