Static bins

Robert Connolly cendres at videotron.ca
Wed Jan 7 14:36:11 PST 2004


On January 7, 2004 05:29 pm, Matthew Burgess wrote:
> On Wed, 07 Jan 2004 16:59:08 -0500
>
> Robert Connolly <cendres at videotron.ca> 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!
>
> Cheers,
>
> Matt.

$1 for false, my mistake. Its on wiki.linuxfromscratch.org now btw. $0 
for /bin/true. My binary size results were the same as yours.




More information about the hlfs-dev mailing list