elf: strip the .note.go.buildid to make room for patching elf
Metadata
Current evaluation
Merged. Strips the .note.go.buildid section from ELF binaries to resolve patchelf compatibility issues and fix build failures. Approved after passing CI checks. Introduces a newer patchelf build-snap dependency to ensure correct header patching.
Suggested action: —
No scores available.
Issue body
patchelf does not handle the existence of the .note.go.buildid section
so we strip it from the resulting binary as from the perspective of the
snap it is not needed.
A newer patchelf is also required which handles the math required for
the way the headers are layed out when using golang's go.
LP: #1736861
Signed-off-by: Ubuntu <sergio.schvezov@canonical.com>
- [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/)?
- [x] 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 unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Strips the .note.go.buildid section from ELF binaries to resolve patchelf compatibility issues and fix build failures. Approved after passing CI checks. Introduces a newer patchelf build-snap dependency to ensure correct header patching. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Strips the .note.go.buildid section from ELF binaries to enable patchelf compatibility, resolving LP #1736861. Requires an updated patchelf version, fixing Go binary builds for stable release. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Strips .note.go.buildid from ELF binaries to enable patchelf, resolving LP: #1736861. Requires updated patchelf and fixes build failures for affected packages. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3111 elf: fix parsing of notes after patchelf mangling | snapcraft | merged | Merged fix for ELF note parsing after patchelf modifications. Iterates over sections instead of the note segment to reliably extract note data, resolving snapcraft build-time failures with patched binaries. Fixes SNAPCRAFT-1K4 and SNAPCRAFT-1ET. | |
| #3841 elf: add elf file patcher | snapcraft | merged | Merged an ELF file patcher using patchelf, ported from Snapcraft 6.x. Approved by one reviewer, passed CI checks, and increased test coverage by 0.26%. Resolves CRAFT-1191. | |
| #1888 elf: make patchelf a dependency | snapcraft | merged | Merged after reviewer approval and CI checks. The change corrects patchelf handling by removing it from build_tools and properly configuring it as a dependency via debian/control for deb packages and snapcraft bundling for snaps. | |
| #2081 elf: patch everything instead of a subset of elf files | snapcraft | merged | Merged a pull request that restores Snapcraft 2.39 behavior by patching all ELF files instead of a subset, reverting a prior change. Approved and passed CI. | |
| #3985 elf: patch elf files for classic mode | snapcraft | merged | Merged into main. Patches ELF binaries for classic mode to use the base snap interpreter and libraries, or bundled components if libc is staged, when enable-patchelf is enabled. Approved, passed CI, and merged. | |
| #1873 elf: cleaner patchelf experience | snapcraft | merged | Merged improvements to patchelf handling. The change uses the system patchelf by default, copies files to prevent hard-link conflicts, and provides fallback instructions. Approved by two reviewers and passed CI checks before merging. | |
| #3589 snap: correct patch apply for patchelf | snapcraft | merged | Merged a two-line fix correcting patch application for patchelf. Approved by a reviewer, passed CI, and merged to master. An unrelated test failure was noted but disregarded to proceed. | |
| #3840 elf: add handling and patching helpers | snapcraft | merged | Merged into main following reviewer approval and passing CI checks. Introduces ELF binary listing and dynamic linker location helpers, adding handling and patching utilities to the elf module while increasing test coverage. | |
| #1959 elf: only patch elf files that aren't referenced by DT_NEEDED | snapcraft | merged | Merged after conflict resolution. Optimizes patchelf usage by only patching ELF files not listed in DT_NEEDED dependencies, reducing unnecessary modifications. Adds architecture extraction to ElfFile to prevent cross-architecture mismatches. Resolves LP #1747097. | |
| #2006 many: use packaging logic to get patchelf | snapcraft | merged | Merged following reviewer approval and CI checks. Refactored patchelf retrieval to use shared packaging logic, aligning its version across snap and deb packages. Modified four files with a net reduction of 24 lines. |