code-yeongyu / code-yeongyu/c11-compiler-zig-omo
[Sisyphus] phase-3 / verify / Wave B — Ghidra analyzeHeadless decompilation
- Dominant language
- C
- Stars
- 3
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Scope
Run Ghidra `analyzeHeadless` in batch mode to decompile `zcc`-compiled binaries and compare structural similarity against gcc-built decompilations.
## Deliverables
- `phase3/scripts/ghidra-decompile.sh` — script that:
1. Creates a temporary Ghidra project.
2. Imports the `zcc`-compiled binary and the gcc-compiled binary.
3. Runs `analyzeHeadless` with the decompiler script.
4. Exports decompiled C for both.
5. Diffs the two decompilations for structural similarity (function signatures, control flow structure, variable names where debug info is present).
## Success Criteria
1. Decompilation succeeds for every `phase1/c11-ref/001..023.c` binary.
2. Structural similarity score ≥ 80% (same function count, same approximate CFG shape, same types where DWARF is present).
3. Differences are only in register names, stack slot offsets, or compiler-specific intrinsics — not in missing functions or wildly different control flow.
## Dependencies
- Phase 2 Wave 9 (DWARF + regalloc) must be complete so binaries have enough structure for Ghidra.
- Phase 2 Wave 10 (driver) must be complete.
## Suggested Role Assignment
`ghidra-harness-engineer`
## Test Corpus Expectations
- Decompile `001..023` at `-O0` and `-O2`; compare gcc vs zcc.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Phase 2 Wave 9 DWARF/regalloc and Wave 10 driver outputs, then inspect the `phase1/c11-ref/001..023.c` binary corpus and create `phase3/scripts/ghidra-decompile.sh`. Run Ghidra `analyzeHeadless` for gcc and zcc binaries at `-O0` and `-O2`; done means all 23 decompile successfully and meet the stated ≥80% structural similarity criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, shell
- Domain
- compilers, reverse-engineering, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100