cmd/link: debug_line incomplete when using cgo with some versions of dsymutil [Debugging] #25451
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:
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:
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....