libthr on current breaks some ports
Kostik Belousov
kostikbel at gmail.com
Fri Nov 27 17:53:23 UTC 2009
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 at 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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20091127/1f766634/attachment.pgp
More information about the freebsd-ports
mailing list