Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jun 2006 21:09:12 GMT
From:      Michael Bushkov <bushman@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 99830 for review
Message-ID:  <200606222109.k5ML9CvM012804@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99830

Change 99830 by bushman@bushman_nss_ldap_cached on 2006/06/22 21:08:12

	__weak_references on module registration functions were not properly replaced during statically linked application build. So there are no more __weak references used for these functions. libc.a always links them in from the nss-modules and libc.so uses stubs, defined in net/nss_stubs.c. The only drawback of this solution is that libc's Makefile now depends slightly more on bsd.lib.mk - because it now uses SOBJS variable, which can be considered an internal bsd.lib.mk variable.

Affected files ...

.. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/Makefile#6 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nss_backends.h#4 edit
.. //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nss_stubs.c#1 add

Differences ...

==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/Makefile#6 (text+ko) ====

@@ -121,17 +121,26 @@
 .endif
 NSS_STATIC+= ${.OBJDIR}/../libnssutil/libnssutil.a
 
+# NSS-modules should be linked into the libc.a
 nss_static_modules.o:
 	${LD} -o ${.TARGET} -r --whole-archive ${NSS_STATIC}
+
+# libc.so should have stubs instead of module-load
+# functions
+nss_stubs.So:
+	${CC} ${PICFLAG} -DPIC ${CFLAGS}\
+	-c ${.CURDIR}/net/nss_stubs.c -o ${.TARGET}
 	
+	
 .if ${MK_PROFILE} != "no"
 nss_static_modules.po:
 	${LD} -o ${.TARGET} -r --whole-archive ${NSS_STATIC}
 .endif
 	
-DPSRC=	nss_static_modules.c
+DPSRC=	nss_static_modules.c nss_stubs.c
 STATICOBJS+= nss_static_modules.o
-CLEANFILES+= nss_static_modules.o
+SOBJS+= nss_stubs.So
+CLEANFILES+= nss_static_modules.o nss_stubs.So
 
 .include <bsd.lib.mk>
 

==== //depot/projects/soc2006/nss_ldap_cached/src/lib/libc/net/nss_backends.h#4 (text+ko) ====

@@ -42,5 +42,5 @@
 NSS_BACKEND(	nis,	_nis_nss_module_register	)
 #endif
 NSS_BACKEND(	compat,	_compat_nss_module_register	)
-NSS_BACKEND(	icmp,	_icmp_nss_module_register	)
+/* NSS_BACKEND(	icmp,	_icmp_nss_module_register	) */
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606222109.k5ML9CvM012804>