From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Oberritter Subject: [PATCH] autofs-5.0.7 - link autofs.a into executable only Date: Fri, 15 Mar 2013 16:46:27 +0100 Message-ID: <1363362387-9086-1-git-send-email-obi@saftware.de> References: <51433023.4060008@saftware.de> Return-path: In-Reply-To: <51433023.4060008@saftware.de> Sender: autofs-owner@vger.kernel.org List-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: autofs@vger.kernel.org This reduces the (stripped) binary size from 1.6M to 540K on my system. The linker option -Wl,--whole-archive is used in order to avoid discarding symbols used by modules but not by automount. Signed-off-by: Andreas Oberritter --- Runtime test was successful. Makefile.rules | 2 +- daemon/Makefile | 2 +- modules/Makefile | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index 58b4bb2..ae0a43d 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -67,5 +67,5 @@ endif $(CC) $(CFLAGS) -S $< .c.so: - $(CC) $(SOLDFLAGS) $(CFLAGS) -o $*.so $< $(AUTOFS_LIB) $(DMALLOCLIB) $(LIBNSL) + $(CC) $(SOLDFLAGS) $(CFLAGS) -o $*.so $< $(DMALLOCLIB) $(LIBNSL) $(STRIP) $*.so diff --git a/daemon/Makefile b/daemon/Makefile index 9e9d635..e9f6178 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -30,7 +30,7 @@ endif all: automount automount: $(OBJS) $(AUTOFS_LIB) - $(CC) $(LDFLAGS) $(DAEMON_LDFLAGS) -o automount $(OBJS) $(AUTOFS_LIB) $(LIBS) + $(CC) $(LDFLAGS) $(DAEMON_LDFLAGS) -o automount $(OBJS) -Wl,--whole-archive $(AUTOFS_LIB) -Wl,--no-whole-archive $(LIBS) $(STRIP) automount clean: diff --git a/modules/Makefile b/modules/Makefile index c5deb24..cb9142c 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -97,7 +97,7 @@ endif # lookup_hesiod.so: lookup_hesiod.c $(CC) $(SOLDFLAGS) $(CFLAGS) $(HESIOD_FLAGS) -o lookup_hesiod.so \ - lookup_hesiod.c $(AUTOFS_LIB) $(LIBHESIOD) $(LIBRESOLV) + lookup_hesiod.c $(LIBHESIOD) $(LIBRESOLV) $(STRIP) lookup_hesiod.so cyrus-sasl.o: cyrus-sasl.c @@ -109,11 +109,11 @@ cyrus-sasl-extern.o: cyrus-sasl-extern.c lookup_ldap.so: lookup_ldap.c dclist.o base64.o $(SASL_OBJ) $(CC) $(SOLDFLAGS) $(CFLAGS) $(LDAP_FLAGS) -o lookup_ldap.so \ lookup_ldap.c dclist.o base64.o $(SASL_OBJ) \ - $(AUTOFS_LIB) $(LIBLDAP) $(LIBRESOLV) + $(LIBLDAP) $(LIBRESOLV) $(STRIP) lookup_ldap.so mount_nfs.so: mount_nfs.c replicated.o $(CC) $(SOLDFLAGS) $(CFLAGS) -o mount_nfs.so \ - mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBNSL) + mount_nfs.c replicated.o $(LIBNSL) $(STRIP) mount_nfs.so -- 1.7.10.4