[PATCH] autofs-5.0.7 - link autofs.a into executable only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <obi@xxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux