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.
•
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.
8
u/Obliviousnut_ 24d ago
Hoły AI, what is happening in 90% of these files?? No commenting / readability, no flow, inconsistent function usage.
I’d suggest writing this yourself, you’ll learn something and can be proud of yourself.
Good luck
1
u/Low_Lawyer_5684 25d ago
Interesting project. I'll defenitely take a look. My current research area is binary code generation and transformation (attempting to create a code morpher, which changes the code without changing its logic. code interleaver, which interleaves instructions of two separate functions creating a single code flow and so on)
-4
u/cobweb6542 24d ago
I agree readability is an issue, and I'm working on it. Still, I believe problems like these should be presented as constructive criticism instead of dismissing the whole project as "AI Slop". Completely hating any use of AI is acceptable, and I don't say otherwise. Another thing, I don't expect anyone to actually contribute; this is a fun project on the side, which I don't put my full-day attention on. I was a bit hostile to an earlier reply, "Holy Ai...", which I probably shouldn't have been, so give me criticism if you want, but make it constructive so we grow as a human society.