elf: strip the .note.go.buildid to make room for patching elf
Metadata
Current evaluation
Merged #1798 in fa8b7b174, stripping Go ELF .note.go.buildid sections before patching and requiring newer patchelf header-layout support.
Resolution: closed resolved
Reason: PR #1798 was merged as commit fa8b7b174. It removes .note.go.buildid sections so patchelf can correctly resize and patch Go-built ELF headers.
Evaluated by: mr-cal-bot
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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged #1798 in fa8b7b174, stripping Go ELF .note.go.buildid sections before patching and requiring newer patchelf header-layout support. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1798 (fa8b7b174), stripping Go ELF .note.go.buildid sections and requiring newer patchelf to patch Go-built binaries correctly. | |
| 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. |
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 in snapcraft#3111 by parsing ELF notes from sections instead of the note segment, handling binaries mangled by patchelf. | |
| #1666 Refactor to support elf patching | snapcraft | closed | ELF patching support was refactored by merged PR #1744 in commit ec7ba948a, converting the ELF implementation into reusable libraries. | |
| #1959 elf: only patch elf files that aren't referenced by DT_NEEDED | snapcraft | merged | Merged as 64f78f762, adding architecture-aware DT_NEEDED filtering to reduce patchelf usage; PR #2081 later partially reverted it and restored patching every ELF file. | |
| #2519 packaging: use local patchelf | snapcraft | merged | Merged as e39d2404c, adopting Patchelf 0.10 and relinking dynamic Go executables; later reverted by #2531 after architecture tests exposed unreliable binaries. | |
| #3841 elf: add elf file patcher | snapcraft | merged | Merged PR #3841 in commit e03a971b3, adding a patchelf-based ELF file patcher ported from Snapcraft 6.x for CRAFT-1191. | |
| #1983 snap: update revision of patchelf to use | snapcraft | closed | Closed unmerged; the bundled PatchELF revision bump in #1983 was superseded by #2006, which adopted packaging-based acquisition (commit aa2a40322). | |
| #3588 snap: patch patchelf on riscv64 (CRAFT-566) | snapcraft | merged | Merged PR #3588 via commit bf99dbdb2, conditionally patching PatchELF on riscv64 while leaving other architectures unchanged. | |
| #1805205 Ensure elf patching works correctly with golang created ELF files | snapcraft (launchpad) | closed | Fixed Go ELF patching in snapcore/snapcraft PR #2519 by updating the PatchELF handling used for Go-created binaries. |