r/C_Programming • u/cobweb6542 • 27d ago
Project i started building a dynamic binary optimizer in C11, looking for contributors
hey everyone,
i recently started a project called recode, an experimental dynamic binary optimizer for linux x86-64. figured i'd share it here in case anyone interested in low-level C, x86 internals, or JIT compilation wants to take a look.
right now it works with a very restricted subset of x86-64 instructions and functions following the System V AMD64 ABI ("uint64_t f(uint64_t)").
it decodes machine code, builds a small intermediate representation, simplifies arithmetic where possible, and emits new native instructions into memory that's switched from writable to executable before running.
for example, something like:
"mov rax, rdi; add rax, 7; sub rax, 2; nop; ret"
can be reduced to:
"mov rax, rdi; add rax, 5; ret"
the actual emitted code also includes an ENDBR64 entry marker.
it's still early and intentionally limited. there's no ELF loading, general branching, memory operand support, or syscall instruction handling. only return-value equivalence is guaranteed by the current contract, not flags or full CPU state. it's also not a sandbox.
i've documented the implementation, supported instruction encodings, build instructions, tests, and benchmarks in the repo.
looking for contributors:
i'd like to expand the supported instruction set and improve the optimizer over time. if you're comfortable with x86 instruction encoding, the System V AMD64 ABI, code generation, or executable memory management, i'd be interested in having you contribute.
code reviews, bug reports, and technical feedback are welcome too.
there's also an "AGENTS.md" and contribution guidelines. AI tools are fine, but contributors need to understand and take responsibility for every line they submit. i'd rather have a small, correct patch than a large one nobody can explain.
View all comments
•
u/AutoModerator 27d ago
Hi /u/cobweb6542,
Your submission in r/C_Programming was filtered because it links to a git project.
You must edit the submission or respond to this comment with an explanation about how AI was involved in the creation of your project.
While AI-generated code is not disallowed, low-effort "slop" projects may be removed and it's likely that other users push back strongly on substantially AI-generated projects.
You can read more at How do I post my Project?
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.