Skip to content
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

Objdump can't parse our Linux debug information #30016

Closed
laanwj opened this issue May 1, 2024 · 6 comments
Closed

Objdump can't parse our Linux debug information #30016

laanwj opened this issue May 1, 2024 · 6 comments

Comments

@laanwj
Copy link
Member

laanwj commented May 1, 2024

Upstream issue: https://sourceware.org/bugzilla/show_bug.cgi?id=31692

The debug information in the shipped .dbg artifacts seems to be unusable for objdump. The .debug_info section is corrupt:

$ tar -zxvf bitcoin-27.0-x86_64-linux-gnu-debug.tar.gz
$ objdump -Wi bitcoin-27.0/bin/bitcoin-cli.dbg

Section '.debug_info' has an invalid size: 0.

bitcoin-27.0/bin/bitcoin-cli.dbg:     file format elf64-x86-64

Section '.debug_info' has an invalid size: 0.

i've checked various Linux architectures (at least x86_64, ARM, RISC-V) and the same issue exists there. Interestingly, the Windows build is unaffected. Maybe because of a different gcc/binutils? Builds outside guix seem unaffected.

My first thought is that something goes wrong while splitting the debug symbols. However, the unsplitted binaries suffer from the same problem:

$ objdump -Wi guix-build-27.0/distsrc-27.0-x86_64-linux-gnu/src/bitcoind

Section '.debug_info' has an invalid size: 0

This issue affects at least release 27.0 and current master.

Edit: Looks like there is a .debug_info section in the files. objdump -s -j .debug_info bitcoin-27.0/bin/bitcoind.dbg shows contents, so it's not really size 0. But it can't be parsed somehow.

@laanwj laanwj self-assigned this May 1, 2024
@laanwj
Copy link
Member Author

laanwj commented May 1, 2024

Okay, may be a objdump bug actually?

readelf -wi (which should be equivalent to objdump -Wi) parses the same section fine. So does gdb it seems?

(FWIW i did try various versions of objdump before reporting this)

@laanwj
Copy link
Member Author

laanwj commented May 1, 2024

Closing for now.

edit: It's this objdump bug in dealing with compressed debug info sections: https://sourceware.org/bugzilla/show_bug.cgi?id=24319
which was supposedly fixed but... sigh

@laanwj laanwj closed this as completed May 1, 2024
@laanwj laanwj changed the title Linux debug information for release is broken Objdump can't parse our Linux debug information May 2, 2024
@laanwj laanwj added the Upstream label May 2, 2024
@laanwj
Copy link
Member Author

laanwj commented May 2, 2024

Reopening with more accurate title (phew).

Filed upstream issue: https://sourceware.org/bugzilla/show_bug.cgi?id=31692

@laanwj laanwj reopened this May 2, 2024
@fanquake
Copy link
Member

fanquake commented May 2, 2024

Interestingly, the Windows build is unaffected. Maybe because of a different gcc/binutils?

This is probably because the Windows Binutils is configured without support for compressed debug sections, as it was, iirc, causing other windows build issues.

@laanwj
Copy link
Member Author

laanwj commented May 2, 2024

This is probably because the Windows Binutils is configured without support for compressed debug sections, as it was, iirc, causing other windows build issues.

Right, that makes sense. DWARF in PE binaires is a quite peculiar concept in the first place--heck, GNU even has its own way to encode the long section names needed: lief-project/LIEF#1043. i'm not surprised it's not set up to handle compressed sections.

@laanwj
Copy link
Member Author

laanwj commented May 2, 2024

This was already solved upstream!

Diff: https://sourceware.org/git/?p=binutils-gdb.git;a=blobdiff;f=binutils/objdump.c;h=3d70df470f290f7e4dc46cf80bc075f3015e6c14;hp=5acaa54929dbd4bbe37d7a2195ca698bfca603d0;hb=635d05b88f4823f46ef1ddbb3d438db16c0f6e71;hpb=5ce0e02478cc79a260c7e29822450284a32b9b12

i expect this will land in binutils 2.43. No need to keep this issue open.

@laanwj laanwj closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants