Slashdot Mirror


PPK debuts the tiny programming challenge

kernelistic writes "Looks like the great folks at properkernel.com are running a developer challenge. They're looking for smallest executables that match the posted criteria. The rules look fairly straightforward. Anyone up for some fun?"

10 of 67 comments (clear)

  1. howto of sorts... by raulmazda · · Score: 5, Informative

    Looks like they want a binary similar to the one described in A Whirlwind Tutorial on Creating Really Teensy ELF Executables for Linux , except it has to print text and not just return 42.

    If only I had some spare time to play along at home...

    1. Re:howto of sorts... by jericho4.0 · · Score: 3, Interesting
      His solution was 45 bytes. I think the 2500 byte limit in the rules is going to encourage some solutions whose writers will be crushed by the winner.

      It's a nice challenge, but I think they should have been a bit more specific in the rules ('Preferably no fastcall binaries') and stated a more challenging task than putting out a string.

      --
      "A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis
  2. Interesting challenge. by AJWM · · Score: 5, Interesting

    Just for comparison's sake, the quick'n'dirty approach:

    main()
    {
    char *msg = "The deep gray mouse runs after the holy yellow cheese.\n";
    write(1, msg, 56);
    }

    produces, stripped, a 3200 byte binary -- too big to qualify by 700 bytes.

    --
    -- Alastair
  3. I think these guys must be reading Slashdot ... by Anonymous Coward · · Score: 3, Informative
    After some of the comments on here:

    • 3. Uses a stack-based approach (ie. No fastcall binaries!).
    has changed to:

    • 3. Uses a stack-based approach (ie. Preferably no fastcall binaries).
    And:

    • ... as long as the output is a valid ELF image.
    has changed to:

    • as long as the output is a valid x86 ELF image.
    Also they added:

    • Hate bloatware? This is your chance to show it!
    for some reason. Probably a slur against Microsoft, knowing what this lot is like.
  4. Beat this... by andfarm · · Score: 3, Interesting
    At one point I wrote a Mac OS (Classic) program that displayed the phase of the moon (as text AND a graphic) in a dialog box.

    The catch? I did it in 5,038 bytes, including a nifty color icon.

    Beat that.

    --

    TANSTAAFI: There Ain't No Such Thing As A Free iPod.

    1. Re:Beat this... by photon317 · · Score: 3, Interesting


      Heh, a freind of mine and I, about 8 years ago we had an x86 assembler programming contest between us. This contest was to reproduce a pager program under DOS (like the "more" command) that would take a filename argument and page it to the screen, one page per keystroke. He beat me just barely, the final numbers of bytes were like 97 and 102.

      --
      11*43+456^2
  5. Deep gray mouse runs after the holy yellow cheese by wcbarksdale · · Score: 4, Funny

    At least they've chosen a challenge with practical implications.

  6. Re:Eh, why? by 0x0d0a · · Score: 3, Funny

    Because it keeps people who would otherwise be writing tiny exploit code to take advantage of buffer overflows otherwise occupied.

  7. Re:Eh, why? by jericho4.0 · · Score: 3, Informative

    Because it's a challenge, of course. Why are you reading the developers section?

    --
    "A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis
  8. super easy to beat the limit... by Just6979 · · Score: 5, Interesting

    justin@joker:~/tmp[1]$ cat small.s
    ; Justin White
    ; http://properkernel.com/tiny/ entry

    %define STDOUT 0
    %define SYS_exit 1
    %define SYS_write 4

    section data
    msg db "The deep gray mouse runs after the holy yellow cheese.", 0x0A
    msg_size equ $-msg

    section text
    global _start
    _start:
    ; write
    push dword msg_size
    push dword msg
    push dword STDOUT
    mov eax, SYS_write
    push eax
    int 0x80
    ; exit
    push dword 0
    mov eax, SYS_exit
    push eax
    int 0x80
    ; end _start

    ;EOF
    justin@joker:~/tmp[0]$ nasm -f elf small.s
    justin@joker:~/tmp[0]$ ld -x -s -o small -nostdlib --stats small.o
    /usr/libexec/elf/ld: total time in link: 0.006606
    /usr/libexec/elf/ld: data size 184328
    justin@joker:~/tmp[0]$ ll small
    -rwxrwxr-x 1 justin justin 516 Nov 25 03:22 small*
    justin@joker:~/tmp[0]$ ./small
    The deep gray mouse runs after the holy yellow cheese.
    justin@joker:~/tmp[0]$

    that's using FreeBSD kernel calls.

    that's the smallest it'll be without doing ELF header tweaking like in that tiny binary tutorial.

    actually, can save like 8 bytes by using just AL and not all of EAX to hold the syscall numbers.

    now, if they said, do it without using the kernel, that would have been a challenge :P

    --
    --Justin