http://binky.org.uk/sources/unportable.c http://binky.org.uk/sources/unportable.txt When I was told that it didn't work any more, I set to work on a new one. After all, what good is unportable code if it doesn't work? It had been so long, though. I remember that back then I did it the hard way. Well, not this time! First, I nasm'd myself something that worked. In order to be reduced, it can't use any globals. I used the same trick as before to write stuff, namely push the data to the stack and use IT as a pointer. What I came up with was quite simple, and it worked. But that was just assembler. Now to reduce it. I wrote a perl script to reduce arbitrary objects to c code: http://binky.org.uk/sources/unportable2.pl So compile: $ nasm asm.s -f elf && ld -s -o asm asm.o && ./asm Run the script: $ ./compile.pl asm.o > casm.c And compile the result: $ gcc casm.c -o casm && ./casm Hello world Bam. Works. But it was too long, so I went to shave off some bytes. This was fun: http://binky.org.uk/sources/unportable2.s It's probably as short as it's possible to get. It's shorter than the last one, anyway. $ objdump -d asm.o asm.o: file format elf32-i386 Disassembly of section .text: 00000000 <_start>: 0: 31 db xor %ebx,%ebx 2: 43 inc %ebx 3: 89 d8 mov %ebx,%eax 5: c1 e0 02 shl $0x2,%eax 8: 89 c2 mov %eax,%edx a: d1 e2 shl %edx c: 01 c2 add %eax,%edx e: 68 72 6c 64 0a push $0xa646c72 13: 68 6f 20 77 6f push $0x6f77206f 18: 68 48 65 6c 6c push $0x6c6c6548 1d: 89 e1 mov %esp,%ecx 1f: cd 80 int $0x80 21: 93 xchg %eax,%ebx 22: cd 80 int $0x80 With the reduced result: http://binky.org.uk/source/unportable2.c