
Creating Really Teensy ELF Executables for Linux - dexen
http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
======
jcr
This article is surprisingly better (and longer ;) than I expected, but it
skipped over explaining one important distinction; "ELF" is an executable file
format, but "a.out" is more than just a default file name; it's also the name
of a totally different executable file format.

Originally, the "a.out" executable format, and hence, the "a.out" file name
were due to being the "assembler output" of Ken Thompson's assembler in 1968.
Most all UNIX-based systems have moved to using newer ELF format, but there
are a few hold-outs still using the older a.out format. As for why ELF
formatted executable files are still given the file name "a.out" by default,
even when they are not in the "a.out" executable format, it's just a historic
artifact (or annoyance) due to compilers and linkers.

[http://en.wikipedia.org/wiki/A.out](http://en.wikipedia.org/wiki/A.out)

~~~
pkrumins
This is the original article that all the other "tiny elf" or "tiny
executable" articles are based on. It was written 15 years ago.

------
cache87
That's what I loved about DOS com executables. Possibly the smallest program
was:

    
    
      int 20;
    

which got translated into CDh 20h (4 bytes!)

~~~
xyproto
That's 2 bytes, not 4. A byte goes from 00 to FF.

------
whitten
I'm impressed. The author did a lot of mangling to allow the code to be as
small as possible. Other than ELF and a.out format, (which is discused by
@jcr) I wonder if there are other formats understood by Linux ?

------
qwerta
Nice. Perhaps have a look at uclibc and busybox... :-)

~~~
gfto
These are not really small anymore. Look for musl libc [1] and toybox [2]
instead.

[1]: [http://www.musl-libc.org/](http://www.musl-libc.org/)

[2]: [http://www.landley.net/toybox/](http://www.landley.net/toybox/)

------
mistaken
I was hoping that the final size would be 42 :)

------
listic
Care to update for 64 bits?

~~~
caust1c
Here are the uncommented changes I made to each stage:

[https://github.com/abraithwaite/teensy](https://github.com/abraithwaite/teensy)

------
sctb
[https://news.ycombinator.com/item?id=8642734](https://news.ycombinator.com/item?id=8642734)

