Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 2009 19:53:17 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Manfred Antar <null@pozo.com>
Cc:        ports@freebsd.org, Dag-Erling Sm??rgrav <des@des.no>, current@freebsd.org
Subject:   Re: libthr on current breaks some ports
Message-ID:  <20091127175316.GE2368@deviant.kiev.zoral.com.ua>
In-Reply-To: <200911271636.nARGaf92050278@pozo.com>
References:  <200911270246.nAR2k9Zp026751@pozo.com> <86ocmos11v.fsf@ds4.des.no> <200911271636.nARGaf92050278@pozo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--cPi+lWm09sJ+d57q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Nov 27, 2009 at 08:36:36AM -0800, Manfred Antar wrote:
> At 02:40 AM 11/27/2009, Dag-Erling Sm??rgrav wrote:
> >Manfred Antar <null@pozo.com> writes:
> >> The new addition to Makefile on /lib/libthr  "-Wl,-znodlopen "
> >> Breaks php4 and mhash on my current 1386
> >
> >If they try to dlopen() libthr, they're already broken.
> >
> >> I'm sure other ports that use it are broken too as can't load the lib.
> >
> >I doubt it.
> >
> >DES
> >--=20
> >Dag-Erling Sm??rgrav - des@des.no
> >
> >--=20
> >This message has been scanned for viruses and
> >dangerous content by MailScanner, and is
> >believed to be clean.
>=20
> OK
> Here are some of the errors I get
> Just rebuild /usr/ports/graphics/gd
>=20
> ldd /usr/local/lib/libgd.so.4
> /usr/local/lib/libgd.so.4: /libexec/ld-elf.so.1: /usr/local/lib/libgd.so.=
4: Unexpected inconsistency: dependency libthr.so.3 not found
> /usr/local/lib/libgd.so.4: exit status 1
>=20
> Just rebuild /usr/ports/security/mhash
> ldd /usr/local/lib/libmhash.so
> /usr/local/lib/libmhash.so: /libexec/ld-elf.so.1: /usr/local/lib/libmhash=
.so: Unexpected inconsistency: dependency libthr.so.3 not found
> /usr/local/lib/libmhash.so: exit status 1
>=20
> Both of these have "--with-LDFLAGS=3D"${PTHREAD_LIBS}" in the Makefile.
>=20

This is a real regression, but limited to ldd/LD_TRACE_LOADED_OBJECTS
functionality. The following quick fix worked for me.

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 320aa85..508a786 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1571,7 +1571,8 @@ do_load_object(int fd, const char *name, char *path, =
struct stat *sbp,
     object_add_name(obj, name);
     obj->path =3D path;
     digest_dynamic(obj, 0);
-    if (obj->z_noopen && (flags & RTLD_LO_DLOPEN)) {
+    if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) =3D=3D
+      RTLD_LO_DLOPEN) {
 	dbg("refusing to load non-loadable \"%s\"", obj->path);
 	_rtld_error("Cannot dlopen non-loadable %s\n", obj->path);
 	munmap(obj->mapbase, obj->mapsize);
@@ -2006,6 +2007,8 @@ dlopen(const char *name, int mode)
     lo_flags =3D RTLD_LO_DLOPEN;
     if (mode & RTLD_NOLOAD)
 	    lo_flags |=3D RTLD_LO_NOLOAD;
+    if (ld_tracing !=3D NULL)
+	    lo_flags |=3D RTLD_LO_TRACE;
=20
     objlist_init(&initlist);
=20
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index 6f51d7d..875e84b 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -242,8 +242,9 @@ typedef struct Struct_Obj_Entry {
 				   dlsym. */
=20
 /* Flags for load_object(). */
-#define	RTLD_LO_NOLOAD	0x01	/* dlopen() specified RTLD_NOLOAD */
-#define	RTLD_LO_DLOPEN	0x02	/* load_object() called from dlopen(). */
+#define	RTLD_LO_NOLOAD	0x01	/* dlopen() specified RTLD_NOLOAD. */
+#define	RTLD_LO_DLOPEN	0x02	/* Load_object() called from dlopen(). */
+#define	RTLD_LO_TRACE	0x04	/* Only tracing. */
=20
 /*
  * Symbol cache entry used during relocation to avoid multiple lookups

--cPi+lWm09sJ+d57q
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAksQEgwACgkQC3+MBN1Mb4jxUgCdF/VGitH/Ndot0QIDbCO7GB7X
H8AAn1DP+BCIadpUGdEXJv/AwoVPyzEz
=TQ4V
-----END PGP SIGNATURE-----

--cPi+lWm09sJ+d57q--



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