fix: check .gopclntab before .data.rel.ro for PIE binaries#330
fix: check .gopclntab before .data.rel.ro for PIE binaries#330jiridanek wants to merge 1 commit intoopenshift:mainfrom
Conversation
Go 1.26 changed the ELF layout for PIE builds: .gopclntab is now emitted as a separate section instead of being embedded in .data.rel.ro (the Go <= 1.25 behavior). ReadTable unconditionally redirected to .data.rel.ro when it saw -buildmode=pie, causing "could not find magic number" failures on any Go 1.26-built PIE binary. Fix: always check .gopclntab first, fall back to .data.rel.ro only if absent. This is backward-compatible since Go <= 1.25 PIE binaries don't have .gopclntab. Fixes openshift#329 Co-authored-by: Cursor <cursoragent@cursor.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jiridanek The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@jiridanek: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
Go 1.26 changed the ELF layout for PIE builds:
.gopclntabis now emitted as aseparate section instead of being embedded in
.data.rel.ro(the Go <= 1.25behavior).
ReadTableunconditionally redirected to.data.rel.rowhen it saw-buildmode=pie, causing "could not find magic number" failures on any Go1.26-built PIE binary.
This fix always checks
.gopclntabfirst, falling back to.data.rel.roonlyif absent. This is backward-compatible since Go <= 1.25 PIE binaries don't have
.gopclntab.Fixes #329
Evidence
Binary comparison of two s390x skopeo builds from RHEL 9 container images:
.gopclntabsection.data.rel.roappstream)appstream-eus)This will affect all architectures once more RPMs are rebuilt with Go 1.26.
Made with Cursor