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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
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
> >--
> >Dag-Erling Sm??rgrav - des@des.no
> >
> >--
> >This message has been scanned for viruses and
> >dangerous content by MailScanner, and is
> >believed to be clean.
>
> OK
> Here are some of the errors I get
> Just rebuild /usr/ports/graphics/gd
>
> 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
>
> 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
>
> Both of these have "--with-LDFLAGS="${PTHREAD_LIBS}" in the Makefile.
>
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 = path;
digest_dynamic(obj, 0);
- if (obj->z_noopen && (flags & RTLD_LO_DLOPEN)) {
+ if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) ==
+ 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 = RTLD_LO_DLOPEN;
if (mode & RTLD_NOLOAD)
lo_flags |= RTLD_LO_NOLOAD;
+ if (ld_tracing != NULL)
+ lo_flags |= RTLD_LO_TRACE;
objlist_init(&initlist);
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. */
/* 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. */
/*
* Symbol cache entry used during relocation to avoid multiple lookups
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)
iEYEARECAAYFAksQEgwACgkQC3+MBN1Mb4jxUgCdF/VGitH/Ndot0QIDbCO7GB7X
H8AAn1DP+BCIadpUGdEXJv/AwoVPyzEz
=TQ4V
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091127175316.GE2368>
