* [PATCH 1/3] autofs-5.0.7 - include linux/nfs.h directly in rpc_subs.h @ 2013-03-14 15:20 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 0 siblings, 2 replies; 8+ messages in thread From: Andreas Oberritter @ 2013-03-14 15:20 UTC (permalink / raw) To: autofs Fixes compile error with uclibc. Glibc's nfs/nfs.h contains nothing but "#include linux/nfs.h". rpc_subs.h already includes other linux/nfs*.h files directly. Signed-off-by: Andreas Oberritter <obi@saftware.de> --- include/rpc_subs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rpc_subs.h b/include/rpc_subs.h index b6d59f9..a2d9648 100644 --- a/include/rpc_subs.h +++ b/include/rpc_subs.h @@ -18,7 +18,7 @@ #include <rpc/rpc.h> #include <rpc/pmap_prot.h> -#include <nfs/nfs.h> +#include <linux/nfs.h> #include <linux/nfs2.h> #include <linux/nfs3.h> -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] autofs-5.0.7 - pass -pthread flag to gcc 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 ` Andreas Oberritter 2013-03-14 15:21 ` [PATCH 3/3] autofs-5.0.7 - create a shared library Andreas Oberritter 1 sibling, 0 replies; 8+ messages in thread From: Andreas Oberritter @ 2013-03-14 15:20 UTC (permalink / raw) To: autofs Fixes linker error on Ubuntu 12.10 due to unresolved symbols. Signed-off-by: Andreas Oberritter <obi@saftware.de> --- Makefile.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index f2ba386..58b4bb2 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -44,8 +44,8 @@ CXXFLAGS = $(CFLAGS) LD = ld SOLDFLAGS = -shared -CFLAGS += -D_REENTRANT -D_FILE_OFFSET_BITS=64 -LDFLAGS += -lpthread +CFLAGS += -pthread -D_FILE_OFFSET_BITS=64 +LDFLAGS += -pthread ifdef TIRPCLIB CFLAGS += -I/usr/include/tirpc -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] autofs-5.0.7 - create a shared library 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 ` Andreas Oberritter 2013-03-14 22:30 ` [PATCH v2] " Andreas Oberritter 1 sibling, 1 reply; 8+ messages in thread From: Andreas Oberritter @ 2013-03-14 15:21 UTC (permalink / raw) To: autofs This reduces the (stripped) binary size from 1.6M to 572K on my system. Signed-off-by: Andreas Oberritter <obi@saftware.de> --- Makefile.conf.in | 3 +++ Makefile.rules | 2 +- daemon/Makefile | 2 +- lib/Makefile | 22 +++++++++++++++------- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Makefile.conf.in b/Makefile.conf.in index 3766d45..daad614 100644 --- a/Makefile.conf.in +++ b/Makefile.conf.in @@ -76,6 +76,9 @@ DMALLOCLIB = @DMALLOCLIB@ prefix = @prefix@ exec_prefix = @exec_prefix@ +# Where to install libraries +libdir=@libdir@ + # SSS library module directory ssslibdir=@sssldir@ diff --git a/Makefile.rules b/Makefile.rules index 58b4bb2..88e0278 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -13,7 +13,7 @@ INCFILES = COPYING COPYRIGHT NEWS README* TODO Makefile Makefile.rules \ INSTALLROOT = $(DESTDIR) # autofs utility library -AUTOFS_LIB = ../lib/autofs.a +AUTOFS_LIB = -L../lib -lautofs # Compilers, linkers and flags # The STRIP defined here *must not* remove any dynamic-loading symbols diff --git a/daemon/Makefile b/daemon/Makefile index 9e9d635..a5a4d8e 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -29,7 +29,7 @@ endif all: automount -automount: $(OBJS) $(AUTOFS_LIB) +automount: $(OBJS) $(CC) $(LDFLAGS) $(DAEMON_LDFLAGS) -o automount $(OBJS) $(AUTOFS_LIB) $(LIBS) $(STRIP) automount diff --git a/lib/Makefile b/lib/Makefile index 5418009..cf92784 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -18,20 +18,24 @@ OBJS = cache.o mount_clnt.o mount_xdr.o cat_path.o rpc_subs.o \ YACCSRC = nss_tok.c nss_parse.tab.c nss_parse.tab.h \ master_tok.c master_parse.tab.c master_parse.tab.h -LIB = autofs.a +LIB = libautofs.so +VERSION := $(shell cat ../.version) +MAJOR = $(firstword $(subst ., ,$(VERSION))) CFLAGS += -I../include -fPIC -D_GNU_SOURCE CFLAGS += -DAUTOFS_MAP_DIR=\"$(autofsmapdir)\" CFLAGS += -DAUTOFS_CONF_DIR=\"$(autofsconfdir)\" +LDFLAGS = -shared .PHONY: all install clean -all: autofs.a +all: $(LIB) -autofs.a: $(OBJS) - rm -f $(LIB) - $(AR) $(ARFLAGS) $(LIB) $(OBJS) - -$(RANLIB) $(LIB) +$(LIB).$(VERSION): $(OBJS) + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +$(LIB): $(LIB).$(VERSION) + ln -sf $< $@ mount.h: mount.x $(RPCGEN) -h -o mount.h mount.x @@ -71,7 +75,11 @@ nss_tok.o: nss_tok.c nss_parse.tab.h nss_parse.tab.o: nss_parse.tab.c nss_parse.tab.h install: all + install -d -m 755 $(INSTALLROOT)$(libdir) + install -c $(LIB).$(VERSION) -m 755 $(INSTALLROOT)$(libdir) + ln -sf $(LIB).$(VERSION) $(INSTALLROOT)$(libdir)/$(LIB).$(MAJOR) + ln -sf $(LIB).$(VERSION) $(INSTALLROOT)$(libdir)/$(LIB) clean: - rm -f $(LIB) $(RPCS) $(OBJS) $(YACCSRC) *.output *~ + rm -f $(LIB)* $(RPCS) $(OBJS) $(YACCSRC) *.output *~ -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2] autofs-5.0.7 - create a shared library 2013-03-14 15:21 ` [PATCH 3/3] autofs-5.0.7 - create a shared library Andreas Oberritter @ 2013-03-14 22:30 ` Andreas Oberritter 2013-03-15 10:28 ` Michael Tokarev 0 siblings, 1 reply; 8+ messages in thread From: Andreas Oberritter @ 2013-03-14 22:30 UTC (permalink / raw) To: autofs This reduces the (stripped) binary size from 1.6M to 572K on my system. Signed-off-by: Andreas Oberritter <obi@saftware.de> --- v2: Fix LDFLAGS: add soname and use += operator Makefile.conf.in | 3 +++ Makefile.rules | 2 +- daemon/Makefile | 2 +- lib/Makefile | 22 +++++++++++++++------- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Makefile.conf.in b/Makefile.conf.in index 3766d45..daad614 100644 --- a/Makefile.conf.in +++ b/Makefile.conf.in @@ -76,6 +76,9 @@ DMALLOCLIB = @DMALLOCLIB@ prefix = @prefix@ exec_prefix = @exec_prefix@ +# Where to install libraries +libdir=@libdir@ + # SSS library module directory ssslibdir=@sssldir@ diff --git a/Makefile.rules b/Makefile.rules index 58b4bb2..88e0278 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -13,7 +13,7 @@ INCFILES = COPYING COPYRIGHT NEWS README* TODO Makefile Makefile.rules \ INSTALLROOT = $(DESTDIR) # autofs utility library -AUTOFS_LIB = ../lib/autofs.a +AUTOFS_LIB = -L../lib -lautofs # Compilers, linkers and flags # The STRIP defined here *must not* remove any dynamic-loading symbols diff --git a/daemon/Makefile b/daemon/Makefile index 9e9d635..a5a4d8e 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -29,7 +29,7 @@ endif all: automount -automount: $(OBJS) $(AUTOFS_LIB) +automount: $(OBJS) $(CC) $(LDFLAGS) $(DAEMON_LDFLAGS) -o automount $(OBJS) $(AUTOFS_LIB) $(LIBS) $(STRIP) automount diff --git a/lib/Makefile b/lib/Makefile index 5418009..4129f94 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -18,20 +18,24 @@ OBJS = cache.o mount_clnt.o mount_xdr.o cat_path.o rpc_subs.o \ YACCSRC = nss_tok.c nss_parse.tab.c nss_parse.tab.h \ master_tok.c master_parse.tab.c master_parse.tab.h -LIB = autofs.a +LIB = libautofs.so +VERSION := $(shell cat ../.version) +MAJOR = $(firstword $(subst ., ,$(VERSION))) CFLAGS += -I../include -fPIC -D_GNU_SOURCE CFLAGS += -DAUTOFS_MAP_DIR=\"$(autofsmapdir)\" CFLAGS += -DAUTOFS_CONF_DIR=\"$(autofsconfdir)\" +LDFLAGS += -shared -Wl,-soname,$(LIB).$(MAJOR) .PHONY: all install clean -all: autofs.a +all: $(LIB) -autofs.a: $(OBJS) - rm -f $(LIB) - $(AR) $(ARFLAGS) $(LIB) $(OBJS) - -$(RANLIB) $(LIB) +$(LIB).$(VERSION): $(OBJS) + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +$(LIB): $(LIB).$(VERSION) + ln -sf $< $@ mount.h: mount.x $(RPCGEN) -h -o mount.h mount.x @@ -71,7 +75,11 @@ nss_tok.o: nss_tok.c nss_parse.tab.h nss_parse.tab.o: nss_parse.tab.c nss_parse.tab.h install: all + install -d -m 755 $(INSTALLROOT)$(libdir) + install -c $(LIB).$(VERSION) -m 755 $(INSTALLROOT)$(libdir) + ln -sf $(LIB).$(VERSION) $(INSTALLROOT)$(libdir)/$(LIB).$(MAJOR) + ln -sf $(LIB).$(VERSION) $(INSTALLROOT)$(libdir)/$(LIB) clean: - rm -f $(LIB) $(RPCS) $(OBJS) $(YACCSRC) *.output *~ + rm -f $(LIB)* $(RPCS) $(OBJS) $(YACCSRC) *.output *~ -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autofs-5.0.7 - create a shared library 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> 0 siblings, 2 replies; 8+ messages in thread From: Michael Tokarev @ 2013-03-15 10:28 UTC (permalink / raw) To: Andreas Oberritter; +Cc: autofs 15.03.2013 02:30, Andreas Oberritter wrote: > This reduces the (stripped) binary size from 1.6M to 572K > on my system. But it creates an additional file, the shared library, which also occupes space. What's the reason for that? Instead of just one executable we now have executable plus a library, which together is larger than single executable. Thanks, /mjt ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] autofs-5.0.7 - create a shared library 2013-03-15 10:28 ` Michael Tokarev @ 2013-03-15 13:45 ` Andreas Oberritter [not found] ` <51432119.2010200@saftware.de> 1 sibling, 0 replies; 8+ messages in thread From: Andreas Oberritter @ 2013-03-15 13:45 UTC (permalink / raw) To: Michael Tokarev; +Cc: autofs (resending, because I replied in private by accident) On 15.03.2013 11:28, Michael Tokarev wrote: > 15.03.2013 02:30, Andreas Oberritter wrote: >> This reduces the (stripped) binary size from 1.6M to 572K >> on my system. > > But it creates an additional file, the shared library, which > also occupes space. > > What's the reason for that? Instead of just one executable > we now have executable plus a library, which together is > larger than single executable. > > Thanks, > > /mjt > The numbers I mentioned are the total size of all created binaries (i.e. excluding configuration und documentation, but including all modules and the automount executable, and of course including the shared library). So why does this save space? Because the static library was linked into every module and into the automount executable. Regards, Andreas ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <51432119.2010200@saftware.de>]
[parent not found: <5143249F.1030808@msgid.tls.msk.ru>]
* Re: [PATCH v2] autofs-5.0.7 - create a shared library [not found] ` <5143249F.1030808@msgid.tls.msk.ru> @ 2013-03-15 14:28 ` Andreas Oberritter 2013-03-15 15:46 ` [PATCH] autofs-5.0.7 - link autofs.a into executable only Andreas Oberritter 0 siblings, 1 reply; 8+ messages in thread From: Andreas Oberritter @ 2013-03-15 14:28 UTC (permalink / raw) To: Michael Tokarev; +Cc: autofs On 15.03.2013 14:39, Michael Tokarev wrote: > 15.03.2013 17:24, Andreas Oberritter wrote: >> On 15.03.2013 11:28, Michael Tokarev wrote: >>> 15.03.2013 02:30, Andreas Oberritter wrote: >>>> This reduces the (stripped) binary size from 1.6M to 572K >>>> on my system. >>> >>> But it creates an additional file, the shared library, which >>> also occupes space. >>> >>> What's the reason for that? Instead of just one executable >>> we now have executable plus a library, which together is >>> larger than single executable. >> >> The numbers I mentioned are the total size of all created binaries (i.e. >> excluding configuration und documentation, but including all modules and >> the automount executable, and of course including the shared library). >> >> So why does this save space? Because the static library was linked into >> every module and into the automount executable. > > Aha. So that's the library linked into every module. That explains > things. > > But now I've another question. Maybe it is better to link whole that > lib into the main executable, instead of linking it to every module? I hope you don't mind me forwarding your response to the list. This may work (using -Wl,--whole-archive), but I think this would require some more testing. A first compile-test shows that this would save further 36K on my system, compared to the shared library. Regards, Andreas ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] autofs-5.0.7 - link autofs.a into executable only 2013-03-15 14:28 ` Andreas Oberritter @ 2013-03-15 15:46 ` Andreas Oberritter 0 siblings, 0 replies; 8+ messages in thread From: Andreas Oberritter @ 2013-03-15 15:46 UTC (permalink / raw) To: autofs 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-03-15 15:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] autofs-5.0.7 - link autofs.a into executable only Andreas Oberritter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox