Haxxoring the elf format for 1k/4k stuff

category: code [glöplog]
...and let's remember that most compos(that I've seen at least) only give write permission to /tmp and as such it's the usual location to unpack the binary.
added on the 2011-10-11 19:47:31 by r-A r-A
/dev/shm is also an option, as it's not written to disk
added on the 2012-03-15 17:31:25 by Int19h Int19h
I don't know what's the local policy over thread necromancy, but...

A few days ago, I put up a tool to create small ELF32 binaries for FreeBSD and Linux.

This is a project that grew from the portability work on Lavos, but after the release I noticed there was room for improvement. As of today, there is also a documentation available.

I'd prefer if at least the parties that have shaped the result would take a look at the documentation. If for nothing else, then just to see there's nothing obvious wrong in attribution. Currently, this refers to Marq, Parcelshit, las, and the members of Hymy and YOLP.

The techniques presented could theoretically be extendable to any platform using 32-bit ELF. In particular, I believe Raspberry PI or Fuloong 2F 4ks using armel or mipsel should be (easily) possible. Big-endian platforms such as armeb, mipseb or ppc32 shouldn't be that hard either.

Anyway, bug reports and complaints are welcome. I've only really tested this in FreeBSD. The Linux tests have been done in a Linux jail, that is probably not quite good enough.
added on the 2014-05-29 00:36:38 by Trilkk Trilkk
Nice to see new progress with elf/4k hacking!
added on the 2014-05-29 09:12:24 by Marq Marq
Nice. What sort of amounts of stuff have you been able to use this way? How much code for music player, how much shader code etc. I could be potentially interested in doing something for the Raspberry Pi, because it connects straight to a CRT monitor. I've done some initial shader tests, and they look just fabulous on the CRT.
added on the 2014-05-29 09:44:45 by yzi yzi
How much code for music player, how much shader code etc.

I don't really have any numbers like this because the work here is just extended from earlier mechanisms we used for Lavos and Yog-Sothoth. Those intros have no clear fixed sizes for any parts, we just clumped everything together and then started removing bytes from wherever we could.

Usually Juippi takes about one kilobyte for the music. Shaders are one kilobyte, one kilobyte for control, and one for the systems programming. Updating the docmentation with the new final sizes, using manually crafted ELF headers frees about 300 compressed bytes. I'm looking forward to taking advantage of those.

(The sizes in Lavos are an exception, as it was collateralburger's first foray into introcoding. In that intro it's about 1k systems programming, 3k shaders, 3k control code, 1k font, 8k synth.)
added on the 2014-05-29 13:47:16 by Trilkk Trilkk
Added a prod of the former.

New in r83:
- Manually change origin/entry point for better compressable constant.
- Omit symbols '__progname' and 'environ' on Linux, they seem to not be needed.
added on the 2014-05-30 23:51:24 by Trilkk Trilkk