Repository navigation
feat(analysis): implement Golang ABI calling conventions and prologue voting - #6830
Open
doomedraven wants to merge 8 commits into
Open
doomedraven wants to merge 8 commits into
doomedraven wants to merge 8 commits into
Conversation
… voting - Define golang (ABIInternal) and golang_abi0 calling conventions in SDB for x86-64, ARM64, and x86-32 - Implement statistical prologue voting heuristic across sampled Go functions to automatically distinguish ABIInternal from ABI0 on stripped/obfuscated binaries - Automatically assign detected Go calling convention to recovered sym.go.* functions - Filter compiler-generated wrapper symbols (.abi0, .abiinternal, ..inittask, type:*) from deep function analysis - Linked to rz-ghidra PR for SLEIGH decompiler prototype integration
doomedraven
requested review from
Rot127,
b1llow,
kazarmy,
notxvilka,
ret2libc,
thestr4ng3r and
wargio
as code owners
October 3, 2026 11:11
This was referenced Oct 3, 2026
trufae
pushed a commit
to radareorg/radare2
that referenced
this pull request
Oct 3, 2026
doomedraven
force-pushed
the
feature/golang-abi-support
branch
from
October 4, 2026 06:37
61d99c4 to
51c70a1
Compare
wargio
requested changes
Oct 4, 2026
wargio
requested changes
Oct 4, 2026
wargio
requested changes
Oct 4, 2026
Author
|
Addressed the early return comment. Tests pass locally. |
Author
|
Addressed the minor review comments: used |
Author
|
Removed the |
wargio
approved these changes
Oct 5, 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.
Your checklist for this pull request
RZ_APIfunction and struct this PR changes.RZ_API).Detailed description
This PR implements native Go calling convention support and automatic ABI detection for compiled Golang binaries across x86-64, ARM64, and x86-32.
Problem
Previously, Rizin analyzed Go functions using default host C calling conventions (e.g. System V AMD64 or Microsoft x64 with single RAX return).
Go 1.17+ introduced ABIInternal, a register-based calling convention passing up to 9 integer arguments across registers (RAX, RBX, RCX, RDI, RSI, R8, R9, R10, R11) and returning multiple values across registers. Additionally, Go 1.16 and 1.17 share the same pclntab header magic (0xFFFFFFFA), making it difficult to distinguish stack-based ABI0 from register-based ABIInternal when build information is stripped or obfuscated.
Changes
librz/arch/types/cc-x86-64.sdb.txt: Addedgolang(RAX–R11, ret=rax, self=r14) andgolang_abi0.librz/arch/types/cc-arm-64.sdb.txt: Addedgolang(X0–X15, ret=x0, self=x28).librz/arch/types/cc-x86-32.sdb.txt: Addedgolang(stack, ret=eax).librz/core/golang.c):49 3B 66 10/4D 3B 66 10(CMPQ SP|R12, 16(R14)): Register ABI (R14 holds g).65 48|4C 8B /rwith SIB0x25(MOVQ GS:[disp32], reg): Stack ABI (loads g from TLS)..abi0,.abiinternal,..inittask,type:*) from deep function analysis to keep the symbol table clean.fcn->cc = "golang"(or"golang_abi0") on all functions discovered viapclntab.Test plan
meson test -C build --suite unit-> 138/138 passed.aalgcorrectly detects Register ABI and tagssym.main.*withcall-convention: golang.test/db/analysis/golangto checkgolangcalling convention detection.Closing issues