done by kusma
logo done by kusma :: pouët.net is hosted on the huge scene.org servers



Account

Custom

Prods

Random

Groups

Parties

Boards

Users

Search

BBS

Lists

Faq

Submit



Haxxoring the elf format for 1k/4k stuff
category: general

  previous page
go to page of 6  
alrj: that sounds nice. tell us when it's done - so I can announce that properly :)
added on the 2009-05-29 16:22:27 by las  
las
@parapete/leblane/las: great work! i've dusted off my asm skills during the last few days and re-implemented your technique in order to better understand it. now, i've got one question: why are you recalculating the hashes and doing a linear search instead of using the bucket list? is it because otherwise you would still need the full symbol name?

thx, floe
added on the 2009-06-19 09:31:05 by floe  
floe
floe, yep that's right. the hash used in the elf format produces lots of collisions in the table even for a small amount of symbols, whereas the one we're using doesn't have the same problem in my experience.
added on the 2009-06-19 11:50:30 by petemobil  
petemobil
actually now that i think about it there might have been other reasons for doing that too, i really don't remember as i haven't touched this code in a while. let us know if you come up with something more efficient!
added on the 2009-06-19 11:52:01 by petemobil  
petemobil
Done !

Feel free to test The Byte Optimized Linker, for linux/x86_64.

This first release doesn't support much, not even archives files (.a).
Porting to 32bit x86 will require a lot of tedious work I really don't want to do because I don't have any x86 where I could test and use it.

Flow2 included :)
added on the 2009-08-08 21:16:57 by alrj  
alrj
Nice! It would be easy to make 7.2 completely integrated into the linker though:

Quote:
objdump -t $TARGETOBJ | awk ' /\*UND\*/{print $4}' > symbollist


dumps the names of unresolved symbols in an .o file.

The rest of my stuff is here : http://parapete.untergrund.net/bdle/ if you fancied a look. It completely automates the process, however your tool has much better potential to crunch bytes since you can reorder sections and such.

Now go and write an intro!
added on the 2009-08-08 22:46:13 by petemobil  
petemobil
It would be interresting to compare the respective sizes of the (compressed) binaries made using each technique: one with my --aligned --ccall, and one with the functions pointers.

It might be worth it for a 1k, but maybe not for a 4k. Lzma just loves repeating chunks :)
added on the 2009-08-08 23:30:19 by alrj  
alrj
like any compression technique ?
added on the 2009-08-09 11:22:21 by MsK`  
MsK`
@alrj: Thanks! I'm trying to link my latest linux 4k with your linker in order to compare sizes with the original version, but I'm having some trouble: uninitialized global variables (which should end in .bss in the final executable) become common symbols (SHN_COMMON) in the object files, and bold crashes when it finds them.

I made some small changes to the linker and now simple helloworld-ish examples work, and the intro links, but segfaults when I run it. I'm not familiar with the internals of the linking process, so I'm not sure if my modifications are anywhere near correct, but I can send a patch or setup a public git repository with my changes if you (or anyone else) want to review them :)
added on the 2009-08-13 20:13:29 by slack  
slack
@slack: Yup, I've recently discovered the SHN_COMMON bug when playing with C sources. The compiler puts uninitialized global variables into the SHN_COMMON pseudo-section instead of .bss, so that if another source file declares it, the linker should merge them. It means that the linker itself has to reserve additionnal room in .bss.

Some hackish temporary workaround would be to declare the global variables as "static" if they are only used in one file (→ no need for it to be COMMON), or assign it a value (→ goes to .data instead of .bss/COMMON).

I'll try to implement the support for SHN_COMMON this weekend.

Could you send your patch to amand.tihon@alrj.org ?
Thanks.
added on the 2009-08-15 08:57:33 by alrj  
alrj
On Mac OS X the smallest binary is 165 bytes according to: Crafting a Tiny Mach-O Executable by Amit Singh
added on the 2009-08-15 12:29:42 by neoneye  
neoneye

  previous page
go to page of 6  

post a new reply
You need to be logged in to post a new reply :: register here




Account

Custom

Prods

Random

Groups

Parties

Boards

Users

Search

BBS

Lists

Faq

Submit



pouët.net 0.9.903 © 2000-2010 mandarine - hosted on scene.org
send comments and bug reports to webmaster@pouet.net
page created in 0.018440 seconds.