Hacker News new | ask | show | jobs
by prosaic-hacker 801 days ago
Being nerd sniped into thinking I could learn how to do the same thing for X64.

Backing away from the assembler.

1 comments

I actually did this myself last year for Linux (https://tmpout.sh/3/22.html): it comes out to 73 bytes minimum for a useful program that executes its own code. I should really finish up my writeup establishing that mimimum. (The linked article walks through golfing a 77-byte Hello World program within the headers.)

It's not so easy to find it by naively testing for ignored header fields, since it depends on the precise details of which sizes and addresses must have the same alignment within a page. I instead proceeded from first principles, by studying the ELF loader and determining which programs are definitely ruled out.