elf: extract build ID and presence of debug info
Metadata
Current evaluation
Updates the ElfFile class to extract ELF build IDs and detect debug info presence. Merged after approval by two reviewers and passing CI checks. Simplifies section extraction logic to support debug symbol separation.
Suggested action: —
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh tests/unit`?
-----
This is related to my proposal about collecting debug information as part of a snapcraft build here: https://forum.snapcraft.io/t/collecting-debug-symbols/7017
The patch simply updates the ElfFile class to extract the build ID and presence of debug info in a file. This is needed to identify candidates to have their debug info separated, and to identify the debug info corresponding to installed ELF files.
I also took the opportunity to simplify `ElfFile._extract` to remove dependence on section names where they aren't actually relied on. For example, while the ELF interpreter is usually found in the `.interp` section, the kernel actually looks for it in the `PT_INTERP` section. You could store the name in a differently named section of that segment and it would still work.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Updates the ElfFile class to extract ELF build IDs and detect debug info presence. Merged after approval by two reviewers and passing CI checks. Simplifies section extraction logic to support debug symbol separation. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged updates to the ElfFile class that extract ELF build IDs and debug info presence, simplifying section parsing. The changes enable debug candidate identification for snapcraft builds and were integrated after rebasing and passing CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Updates the ElfFile class to extract ELF build IDs and debug info presence for symbol separation. Simplifies extraction logic by using segment types instead of hardcoded section names. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3408 elf: extract defined symbol versions | snapcraft | merged | Merged into master. Adds defined symbol version extraction to the ElfFile class, enabling Snapcraft to detect missing or duplicate libraries. Approved by two reviewers, passed CI, and modified three files. | |
| #1950 elf: better debug messages | snapcraft | merged | Merged pull request polishing ELF debug messages for linker and library exclusion checks. Changes eliminate repetitive logging and reduce unnecessary calls. Approved by reviewers, passed CI, and successfully integrated. |