Shrinking ELF

There was a time when embedded developers could scoff at large-scale operating system issues. You simply created a binary image of your software, burned your EPROM, and that was that. But today's systems are getting pretty big. The system I'm working on now would have been a perfectly good desktop computer just a few years ago. And it runs Linux. One problem with many of the development tools under Linux is they assume an embarrassment of riches -- plenty of memory and disk space available. When you are targeting a small board, you may want to coax the tools into being a bit more economical. Of course, you can't do much embedded with gcc without figuring out how to suppress the standard libraries. But when you want to really go tiny, you can do a lot more (or is that a lot less?). I was thinking this article was just covering the basics when they turn a 3998 byte ELF file into a 372 byte file. But that was just the first quarter of the article. After that, they delve into the ELF header itself to reduce that same program down to 45 bytes on disk! Granted, its only a 7 byte program to start with, and not all these techniques will be applicable for every program. But I learned a few things and you never know when some arcane bit of knowledge will come in handy -- or at least win a geek bar bet.


March 20, 2010
URL:http://www.drdobbs.com/embedded-systems/shrinking-elf/228701584

Terms of Service | Privacy Statement | Copyright © 2024 UBM Tech, All rights reserved.