-
-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: split debug symbols #1294
Comments
I'm interested in this, not only because it's convenient but also because it could potentially improve the linker's overall speed for debug builds. Let me experiment with some ideas. |
There is a slight pitfall in deciding which symbols / sections are supposed to go into which file and which is supposed to be stripped. There's a difference between a library which is intended for open source distribution (thus the full symbol file can be made available, and the binary can be stripped to the bare minimum), a closed source library which is intended for embedding into a 3rd party process (thus the original developer needs a full symbol file to provide support, but also minimal debugging information left in the PE executable to enable the 3rd party to walk stack frames!), and a self-contained executable which can be stripped entirely (including relocation information) and everything can be placed in the symbols. That referenced call sequence with Long story short, you may need more than one output file for symbols, and you need a fine grained control where which sections goes, as well as by which naming convention the debug links / supplementary file links are set up. There is also the interaction with |
We don't need to support all of the use cases. For complex use cases, it would probably be better to stick with post-link editing tools such as objcopy. I'm interested in implementing this because it could speed up the normal linking by separating debug info to another file. |
@Ext3h Thank you for writing all that out. Personally I have only ever seen people using what you call the first case. I am not sure what the difference is between your third case and first case. I understand the motivation behind the second case, but it is more complex and it seems reasonable to implement the simpler case first. @rui314 Thank you as well, I agree with your points and it would be great if the normal linking process becomes faster due to this--that would be even better than what I expected which was merely that the overall build time would decrease by removing post-processing. |
Making release builds with debug symbols (e.g.
-O2 -g
) is common and produces large executables. It is standard industry practice to split debug symbols into a separate file which does not need to be deployed to most machines. See https://github.com/GabrielMajeri/separate-symbols.While the objective is well known and valuable, the process is arcane and inefficient. Linkers produce an executable file which is immediately read back from disk using separate tools and then written to the final files. Mold could do this better.
Benefits:
Do you like this idea or see pitfalls? Feedback very welcome.
The text was updated successfully, but these errors were encountered: