Hacker News Viewer

C89cc.sh – standalone C89/ELF64 compiler in pure portable shell

by gaigalas on 4/1/2026, 8:41:49 AM

https://gist.github.com/alganet/2b89c4368f8d23d033961d8a3deb5c19

Comments

by: kelsey98765431

Would be a lot better if it came with tests. Please do this justice and dont let it rot as a gist, make a real repo and add some docs and at least smoke tests or some kind. Thanks

4/3/2026, 1:53:35 AM


by: _ache_

I'm tempted to execute it, but it may as well be shellcode I couldn't tell.

4/3/2026, 3:23:13 AM


by: gaigalas

Single standalone file, no external tools used, PATH=&#x27;&#x27; (empty), portable (bash, dash, ksh, zsh), produces x86 ELF executables, has mini-libc builtin.<p>Usage:<p>printf &#x27;int main(){puts(&quot;hello&quot;);return 0;}&#x27; | sh c89cc.sh &gt; hello<p>chmod +x hello<p>.&#x2F;hello

4/1/2026, 8:41:49 AM


by: jey

It targets x86-64&#x2F;ELF? I thought it would target `sh` to be portable?

4/3/2026, 2:25:18 AM


by: dmitrygr

Many parts of this are clearly autogenerated, but that in no way diminishes the sickening impressiveness of it!

4/3/2026, 1:52:57 AM