Subject: Re: Why no DT_NEEDED tags in libs?
To: None <tech-userlevel@netbsd.org>
From: Jukka Salmi <j+nbsd@2006.salmi.ch>
List: tech-userlevel
Date: 03/17/2006 21:46:07
--oC1+HKm2/end4ao3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Luke Mewburn --> tech-userlevel (2006-03-17 12:00:02 +1100):
> On Thu, Mar 16, 2006 at 11:44:19AM -0800, Jason Thorpe wrote:
>   | I personally think we SHOULD be adding the DT_NEEDED tags in our  
>   | libs.  I consider this to be a bug in NetBSD.
> 
> 
> The base libraries in NetBSD have had the appropriate DT_NEEDED
> tags since July 2004 via the LIBDPLIBS support I implemented.
> That change is present in NetBSD 3.0.
> 
> 	argo> uname -sr
> 	NetBSD 3.0
> 
> 	argo> readelf -d /usr/lib/libkrb5.so | grep NEEDED
> 	 0x00000001 (NEEDED)     Shared library: [libcrypto.so.2]
> 	 0x00000001 (NEEDED)     Shared library: [libasn1.so.6]
> 	 0x00000001 (NEEDED)     Shared library: [libcom_err.so.4]
> 	 0x00000001 (NEEDED)     Shared library: [libroken.so.12]

libkrb5 is fine, but some other Heimdal libs seem to be missing
DT_NEEDED tags (I checked netbsd-2, netbsd-3 and -current systems):

$ readelf -d /usr/lib/libgssapi.so | grep NEEDED
$ 

The attached patch should fix this (and arrange for correct library
build order).

Comments are welcome!


Cheers, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~

--oC1+HKm2/end4ao3
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="heimdal-libdplibs.patch"

Index: lib/Makefile
===================================================================
RCS file: /cvsroot/src/lib/Makefile,v
retrieving revision 1.99
diff -u -p -r1.99 Makefile
--- lib/Makefile	8 Feb 2006 18:58:55 -0000	1.99
+++ lib/Makefile	17 Mar 2006 15:19:55 -0000
@@ -35,8 +35,7 @@ SUBDIR+= libcrypto_rc5
 
 .if (${MKKERBEROS} != "no")
 # Heimdal Kerberos 5 libraries
-SUBDIR+= libroken libvers libcom_err libsl libss libasn1 libhdb \
-	 libkadm5srv libkadm5clnt libgssapi libkafs
+SUBDIR+= libroken libvers libcom_err libasn1
 
 .if (${MKKERBEROS4} != "no")
 # KTH Kerberos 4 libraries
@@ -84,6 +83,11 @@ SUBDIR+=	.WAIT
 
 SUBDIR+=	libcdk 		# depends on libedit
 
+.if (${MKKERBEROS} != "no")
+# Heimdal Kerberos 5 libraries depending on libkrb5 and more
+SUBDIR+=	libgssapi libhdb libkadm5srv libkadm5clnt libkafs libsl libss
+.endif
+
 .if (${MKPAM} != "no")
 SUBDIR+=	libpam		# depends on libkrb5 and more
 .endif
Index: lib/libasn1/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libasn1/Makefile,v
retrieving revision 1.25
diff -u -p -r1.25 Makefile
--- lib/libasn1/Makefile	10 Jan 2005 03:11:17 -0000	1.25
+++ lib/libasn1/Makefile	17 Mar 2006 15:19:56 -0000
@@ -10,6 +10,8 @@ DIST=		${NETBSDSRCDIR}/crypto/dist
 WARNS?=		1
 LIB=		asn1
 
+LIBDPLIBS=	com_err	${.CURDIR}/../libcom_err
+
 .if ${USETOOLS} != "yes"
 COMPILEETOBJ!=		cd ${NETBSDSRCDIR}/lib/libcom_err/compile_et && ${PRINTOBJDIR}
 TOOL_COMPILE_ET=	${COMPILEETOBJ}/compile_et
Index: lib/libgssapi/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libgssapi/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- lib/libgssapi/Makefile	10 Jan 2005 03:11:17 -0000	1.14
+++ lib/libgssapi/Makefile	17 Mar 2006 15:20:03 -0000
@@ -11,6 +11,11 @@ WARNS?=		1
 
 LIB=		gssapi
 
+LIBDPLIBS=	crypto	${.CURDIR}/../libcrypto \
+		krb5	${.CURDIR}/../libkrb5 \
+		asn1	${.CURDIR}/../libasn1 \
+		roken	${.CURDIR}/../libroken
+
 SRCS	 =			\
 	8003.c			\
 	accept_sec_context.c	\
Index: lib/libhdb/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libhdb/Makefile,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile
--- lib/libhdb/Makefile	10 Jan 2005 03:11:17 -0000	1.18
+++ lib/libhdb/Makefile	17 Mar 2006 15:20:03 -0000
@@ -11,6 +11,10 @@ WARNS?=		1
 
 LIB=		hdb
 
+LIBDPLIBS=	krb5	${.CURDIR}/../libkrb5 \
+		asn1	${.CURDIR}/../libasn1 \
+		roken	${.CURDIR}/../libroken
+
 .if ${USETOOLS} != "yes"
 COMPILEETOBJ!=		cd ${NETBSDSRCDIR}/lib/libcom_err/compile_et && ${PRINTOBJDIR}
 TOOL_COMPILE_ET=	${COMPILEETOBJ}/compile_et
Index: lib/libkadm5clnt/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libkadm5clnt/Makefile,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile
--- lib/libkadm5clnt/Makefile	10 Jan 2005 03:11:17 -0000	1.19
+++ lib/libkadm5clnt/Makefile	17 Mar 2006 15:20:03 -0000
@@ -11,6 +11,10 @@ WARNS?=		1
 
 LIB=		kadm5clnt
 
+LIBDPLIBS=	krb5	${.CURDIR}/../libkrb5 \
+		hdb	${.CURDIR}/../libhdb \
+		roken	${.CURDIR}/../libroken
+
 .if ${USETOOLS} != "yes"
 COMPILEETOBJ!=		cd ${NETBSDSRCDIR}/lib/libcom_err/compile_et && ${PRINTOBJDIR}
 TOOL_COMPILE_ET=	${COMPILEETOBJ}/compile_et
Index: lib/libkadm5srv/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libkadm5srv/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- lib/libkadm5srv/Makefile	10 Jan 2005 03:11:17 -0000	1.23
+++ lib/libkadm5srv/Makefile	17 Mar 2006 15:20:04 -0000
@@ -13,6 +13,10 @@ WARNS?=		1
 
 LIB=		kadm5srv
 
+LIBDPLIBS=	krb5	${.CURDIR}/../libkrb5 \
+		hdb	${.CURDIR}/../libhdb \
+		roken	${.CURDIR}/../libroken
+
 .if ${USETOOLS} != "yes"
 COMPILEETOBJ!=		cd ${NETBSDSRCDIR}/lib/libcom_err/compile_et && ${PRINTOBJDIR}
 TOOL_COMPILE_ET=	${COMPILEETOBJ}/compile_et
Index: lib/libkafs/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libkafs/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- lib/libkafs/Makefile	10 Jan 2005 03:11:17 -0000	1.8
+++ lib/libkafs/Makefile	17 Mar 2006 15:20:04 -0000
@@ -11,6 +11,9 @@ WARNS?=		1
 
 LIB=		kafs
 
+LIBDPLIBS=	krb5	${.CURDIR}/../libkrb5 \
+		roken	${.CURDIR}/../libroken
+
 SRCS=		afssys.c afskrb.c afskrb5.c common.c
 
 INCS=		kafs.h
Index: lib/libsl/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libsl/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- lib/libsl/Makefile	10 Jan 2005 03:11:17 -0000	1.6
+++ lib/libsl/Makefile	17 Mar 2006 15:20:05 -0000
@@ -8,6 +8,10 @@ DIST=		${NETBSDSRCDIR}/crypto/dist
 .PATH:		${DIST}/heimdal/lib/sl
 
 LIB=		sl
+
+LIBDPLIBS=	edit ${.CURDIR}/../libedit \
+		termcap ${.CURDIR}/../libterm
+
 SRCS=		sl.c
 INCS=		sl.h
 INCSDIR=	/usr/include/krb5
Index: lib/libss/Makefile
===================================================================
RCS file: /cvsroot/src/lib/libss/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- lib/libss/Makefile	10 Jan 2005 03:11:17 -0000	1.5
+++ lib/libss/Makefile	17 Mar 2006 15:20:05 -0000
@@ -10,6 +10,11 @@ DIST=		${NETBSDSRCDIR}/crypto/dist
 WARNS?=		1
 
 LIB=		ss
+
+LIBDPLIBS=	edit ${.CURDIR}/../libedit \
+		termcap ${.CURDIR}/../libterm \
+		com_err	${.CURDIR}/../libcom_err
+
 SRCS=		sl.c ss.c
 INCS=		ss.h
 INCSDIR=	/usr/include/krb5

--oC1+HKm2/end4ao3--