Static bins

Zack Winkles winkie at linuxfromscratch.org
Wed Jan 7 16:33:54 PST 2004


Ian Molton <spyro at f2s.com> said:
> On Wed, 7 Jan 2004 19:13:09 -0500
> Zack Winkles <winkie at linuxfromscratch.org> wrote:
> 
> > > you can 'fold' a lot of the elf headers, making binaries about 20
> > > odd bytes, IIRC.
> > 
> > "There is no getting around the fact that the 45th byte in the file,
> > which specifies the number of entries in the program head table,
> > needs to be non-zero, needs to be present, and needs to be in the
> > 45th position from the start of the ELF header."
> 
> Thats the doc I was thinking of. slightly misremembered it though.
> 
> I wonder if you could actually get your code inside the first 45 bytes
> though, without violating the standard and still being executable...
> (maybe you can and I forgot - I havent re-read the document.

It's a massive violation of the standard, no doubt, but it still
executes just fine.  Linux just doesn't care about some stuff, and when
you look at the standard, it's easy to see why.

As a side note, you guys trying to make the smallest version of
true/false have already been beaten by the author of that document.  The
code he presents returns 42, granted, but any idiot can modify it. 
Can't beat 45 bytes with a stick.



More information about the hlfs-dev mailing list