3 ms·
I was wondering if dead code elimination also removes the debug symbols related to the dead code? The ~ 4 MiB of debug symbols the article talks about are for
by weinzierl 3y ago
I was wondering if dead code elimination also removes the debug symbols related to the dead code?
The ~ 4 MiB of debug symbols the article talks about are for the whole libstd or just the portions that actually ended up in the binary?
I think the new default makes sense but I'd love to have the option to build a lean but debuggable release binary with just the needed symbols.
- kobzol 3y agoYou can't really use dead code elimination on debug symbols, because you don't know which symbols will you need. You would need to know where and how will your program crash or if the user will want to use a debugger on it.
- weinzierl 3y agoI 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.
- pornel 3y agoI 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.