Repository navigation
objfile: fallback to modern moduledata layouts when runtimeVersion is unknown - #102
Merged
Merged
Conversation
mlhaigh
force-pushed
the
fix-modern-go-support
branch
from
September 11, 2026 15:02
046aefa to
8492eab
Compare
stevemk14ebr
requested changes
Sep 13, 2026
stevemk14ebr
left a comment
Collaborator
There was a problem hiding this comment.
thanks for the contribution, small changes requested
… unknown
When a Go binary has its build information stripped or obfuscated (e.g. via
Garble), runtimeVersion is detected as 'unknown'. Previously, GoReSym fell back
to using layoutVersion directly (which is '1.20' for all Go 1.20+ binaries).
While Go 1.20 through 1.25 share the same moduledata struct offsets, Go 1.26
introduced epclntab, shifting subsequent fields (textsectmap, typelinks,
itablinks) by 8 bytes on 64-bit and 4 bytes on 32-bit. As a result, candidate
validation failed on stripped/obfuscated Go 1.26 binaries when defaulting to
the 1.20 layout.
When runtimeVersion is unknown and layoutVersion is '1.20', this change tests
candidate layouts ('1.20' followed by '1.26') during moduledata validation.
This enables stripped/obfuscated Go 1.26 binaries to parse successfully
without requiring a manual -v flag override, while preserving exact behavior
for Go 1.20-1.25 binaries.
mlhaigh
force-pushed
the
fix-modern-go-support
branch
from
September 14, 2026 16:32
8492eab to
e7b45f5
Compare
Contributor
Author
|
Thanks for the review and suggestions @stevemk14ebr! I've updated the PR with both changes:
All unit tests (./...) pass cleanly and verified. Ready for another look! |
stevemk14ebr
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
When a Go binary has its build information stripped or obfuscated (e.g., using tools like
garblethat removeruntime.buildVersion),runtimeVersionis detected as"unknown". Previously inobjfile/objfile.go, GoReSym fell back to usinglayoutVersiondirectly ("1.20"for all Go 1.20+ binaries).While Go 1.20 through Go 1.25 share identical
moduledatastruct offsets, Go 1.26 introducedepclntab, shifting subsequent fields (Textsectmap,Typelinks, andITablinks) by 8 bytes on 64-bit and 4 bytes on 32-bit (e.g.,Textsectmapmoved from offset 328 to 336 on 64-bit).Because
runtimeVersionwas defaulted strictly to"1.20", GoReSym selected the 1.20 layout, causing candidatemoduledatavalidation invalidateAndConvertModuleDatato fail on stripped Go 1.26 binaries, resulting in{"error": "Failed to parse file: no valid pclntab found"}.Solution
In
objfile/objfile.go, whenruntimeVersionis unknown andlayoutVersionis"1.20",ModuleDataTablenow tests candidate modern layouts ("1.20"followed by"1.26") during candidate validation. Testing"1.20"first ensures backwards compatibility and avoids false-positive matches on Go 1.20–1.25 binaries, while cleanly falling back to"1.26"for stripped Go 1.26 binaries. In addition, candidate ignorelist handling was cleaned up to avoid duplicate entries during candidate layout evaluation.Testing & Verification
go test -v -count=1 ./objfile: 20 test suites, 70 subtests (90 PASS assertions, 0 failures).go test -v -count=1 ./...: 111 passed, 7 skipped, 0 failures.garble,garble -literals,garble -tiny) across Linux amd64, Windows amd64, and Windows 386.Failed to parse file: no valid pclntab found.-vflag overrides.