Smallest Hello World

April 23, 2008 on 10:04 am | In Personal, Programming | By QBasicer |

In what turned out to be an assembly vs Java comparison of hello world, I’ve managed to get a hello world app down to a lean 380 bytes. objdump -d:


hello.bin:     file format elf32-i386

Disassembly of section .text:

08048094 <.text>:
 8048094:       ba 0c 00 00 00          mov    $0xc,%edx
 8048099:       b9 b8 90 04 08          mov    $0x80490b8,%ecx
 804809e:       bb 01 00 00 00          mov    $0x1,%ebx
 80480a3:       b8 04 00 00 00          mov    $0x4,%eax
 80480a8:       cd 80                   int    $0x80
 80480aa:       bb 00 00 00 00          mov    $0x0,%ebx
 80480af:       b8 01 00 00 00          mov    $0x1,%eax
 80480b4:       cd 80                   int    $0x80

Can you do better? This hello world does not link to any outside libs like stdlib, and only uses kernel system calls. We were able to get a java 6 compiled class to 517 bytes, but I’m not sure if I could make it smaller (Java bytecode maybe?)

Edit: I found a page on creating really small ELF executables for linux. They don’t say hello world, but it could be easily modified if you knew how to translate AT&T to Intel. I really can’t remember, or have the ambition to do so, so I’ll just link

No Comments yet »

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with Pool theme design by Borja Fernandez. I rewrote the CSS because I'm cool like that.
Entries and comments feeds. Valid XHTML and CSS. ^Top^