Request compiler to emit every function and data variable in its own
section, then request the linker to remove unused sections. This reduces
the size of the final binary. Compiling with --disable-iwmx, we have the
following results:
Before:
=======
text data bss dec hex filename
418450 29144 1392 448986 6d9da src/connmand
Binary size: 1792091 B
Binary size stripping symbols: 450296B
After:
======
text data bss dec hex filename
408486 29032 1384 438902 6b276 src/connmand
Binary size: 1840021B
Binary size stripping symbols: 440736B
---
Makefile.am | 5 ++++-
acinclude.m4 | 1 +
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index cb377ca..42dc155 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -83,7 +83,10 @@ src_connmand_LDADD = $(builtin_libadd) @GLIB_LIBS@
@DBUS_LIBS@ \
@CAPNG_LIBS@ @UDEV_LIBS@ -lresolv -ldl
src_connmand_LDFLAGS = -Wl,--export-dynamic \
- -Wl,--version-script=$(srcdir)/src/connman.ver
+ -Wl,--version-script=$(srcdir)/src/connman.ver \
+ -Wl,--as-needed \
+ -Wl,--gc-sections \
+ -Wl,--print-gc-sections
CLEANFILES = src/connman.conf src/builtin.h $(local_headers)
diff --git a/acinclude.m4 b/acinclude.m4
index 84086fd..4909abc 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -23,6 +23,7 @@ AC_DEFUN([COMPILER_FLAGS], [
CFLAGS+=" -Wredundant-decls"
CFLAGS+=" -Wcast-align"
fi
+ CFLAGS+=" -ffunction-sections -fdata-sections"
])
AC_DEFUN([GTK_DOC_CHECK],
--
1.7.3.1
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman