Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Sep 2006 10:28:04 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Jung-uk Kim <jkim@freebsd.org>
Cc:        kan@freebsd.org, freebsd-openoffice@freebsd.org, h.blanke@chello.nl
Subject:   Re: OpenOffice.org-2.0.4rc1 compile problems on -CURRENT
Message-ID:  <20060916072804.GL93138@deviant.kiev.zoral.com.ua>
In-Reply-To: <200609151417.14241.jkim@FreeBSD.org>
References:  <200609142219.19636.nb_root@videotron.ca> <200609151417.14241.jkim@FreeBSD.org>

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

--gBdJBemW82xJqIAr
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Sep 15, 2006 at 02:17:12PM -0400, Jung-uk Kim wrote:
> On Thursday 14 September 2006 10:19 pm, Nicolas Blais wrote:
> --- >8 --- SNIP!!! --- >8 ---
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > Building project udkapi
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > /usr/ports/editors/openoffice.org-2.0/work/OOD680_m3/udkapi/com/sun
> >/star/uno mkout -- version: 1.7
> > idlc @/tmp/mkmJ4vAL
> > idlc: compile 'Exception.idl' ...
> > idlc: could not load registry dll.
> > idlc: detected 1 errors
> > Sun Microsystems (R) idlc Version 1.1
> >
> > dmake:  Error code 1, while
> > making '../../../../unxfbsdi.pro/misc/urd_cssuno.don'
> > '---* tg_merge.mk *---'
> >
> > ERROR: Error 65280 occurred while
> > making
> > /usr/ports/editors/openoffice.org-2.0/work/OOD680_m3/udkapi/com/sun
> >/star/uno dmake:  Error code 1, while making
> > 'build_instsetoo_native' '---* *---'
> > *** Error code 255
> >
> > Stop in /usr/ports/editors/openoffice.org-2.0.
> >
> > The port tree is up to date and so is -CURRENT. Any suggestions?
>=20
> src/libexec/rtld-elf/rtld.c 1.117 has serious regression:
>=20
> http://docs.freebsd.org/cgi/mid.cgi?200609081459.k88ExtSR084500
>=20
> You can revert to 1.116 and pass this but there is some other=20
> issues. :-(
>=20
> Jung-uk Kim

First,
sorry for breakage. I will be unable to test anything on CURRENT until mond=
ay.
The problem (at least the one uncovered by Jung-uk Kim test) is as follows:

if libdl1.so is dlopened(), and it depends on libdl2.so, then, after 1.117,
dlopen()ing libdl2.so and trying to find some symbols from libdl2.so fails.
I did not realized that dagmembers of Obj_Entry is built for root only (in
this case, libdl1.so).

SUSv3 specifies the following rules for symbol lookup:
The dlsym() function shall search for the named symbol in all objects loaded
automatically as a result of loading the object referenced by handle.
The symbol resolution algorithm used shall be dependency order as described
in dlopen().

Below is the corrected version of the patch for RELENG_6 (I ran the test
supplied by Jung-uk Kim, both tests passed).

Index: rtld.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/local/arch/ncvs/src/libexec/rtld-elf/rtld.c,v
retrieving revision 1.106.2.3
diff -u -r1.106.2.3 rtld.c
--- rtld.c	2 Sep 2006 20:38:13 -0000	1.106.2.3
+++ rtld.c	16 Sep 2006 07:26:14 -0000
@@ -110,7 +110,7 @@
 static Objlist_Entry *objlist_find(Objlist *, const Obj_Entry *);
 static void objlist_init(Objlist *);
 static void objlist_push_head(Objlist *, Obj_Entry *);
-static void objlist_push_tail(Objlist *, Obj_Entry *);
+static Objlist_Entry *objlist_push_tail(Objlist *, Obj_Entry *);
 static void objlist_remove(Objlist *, Obj_Entry *);
 static void objlist_remove_unref(Objlist *);
 static void *path_enumerate(const char *, path_enum_proc, void *);
@@ -123,7 +123,7 @@
 static const Elf_Sym *symlook_default(const char *, unsigned long hash,
   const Obj_Entry *refobj, const Obj_Entry **defobj_out, bool in_plt);
 static const Elf_Sym *symlook_list(const char *, unsigned long,
-  Objlist *, const Obj_Entry **, bool in_plt, DoneList *);
+  const Objlist *, const Obj_Entry **, bool in_plt, DoneList *);
 static void trace_loaded_objects(Obj_Entry *obj);
 static void unlink_object(Obj_Entry *);
 static void unload_object(Obj_Entry *);
@@ -1020,13 +1020,16 @@
 init_dag1(Obj_Entry *root, Obj_Entry *obj, DoneList *dlp)
 {
     const Needed_Entry *needed;
+    Objlist_Entry *elm;
=20
     if (donelist_check(dlp, obj))
 	return;
=20
     obj->refcount++;
     objlist_push_tail(&obj->dldags, root);
-    objlist_push_tail(&root->dagmembers, obj);
+    elm =3D objlist_push_tail(&root->dagmembers, obj);
+    if (root !=3D obj)
+        STAILQ_INSERT_TAIL(&obj->dagmembers, elm, link);
     for (needed =3D obj->needed;  needed !=3D NULL;  needed =3D needed->ne=
xt)
 	if (needed->obj !=3D NULL)
 	    init_dag1(root, needed->obj, dlp);
@@ -1402,7 +1405,7 @@
     STAILQ_INSERT_HEAD(list, elm, link);
 }
=20
-static void
+static Objlist_Entry *
 objlist_push_tail(Objlist *list, Obj_Entry *obj)
 {
     Objlist_Entry *elm;
@@ -1410,6 +1413,7 @@
     elm =3D NEW(Objlist_Entry);
     elm->obj =3D obj;
     STAILQ_INSERT_TAIL(list, elm, link);
+    return elm;
 }
=20
 static void
@@ -1810,21 +1814,18 @@
 	    return NULL;
 	}
=20
+	DoneList donelist;
+	const Objlist *search_list;
+	donelist_init(&donelist);
 	if (obj->mainprog) {
-	    DoneList donelist;
-
-	    /* Search main program and all libraries loaded by it. */
-	    donelist_init(&donelist);
-	    def =3D symlook_list(name, hash, &list_main, &defobj, true,
-	      &donelist);
+		/* Search main program and all libraries loaded by it. */
+		search_list =3D &list_main;
 	} else {
-	    /*
-	     * XXX - This isn't correct.  The search should include the whole
-	     * DAG rooted at the given object.
-	     */
-	    def =3D symlook_obj(name, hash, obj, true);
-	    defobj =3D obj;
+		/* Search the DAG rooted at the given object */
+		search_list =3D &obj->dagmembers;
 	}
+	def =3D symlook_list(name, hash, search_list, &defobj, true,
+			   &donelist);
     }
=20
     if (def !=3D NULL) {
@@ -2274,7 +2275,7 @@
 }
=20
 static const Elf_Sym *
-symlook_list(const char *name, unsigned long hash, Objlist *objlist,
+symlook_list(const char *name, unsigned long hash, const Objlist *objlist,
   const Obj_Entry **defobj_out, bool in_plt, DoneList *dlp)
 {
     const Elf_Sym *symp;

UNTESTED version of patch against 1.117:

Index: rtld.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /usr/local/arch/ncvs/src/libexec/rtld-elf/rtld.c,v
retrieving revision 1.117
diff -u -r1.117 rtld.c
--- rtld.c	8 Sep 2006 14:59:54 -0000	1.117
+++ rtld.c	16 Sep 2006 07:27:08 -0000
@@ -111,7 +111,7 @@
 static Objlist_Entry *objlist_find(Objlist *, const Obj_Entry *);
 static void objlist_init(Objlist *);
 static void objlist_push_head(Objlist *, Obj_Entry *);
-static void objlist_push_tail(Objlist *, Obj_Entry *);
+static Objlist_Entry *objlist_push_tail(Objlist *, Obj_Entry *);
 static void objlist_remove(Objlist *, Obj_Entry *);
 static void objlist_remove_unref(Objlist *);
 static void *path_enumerate(const char *, path_enum_proc, void *);
@@ -1059,13 +1059,16 @@
 init_dag1(Obj_Entry *root, Obj_Entry *obj, DoneList *dlp)
 {
     const Needed_Entry *needed;
+    Objlist_Entry *elm;
=20
     if (donelist_check(dlp, obj))
 	return;
=20
     obj->refcount++;
     objlist_push_tail(&obj->dldags, root);
-    objlist_push_tail(&root->dagmembers, obj);
+    elm =3D objlist_push_tail(&root->dagmembers, obj);
+    if (root !=3D obj)
+	STAILQ_INSERT_TAIL(&obj->dagmembers, elm, link);
     for (needed =3D obj->needed;  needed !=3D NULL;  needed =3D needed->ne=
xt)
 	if (needed->obj !=3D NULL)
 	    init_dag1(root, needed->obj, dlp);
@@ -1445,7 +1448,7 @@
     STAILQ_INSERT_HEAD(list, elm, link);
 }
=20
-static void
+static Objlist_Entry *
 objlist_push_tail(Objlist *list, Obj_Entry *obj)
 {
     Objlist_Entry *elm;
@@ -1453,6 +1456,7 @@
     elm =3D NEW(Objlist_Entry);
     elm->obj =3D obj;
     STAILQ_INSERT_TAIL(list, elm, link);
+    return elm;
 }
=20
 static void

--gBdJBemW82xJqIAr
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQFFC6eDC3+MBN1Mb4gRAvCBAKDcdrNvKdHgd+2ojB9UcRDyCjHuAQCdHtfM
rTtOik6t6PiDDzKZ51fMJsQ=
=fl06
-----END PGP SIGNATURE-----

--gBdJBemW82xJqIAr--



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