[systemd-devel] [PATCH] Compiler and linker flags to reduce binary size.

Lennart Poettering lennart at poettering.net
Tue Oct 5 12:47:39 PDT 2010


On Thu, 30.09.10 15:58, Gustavo Sverzut Barbieri (barbieri at profusion.mobi) wrote:

> Reduce number of exported symbols with -fvisibility=hidden by default,
> this is safe as we're not generating and loadable library and our
> binaries should have no exported symbol other than main(). This alone
> reduces around 4kb per binary.
> 
> It will also request GCC to emit every function and data variable in
> its own section, then request the linker to remove unused
> sections. This reduces the size of utility tools
> (/lib/systemd/systemd-*) by half or even more (in my system some
> binaries went from 84kb to 32kb).
> 
> m4/attributes.m4 was modified to provide CC_CHECK_LDFLAGS_APPEND() in
> the same lines as CC_CHECK_CFLAGS_APPEND().

I dropped the .m4 part of the patch (as discussed on IRC) and merged the
patch.

Thanks, 

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list