AutoFS development
 help / color / mirror / Atom feed
From: Andreas Oberritter <obi@saftware.de>
To: autofs@vger.kernel.org
Subject: [PATCH] autofs-5.0.7 - link autofs.a into executable only
Date: Fri, 15 Mar 2013 16:46:27 +0100	[thread overview]
Message-ID: <1363362387-9086-1-git-send-email-obi@saftware.de> (raw)
In-Reply-To: <51433023.4060008@saftware.de>

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@saftware.de>
---
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


      reply	other threads:[~2013-03-15 15:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 15:20 [PATCH 1/3] autofs-5.0.7 - include linux/nfs.h directly in rpc_subs.h Andreas Oberritter
2013-03-14 15:20 ` [PATCH 2/3] autofs-5.0.7 - pass -pthread flag to gcc Andreas Oberritter
2013-03-14 15:21 ` [PATCH 3/3] autofs-5.0.7 - create a shared library Andreas Oberritter
2013-03-14 22:30   ` [PATCH v2] " Andreas Oberritter
2013-03-15 10:28     ` Michael Tokarev
2013-03-15 13:45       ` Andreas Oberritter
     [not found]       ` <51432119.2010200@saftware.de>
     [not found]         ` <5143249F.1030808@msgid.tls.msk.ru>
2013-03-15 14:28           ` Andreas Oberritter
2013-03-15 15:46             ` Andreas Oberritter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363362387-9086-1-git-send-email-obi@saftware.de \
    --to=obi@saftware.de \
    --cc=autofs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox