Comment by kragen

Comment by kragen a day ago

2 replies

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.

jneem a day ago

I had a quick look and couldn't find a way to turn off per-function sections in rustc. But I think it's a pretty good default for rust, because the unit of compilation is pretty large and so it's common to have a lot of unused functions. It's really only a problem for distributing static libraries, since binaries and shared libraries already lose their per-function sections.

  • kragen 21 hours ago

    I would rather say it's really only potentially beneficial for distributing static libraries, since binaries and shared libraries already lose their per-function sections. So they pay the cost of the fluffier code without getting much benefit, if any.