[systemd-commits] configure.ac

Lennart Poettering lennart at kemper.freedesktop.org
Tue Oct 5 12:47:06 PDT 2010


 configure.ac |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 9b85fc6a89386582bfe792dba881800b0a093839
Author: Gustavo Sverzut Barbieri <barbieri at profusion.mobi>
Date:   Tue Oct 5 21:45:51 2010 +0200

    build-sys: Add compiler and linker flags to reduce binary size
    
    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).

diff --git a/configure.ac b/configure.ac
index 753adc5..562921a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,7 +86,12 @@ CC_CHECK_CFLAGS_APPEND([ \
         -ffast-math \
         -fno-common \
         -fdiagnostics-show-option \
-        -fno-strict-aliasing])
+        -fno-strict-aliasing \
+        -fvisibility=hidden \
+        -ffunction-sections \
+        -fdata-sections \
+        -Wl,--as-needed \
+        -Wl,--gc-sections])
 
 LT_PREREQ(2.2)
 LT_INIT


More information about the systemd-commits mailing list