logoalt Hacker News

Shrinking While Linking

35 pointsby ingvelast Thursday at 11:47 PM10 commentsview on HN

Comments

Joker_vDtoday at 12:51 PM

> A static library is nothing but a bundle of object files, wrapped in an ancient and never-quite-standardized archive format.

To this day I'm astonished that it's not just tar. Or pax. Or even cpio! Or literally any file format that has any other use.

show 1 reply
kragentoday at 10:28 AM

These are extremely practical tips on using binutils to shrink your libraries. It might also be worthwhile to compile the library without per-function sections in the first place, which hopefully can be done without patching rustc. On many platforms this produces significantly smaller code in GCC.

lionkortoday at 10:52 AM

> Back in the day, your compiler or assembler would turn each source file into an “object” file containing the compiled code.

Lots and lots of code is still C and C++. That's not really "back in the day".

show 1 reply