-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: debug_line incomplete when using cgo with some versions of dsymutil [Debugging] #25451
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
CC @heschik @thanm |
CC @dr2chase |
I looked just now and clang is indeed breaking the rules when it comes to max number of opcodes for DWARF 2. I checked with clang-3.9 (which emits DWARF 2 by default) and with clang-7 / tip (which emits DWARF 4 by default, but produces a line table header with the wrong number of opcodes if you ask for DWARF 2); both have 12 opcodes. A couple of questions:
|
AFAICT the problem is not that clang is violating the rules, is that Go isn't. If you use an older version of dsymutil it will strip out the debug_line sections produced by Go now that they are using version 3. |
How would I go about verifying that? |
Dsymutil in latest XCode works okay, but some not-much-earlier version does not. Mine (which works):
I believe LLVM/XCode 9.0.0 will fail, based on other bugs. My understanding is that our choices are:
Update to latest XCode might require update to latest OSX. I also don't know how far back the "claim version 2" trick will work (when was that first supported, how old a version of OSX does that imply?). I was going to try to download an old XCode to give it a try, but was asked for my Apple Developer ID and strongly suspect that my personal ID is not appropriate for this. DWARF Version 3 is 12 years old, just saying.... |
dsymutil version 9.0.0 (clang-900.0.39.2) is affected by this problem and AFAIK is the most recent version installable on macOS 10.12 (without compiling from source). |
I checked that lying works okay on 9.1.0. |
Change https://golang.org/cl/114015 mentions this issue: |
This is a duplicate of #25392, I actually posted this on that issue yesterday but it was already closed and I think nobody saw it. I think that issue should be reopened.
It looks like some (most?) versions of dsymutil do not support (but see below) version 3 for debug_line, including the most recent version of dsymutil on 10.12.
If 10.12 is still considered supported this breaks backwards compatibility.
Now, Saying that dsymutil doesn't support v3 is incomplete, it seems that it actually does, but only if you lie to it and say it's v2. For example this is what the line table of a compilation unit produced by clang looks like in the final executable:
Note how it says version 2 but has more than 9 standard opcodes.
The choice is between lying, pretending 10.12 doesn't exist or reverting the prologueEnd thing.
The text was updated successfully, but these errors were encountered: