Static bins

Matthew Burgess matthew at
Wed Jan 7 14:29:12 PST 2004

On Wed, 07 Jan 2004 16:59:08 -0500
Robert Connolly <cendres at> wrote:

> Also:
> cat > false.S << "EOF"
> .global _start
> _start:
> movl    $0,%ebx
          $1 ;surely for false? :)

Thanks for posting that - I was hurriedly trying to write much the same
thing, knowing virtually nothing about assembly in general, and nothing
at all about assembly on linux.

Before reading that I managed to get it to work without setting %eax at
all and calling "ret" instead of int $0x80.  I'm thinking this was
beginners luck but I'm amazed now it worked as expected.

Incidentally I was using `gcc false.S` and then `gcc -static false.S` to
see what the differences were and was amazed at the size of the binaries
(11k and 4.5M respectively!).  Why the hell does it bring in the whole
of libc when it doesn't even call any C functions!  Even after
`strip--strip-all` it was still 414k!  With the basic `as` and `ld`
combo it came down to a mere 660 bytes!



More information about the hlfs-dev mailing list