-
-
Notifications
You must be signed in to change notification settings - Fork 449
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
Incorrect link of .debug_macro with mold 1.1.1 #438
Comments
Sorry, hit C-enter and that submitted this before I was ready. Anyway, if I switch to |
Thank you for your report! What happens here is that
Handling references to dead sections as zeros is a common practice in the debug sections, so I don't know if this is immediately a bug. As far as I know, LLVM lld linker also sets 0 to |
It seems to me that if section A has a reference to section B (which is identical to C), then either removing B is incorrect (since it is referenced) or that the references must then be switched to refer to C (since they are identical).
LLVM does show the problem, but |
This is controlled by the COMDAT group mechanism. According to the spec, if two COMDAT groups whose identifiers are the same, we can choose one and remove the other. Their members' identities are not examined. So, it is valid to remove sections here. I believe GNU linkers also remove sections.
Did you observe not only some fields were set to zero but also the same slowness if you use lld? |
Yes, just now I re-did my experiment of running gdb on itself and setting a breakpoint. For a gdb linked with gold, the CU expansion took ~0.3 seconds; for a gdb linked with lld, it took ~2.7 seconds. The difference is caused by pathological .debug_macros data. |
This behavior still seems weird to me, but I did find that there's a GCC bug report about this being separately discovered, reported against lld, and being rejected there: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91239 I'm going to reply there with a link back to this bug. |
Hi, Gcc folks have replied again that they think it shall be supported by the linker. I don't have the technical knowledge to say wether it's a compiler issue or a linker issue ;) Somehow a discussion will need to be held between all of you to find an agreement. CC-ing @MaskRay for the lld side. Cheers, |
Thank you for letting me know. I left a comment at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91239 |
I noticed that gdb became very slow when I switched to linking with mold, so I spent a bit of time tracking it down. I found a link problem. The short form is that the resulting
.debug_macro
has imports like this:I'm using
on x86-64 Fedora 34.
To reproduce, make three files. First, r.h:
Then, r.cc:
Finally, z.cc:
Now:
The text was updated successfully, but these errors were encountered: