autofs-5.0.7 - include linux/nfs.h directly in rpc_subs.h
Subsystems (3)
PATCH 1/3 autofs-5.0.7 - include linux/nfs.h directly in rpc_subs.h
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.
--- include/rpc_subs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/rpc_subs.h +1 -1
@@ -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>
Signature · 1 line
1.7.10.4
PATCH 2/3 autofs-5.0.7 - pass -pthread flag to gcc
Fixes linker error on Ubuntu 12.10 due to unresolved symbols.
--- Makefile.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile.rules +2 -2
@@ -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
Signature · 1 line
1.7.10.4
PATCH 3/3 autofs-5.0.7 - create a shared library
In reply to Andreas OberritterThis reduces the (stripped) binary size from 1.6M to 572K on my system.
--- Makefile.conf.in | 3 +++ Makefile.rules | 2 +- daemon/Makefile | 2 +- lib/Makefile | 22 +++++++++++++++------- 4 files changed, 20 insertions(+), 9 deletions(-)
Makefile.conf.in +3 -0
@@ -76,6 +76,9 @@ DMALLOCLIB = @DMALLOCLIB@ prefix = @prefix@ exec_prefix = @exec_prefix@ +# Where to install libraries +libdir=@libdir@ + # SSS library module directory ssslibdir=@sssldir@
Makefile.rules +1 -1
@@ -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
daemon/Makefile +1 -1
@@ -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
lib/Makefile +15 -7
@@ -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 *~
Signature · 1 line
1.7.10.4
PATCH v2 1/1 autofs-5.0.7 - create a shared library
This reduces the (stripped) binary size from 1.6M to 572K on my system.
---
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(-)
Makefile.conf.in +3 -0
@@ -76,6 +76,9 @@ DMALLOCLIB = @DMALLOCLIB@ prefix = @prefix@ exec_prefix = @exec_prefix@ +# Where to install libraries +libdir=@libdir@ + # SSS library module directory ssslibdir=@sssldir@
Makefile.rules +1 -1
@@ -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
daemon/Makefile +1 -1
@@ -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
lib/Makefile +15 -7
@@ -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 *~
Signature · 1 line
1.7.10.4
Re: [PATCH v2] autofs-5.0.7 - create a shared library
Quoted 2 lines · Andreas Oberritter
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
Re: [PATCH v2] autofs-5.0.7 - create a shared library
(resending, because I replied in private by accident)
Quoted 7 lines · Michael Tokarev
Quoted 2 lines · Andreas Oberritter
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.
Quoted 8 lines
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
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2] autofs-5.0.7 - create a shared library
Quoted 17 lines · Michael Tokarev
Quoted 16 lines · Andreas Oberritter
Quoted 10 lines · Michael Tokarev
Quoted 2 lines · Andreas Oberritter
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).
Quoted 8 lines
Quoted 2 lines
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
PATCH 1/1 autofs-5.0.7 - link autofs.a into executable only
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.
---
Runtime test was successful.
Makefile.rules | 2 +- daemon/Makefile | 2 +- modules/Makefile | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
Makefile.rules +1 -1
@@ -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
daemon/Makefile +1 -1
@@ -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:
modules/Makefile +3 -3
@@ -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
Signature · 1 line
1.7.10.4