[patch] Fix linking ldconfig when --enable-static-nss (with ChangeLog)
Paul Pluzhnikov
ppluzhnikov@google.com
Thu Mar 22 21:06:00 GMT 2012
On Thu, Mar 22, 2012 at 12:46 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> AFAICT, $(static-only-routines) is used to filter stuff out of libc.so,
>> but *not* to add anything to libc.a.
>
> Ok. So you add them to both routines and static-only-routines.
Thanks for the clue. Yes, that works.
Tested for both with and without --enable-static-nss builds. Updated
patch attached.
Thanks,
--
Paul Pluzhnikov
2012-03-22 Daniel Jacobowitz <dmj@google.com>
Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #6528]
* grp/Makefile, inet/Makefile, login/Makefile, nscd/Makefile,
posix/Makefile, pwd/Makefile, rt/Makefile, sunrpc/Makefile: Do not
set otherlibs for static NSS.
* nss/Makefile: Likewise. Include libnss_files in libc.a for
--enable-static-nss. Remove special case for getent.
* resolv/Makefile: Include libnss_dns in libc.a for
--enable-static-nss.
-------------- next part --------------
2012-03-22 Daniel Jacobowitz <dmj@google.com>
Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #6528]
* grp/Makefile, inet/Makefile, login/Makefile, nscd/Makefile,
posix/Makefile, pwd/Makefile, rt/Makefile, sunrpc/Makefile: Do not
set otherlibs for static NSS.
* nss/Makefile: Likewise. Include libnss_files in libc.a for
--enable-static-nss. Remove special case for getent.
* resolv/Makefile: Include libnss_dns in libc.a for
--enable-static-nss.
diff -Npur glibc-git0/grp/Makefile glibc-git2/grp/Makefile
--- glibc-git0/grp/Makefile 2012-03-22 10:31:39.000000000 -0700
+++ glibc-git2/grp/Makefile 2012-03-22 10:28:36.000000000 -0700
@@ -37,12 +37,6 @@ endif
include ../Rules
-ifeq (yes,$(build-static-nss))
-otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a
-endif
-
-
ifeq ($(have-thread-library),yes)
CFLAGS-getgrgid_r.c = -DUSE_NSCD=1 -fexceptions
diff -Npur glibc-git0/inet/Makefile glibc-git2/inet/Makefile
--- glibc-git0/inet/Makefile 2012-03-22 10:31:39.000000000 -0700
+++ glibc-git2/inet/Makefile 2012-03-22 10:28:37.000000000 -0700
@@ -91,8 +91,3 @@ endif
ifeq ($(build-static-nss),yes)
CFLAGS += -DSTATIC_NSS
endif
-
-ifeq (yes,$(build-static-nss))
-otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a
-endif
diff -Npur glibc-git0/login/Makefile glibc-git2/login/Makefile
--- glibc-git0/login/Makefile 2012-03-22 10:31:39.000000000 -0700
+++ glibc-git2/login/Makefile 2012-03-22 10:28:37.000000000 -0700
@@ -48,11 +48,6 @@ include ../Rules
CFLAGS-getpt.c = -fexceptions
-ifeq (yes,$(build-static-nss))
-otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a $(common-objpfx)libc.a
-endif
-
ifeq (yesyes,$(have-fpie)$(build-shared))
pt_chown-cflags += $(pie-ccflag)
endif
diff -Npur glibc-git0/nscd/Makefile glibc-git2/nscd/Makefile
--- glibc-git0/nscd/Makefile 2012-03-22 10:31:40.000000000 -0700
+++ glibc-git2/nscd/Makefile 2012-03-22 10:28:38.000000000 -0700
@@ -46,11 +46,6 @@ extra-objs = $(nscd-modules:=.o)
endif
-ifeq (yes,$(build-static-nss))
-otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a
-endif
-
all-nscd-modules := $(nscd-modules) selinux
ifeq (yes,$(have-selinux))
ifeq (yes,$(have-libaudit))
diff -Npur glibc-git0/nss/Makefile glibc-git2/nss/Makefile
--- glibc-git0/nss/Makefile 2012-03-22 10:31:40.000000000 -0700
+++ glibc-git2/nss/Makefile 2012-03-22 13:53:32.000000000 -0700
@@ -43,11 +43,6 @@ xtests = bug-erange
include ../Makeconfig
-ifeq (yes,$(build-static-nss))
-otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a
-endif
-
# Specify rules for the nss_* modules. We have some services.
services := files db
@@ -74,19 +69,16 @@ generated += $(filter-out db-alias.c db
install-others += $(inst_vardbdir)/Makefile
-# Build static module if requested
-ifneq ($(build-static-nss),yes)
+# Build static module into libc if requested
libnss_files-inhibit-o = $(filter-out .os,$(object-suffixes))
libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
+ifeq ($(build-static-nss),yes)
+routines += $(libnss_files-routines)
+static-only-routines += $(libnss_files-routines)
endif
include ../Rules
-
-ifeq (yes,$(build-static-nss))
-$(objpfx)getent: $(objpfx)libnss_files.a
-endif
-
ifeq (yes,$(have-selinux))
LDLIBS-makedb := -lselinux
endif
diff -Npur glibc-git0/posix/Makefile glibc-git2/posix/Makefile
--- glibc-git0/posix/Makefile 2012-03-22 10:31:40.000000000 -0700
+++ glibc-git2/posix/Makefile 2012-03-22 10:28:38.000000000 -0700
@@ -112,14 +112,6 @@ generated := $(addprefix wordexp-test-re
include ../Rules
-ifeq (yes,$(build-static-nss))
-# We need it for "make check" only. We can skip them if they haven't
-# been built yet during "make".
-otherlibs += $(wildcard $(nssobjdir)/libnss_files.a \
- $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a)
-endif
-
ifeq (no,$(cross-compiling))
# globtest and wordexp-test currently only works with shared libraries
ifeq (yes,$(build-shared))
diff -Npur glibc-git0/pwd/Makefile glibc-git2/pwd/Makefile
--- glibc-git0/pwd/Makefile 2012-03-22 10:31:40.000000000 -0700
+++ glibc-git2/pwd/Makefile 2012-03-22 10:28:38.000000000 -0700
@@ -39,8 +39,3 @@ CFLAGS-getpw.c = -fexceptions
CFLAGS-fgetpwent_r.c = -D_IO_MTSAFE_IO
endif
-
-ifeq (yes,$(build-static-nss))
-otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a
-endif
diff -Npur glibc-git0/resolv/Makefile glibc-git2/resolv/Makefile
--- glibc-git0/resolv/Makefile 2012-03-22 10:31:40.000000000 -0700
+++ glibc-git2/resolv/Makefile 2012-03-22 13:58:13.000000000 -0700
@@ -55,8 +55,10 @@ subdir-dirs = nss_dns
vpath %.c nss_dns
libnss_dns-routines := dns-host dns-network dns-canon
-ifneq ($(build-static-nss),yes)
libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
+ifeq ($(build-static-nss),yes)
+routines += $(libnss_dns-routines) $(libresolv-routines)
+static-only-routines += $(libnss_dns-routines) $(libresolv-routines)
endif
ifeq (yesyes,$(build-shared)$(have-thread-library))
diff -Npur glibc-git0/rt/Makefile glibc-git2/rt/Makefile
--- glibc-git0/rt/Makefile 2012-03-22 10:31:40.000000000 -0700
+++ glibc-git2/rt/Makefile 2012-03-22 10:28:38.000000000 -0700
@@ -78,8 +78,3 @@ $(tests:%=$(objpfx)%-bp): $(objpfx)librt
endif
tst-mqueue7-ARGS = -- $(built-program-cmd)
-
-ifeq (yes,$(build-static-nss))
-otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a
-endif
diff -Npur glibc-git0/sunrpc/Makefile glibc-git2/sunrpc/Makefile
--- glibc-git0/sunrpc/Makefile 2012-03-22 10:31:40.000000000 -0700
+++ glibc-git2/sunrpc/Makefile 2012-03-22 10:28:38.000000000 -0700
@@ -97,11 +97,6 @@ ifeq ($(have-thread-library),yes)
xtests += thrsvc
endif
-ifeq (yes,$(build-static-nss))
-otherlibs += $(nssobjdir)/libnss_files.a $(resolvobjdir)/libnss_dns.a \
- $(resolvobjdir)/libresolv.a
-endif
-
ifeq (no,$(cross-compiling))
# We can only build this library if we can run the rpcgen we build.
headers += $(rpcsvc:%.x=rpcsvc/%.h)
More information about the Libc-alpha
mailing list