This is actually a lot of fun. Never did it on Linux, but Windows PE EXE files make similar tricks possible. Windows 95 in particular was very permissive. Using a (very primitive, by today's standards) hex editor I tried making the ".text" section begin halfway through the header and bang! ..it worked, a revelation of sorts. I imagine today's loaders may be a bit more strict because of security but I guess you can always make your own loader :)
guenthert 43 minutes ago [-]
Oh, ELF file manipulation. I thought this would be about getting Linux to run on a Teensy.
I wonder how much of this could be done by a clever linker? There’s a lot of skill in there but how would an llm do, for the rest of us?
Panzerschrek 3 hours ago [-]
The program described in this article is as simple as possible. What about something more complex, like basic "hello world"? It requires at least one more syscall and several bytes more data.
stevekemp 1 hours ago [-]
Take a look at the collections by the same author:
Discussed here a couple months ago: https://news.ycombinator.com/item?id=48654411
Part 3: https://www.muppetlabs.com/~breadbox/software/tiny/somewhat....
https://forum.pjrc.com/index.php?threads/linux-on-teensy-4-x...
https://www.muppetlabs.com/~breadbox/software/tiny/home.html
There are some more complete programs there.