-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: compress debug info on windows #25927
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
Comments
As you word it, this would technically be a dup of #6853. What I think it's worth noting is that CL 118276 (cmd/link: compress DWARF sections in ELF binaries) only helped with ELF binaries. So I think it would be better if you renamed this issue to point out this specific issue (i.e., make this issue a TODO reminder to compress debug info on windows, too). In theory we had #11799 (cmd/link: compress debug info) for the general problem, but it got closed after the ELF work. |
@ALTree I've renamed the issue to cmd/link: compress debug info on windows as you suggested. Others more in the know about Windows, the PE file format and the debug story around Windows (gdb, delve etc.) have to chime in on the correct way forward. |
I tried to get this working on Windows (made some small changes to cmd/link and, debug/pe) and hello world.exe went from 2.8MB to 1.9MB. I almost got delve to start but didn't have time to finish it. There doesn't seem to be an insurmountable amount of work left to do to get compression working on Windows as well (since most of the work seems to be done already in #11799) but I may be wrong (the devil is in the details and all that). I would feel better if the original authors of #11799 looked at this as well (together with Alex) since they know what they are doing :). cc @heschik, @alexbrainman, @ianlancetaylor, @aclements |
@dajoo75 what approach are you taking? Elf supports compression but PE doesn't (based on a ctrl-f search in the relevant MSDN page), so |
Yes .zdebug. That seems to be the way the Go team have solved this. Dwarf sections in a PE file. Package debug/pe has a DWARF-function that delve uses. I’m decompressing the sections inside debug/pe just like the debug/elf solution. The consumer, e.g. delve, only sees uncompressed data, at least that was the idea... but I didn’t have time to finish it.
/Daniel
… 18 juni 2018 kl. 08:17 skrev Alessandro Arzilli ***@***.***>:
@dajoo75 what approach are you taking? Elf supports compression but PE doesn't (based on a ctrl-f search in the relevant MSDN page), so .zdebug?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Ah, I didn't notice the switch to zdebug. In that case: https://github.com/derekparker/delve/pull/1237 |
Thank you @dajoo75 for creating the issue. If I understand correctly, CL 118276 added compression for ELF DWARF sections. I would try and add some code to make .zdebug_... sections appear in Windows executables, and see where it gets us. I doubt I would have time before weekend. So others are welcome to this. I also wonder if debuggers used by our users will support this. Lucky we have @aarzilli here, so he can fix Delve. Not so easy to fix gdb. We will see. Alex |
I think gdb was the original user of the zdebug convention, I imagine that should be fine. The problem is lldb. |
Does lldb work on Windows? Alex |
Partially: https://lldb.llvm.org/status.html |
@dajoo75 I'm happy to review a CL and help you over some bumps; I'd have to set up a Windows machine to even start on this and it sounds like you're well into it. We are pretty deep into the freeze so it'd be nice to get it done soon. Can someone confirm that on Windows we're basically ignoring the platform convention for debug info, which I guess would either be COFF or PDB? As long as that's the case and none of the standard tools work anyway, I think it makes sense to go ahead and compress it. I doubt lldb is very popular there, even if it does work. |
@heschik That is correct: we only generate DWARF. COFF debug info is entirely inadequate. As far as I know PDB is not publicly documented. |
@heschik Thank you for helping out. I don’t feel I have enough of a grip on the solution right now to send a CL I believe in so I’ll leave this one to Alex (or someone else) more experienced in the PE and DWARF format for now.
/Daniel
… 18 juni 2018 kl. 21:25 skrev Heschi Kreinick ***@***.***>:
@dajoo75 I'm happy to review a CL and help you over some bumps; I'd have to set up a Windows machine to even start on this and it sounds like you're well into it. We are pretty deep into the freeze so it'd be nice to get it done soon.
Can someone confirm that on Windows we're basically ignoring the platform convention for debug info, which I guess would either be COFF or PDB? As long as that's the case and none of the standard tools work anyway, I think it makes sense to go ahead and compress it. I doubt lldb is very popular there, even if it does work.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Okay. @alexbrainman, if you don't claim this by tomorrow I'll take a crack at it. |
Please, do. I will try it myself, but I do not know when. Alex |
Change https://golang.org/cl/119816 mentions this issue: |
Change https://golang.org/cl/119815 mentions this issue: |
Since we're going to start compressing DWARF on Windows and maybe Darwin, copy the ELF support for .zdebug sections to macho and pe. The code is almost completely the same across the three. While I was here I added support for compressed .debug_type sections, which I presume were overlooked before. Tests will come in a later CL once we can actually generate compressed PE/Mach-O binaries, since there's no other good way to get test data. Updates #25927, #11799 Change-Id: Ie920b6a16e9270bc3df214ce601a263837810376 Reviewed-on: https://go-review.googlesource.com/119815 Run-TryBot: Heschi Kreinick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-by: Austin Clements <[email protected]>
@ianlancetaylor |
@be5invis Thanks. |
What did you do?
Compiled a basic hello world program on 64-bit Windows 10 with go tip (+b459e00), go 1.8.1 and go 1.10.3 and compared the binary sizes.
What did you expect to see?
The binary size to be about the same at tip (+b459e00) as the previous release (go1.10.3 at the time of writing this). And if possible, the binary size to have gone down.
Other related issues: #6853, #11799
What did you see instead?
The binary size at tip (+b459e00) has increased by 38 percent since the previous release (go1.10.3 at the time of writing this).
Does this issue reproduce with the latest release (go1.10.3)?
Yes
System details
The text was updated successfully, but these errors were encountered: