From owner-freebsd-openoffice@FreeBSD.ORG Mon Sep 18 09:59:12 2006 Return-Path: X-Original-To: freebsd-openoffice@freebsd.org Delivered-To: freebsd-openoffice@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EE8E516A4A0; Mon, 18 Sep 2006 09:59:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from fw.zoral.com.ua (fw.zoral.com.ua [213.186.206.134]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6904343D5C; Mon, 18 Sep 2006 09:58:59 +0000 (GMT) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by fw.zoral.com.ua (8.13.4/8.13.4) with ESMTP id k8I9wU02039135 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 18 Sep 2006 12:58:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.13.8/8.13.8) with ESMTP id k8I9wqr9096508; Mon, 18 Sep 2006 12:58:52 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.13.8/8.13.8/Submit) id k8I9wptu096507; Mon, 18 Sep 2006 12:58:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 18 Sep 2006 12:58:51 +0300 From: Kostik Belousov To: Jung-uk Kim Message-ID: <20060918095851.GA90925@deviant.kiev.zoral.com.ua> References: <200609142219.19636.nb_root@videotron.ca> <200609151417.14241.jkim@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u3/rZRmxL6MmkK24" Content-Disposition: inline In-Reply-To: <200609151417.14241.jkim@FreeBSD.org> User-Agent: Mutt/1.4.2.2i X-Virus-Scanned: ClamAV version 0.88.4, clamav-milter version 0.88.4 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=1.9 required=5.0 tests=DNS_FROM_RFC_ABUSE, SPF_NEUTRAL,UNPARSEABLE_RELAY autolearn=no version=3.1.4 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on fw.zoral.com.ua Cc: kan@freebsd.org, freebsd-openoffice@freebsd.org, h.blanke@chello.nl Subject: [patch] Re: OpenOffice.org-2.0.4rc1 compile problems on -CURRENT X-BeenThere: freebsd-openoffice@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting OpenOffice to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Sep 2006 09:59:13 -0000 --u3/rZRmxL6MmkK24 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 Ok, below is the patch that shall fix the issue. It was tested by Jung-uk Kim' regression test. Also, adopted patch (for STABLE) was tested with KDE (opening https:// sites) and OpenOffice 2.0.3. The latter was simply run and several documents of different types where opended. I have no resources to rebuild the beast myself. Konqueror issued a lot of warning for undefined symbols (like kdecore (KLibLoader): WARNING: KLibrary: Undefined symbol "OPENSSL_add_all_algorithms" ), but it does it with both patched and non-patched rtld on 6-STABLE. In both cases it worked normally, allowed to open the sites, and I see no excessive VM usage (I assume 30-40Mb is normal for it). Original patch (committed as rev. 1.117) scanned objects from the obj->dagmembers list for symbol retrieved by dlsym(). This appeared to be wrong by two reasons: 1. dagmembers are initialized only when dlopen actually load the dso. This caused the second test from Jung-uk Kim' regression set to fail, because it dlopen() depended dso and tries to lookup symbol from there. 2. In the case dso A depends on B and C, usage of dagmembers would cause B to expose symbols from C, that is wrong too. Attached patch uses obj->needed, that is filled for each dso, and is a real DAG instead of list. Patch (hopefully) implements SUSv3-required breadth-fi= rst lookup for dependent symbols. Please, give it a try. Patch for rtld.c rev. 1.117 (CURRENT) 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 18 Sep 2006 09:54:02 -0000 @@ -125,6 +125,9 @@ const Obj_Entry *, const Obj_Entry **, const Ver_Entry *, int); static const Elf_Sym *symlook_list(const char *, unsigned long, const Objl= ist *, const Obj_Entry **, const Ver_Entry *, int flags, DoneList *); +static const Elf_Sym *symlook_needed(const char *, unsigned long, + const Needed_Entry *, const Obj_Entry **, const Ver_Entry *, + int flags, DoneList *dlp); static void trace_loaded_objects(Obj_Entry *obj); static void unlink_object(Obj_Entry *); static void unload_object(Obj_Entry *); @@ -1852,17 +1855,21 @@ } =20 DoneList donelist; - const Objlist *srch_list; donelist_init(&donelist); if (obj->mainprog) { /* Search main program and all libraries loaded by it. */ - srch_list =3D &list_main; + def =3D symlook_list(name, hash, &list_main, &defobj, ve, flags, + &donelist); } else { + Needed_Entry fake; + /* Search the whole DAG rooted at the given object. */ - srch_list =3D &(obj->dagmembers); + fake.next =3D NULL; + fake.obj =3D (Obj_Entry *)obj; + fake.name =3D 0; + def =3D symlook_needed(name, hash, &fake, &defobj, ve, flags, + &donelist); } - def =3D symlook_list(name, hash, srch_list, &defobj, ve, flags, - &donelist); } =20 if (def !=3D NULL) { @@ -2362,6 +2369,57 @@ } =20 /* + * Search the symbol table of a shared object and all objects needed + * by it for a symbol of the given name. Search order is + * breadth-first. Returns a pointer to the symbol, or NULL if no + * definition was found. + */ +static const Elf_Sym * +symlook_needed(const char *name, unsigned long hash, const Needed_Entry *n= eeded, + const Obj_Entry **defobj_out, const Ver_Entry *ventry, int flags, + DoneList *dlp) +{ + const Elf_Sym *def, *def_w; + const Needed_Entry *n; + const Obj_Entry *obj, *defobj, *defobj1; + =20 + def =3D def_w =3D NULL; + defobj =3D NULL; + for (n =3D needed; n !=3D NULL; n =3D n->next) { + if ((obj =3D n->obj) =3D=3D NULL || + donelist_check(dlp, obj) || + (def =3D symlook_obj(name, hash, obj, ventry, flags)) =3D=3D N= ULL) + continue; + defobj =3D obj; + if (ELF_ST_BIND(def->st_info) !=3D STB_WEAK) { + *defobj_out =3D defobj; + return (def); + } + } + /* + * There we come when either symbol definition is not found in + * directly needed objects, or found symbol is weak. + */ + for (n =3D needed; n !=3D NULL; n =3D n->next) { + if ((obj =3D n->obj) =3D=3D NULL) + continue; + def_w =3D symlook_needed(name, hash, obj->needed, &defobj1, + ventry, flags, dlp); + if (def_w =3D=3D NULL) + continue; + if (def =3D=3D NULL) { + def =3D def_w; + defobj =3D defobj1; + } + if (ELF_ST_BIND(def_w->st_info) !=3D STB_WEAK) + break; + } + if (def !=3D NULL) + *defobj_out =3D defobj; + return def; +} + +/* * Search the symbol table of a single shared object for a symbol of * the given name and version, if requested. Returns a pointer to the * symbol, or NULL if no definition was found. For rtld.c rev. 1.106.2.3 from 6-STABLE: 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 18 Sep 2006 08:45:49 -0000 @@ -123,7 +123,9 @@ 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 const Elf_Sym *symlook_needed(const char *, unsigned long, + const Needed_Entry *, const Obj_Entry **, bool, DoneList *); static void trace_loaded_objects(Obj_Entry *obj); static void unlink_object(Obj_Entry *); static void unload_object(Obj_Entry *); @@ -1810,20 +1812,22 @@ return NULL; } =20 + DoneList donelist; + donelist_init(&donelist); if (obj->mainprog) { - DoneList donelist; =20 - /* 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. */ + def =3D symlook_list(name, hash, &list_main, &defobj, true, + &donelist); } 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; + Needed_Entry fake; + =09 + /* Search the DAG rooted at the given object */ + fake.next =3D NULL; + fake.name =3D 0; + fake.obj =3D (Obj_Entry *)obj; + def =3D symlook_needed(name, hash, &fake, &defobj, true, + &donelist); } } =20 @@ -2274,7 +2278,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; @@ -2302,6 +2306,58 @@ } =20 /* + * Search the symbol table of a shared object and all objects needed + * by it for a symbol of the given name. Search order is + * breadth-first. Returns a pointer to the symbol, or NULL if no + * definition was found. + */ +static const Elf_Sym * +symlook_needed(const char *name, unsigned long hash, const Needed_Entry *n= eeded, + const Obj_Entry **defobj_out, bool in_plt, DoneList *dlp) +{ + const Elf_Sym *def, *def_w; + const Needed_Entry *n; + const Obj_Entry *obj, *defobj, *defobj1; + =20 + def =3D def_w =3D NULL; + defobj =3D NULL; + for (n =3D needed; n !=3D NULL; n =3D n->next) { + if ((obj =3D n->obj) =3D=3D NULL || + donelist_check(dlp, obj) || + (def =3D symlook_obj(name, hash, obj, in_plt)) =3D=3D NULL) + continue; + defobj =3D obj; + if (ELF_ST_BIND(def->st_info) !=3D STB_WEAK) { + *defobj_out =3D defobj; + return (def); + } + } + /* + * There we come when either symbol definition is not found in + * directly needed objects, or found symbol is weak. + */ + for (n =3D needed; n !=3D NULL; n =3D n->next) { + if ((obj =3D n->obj) =3D=3D NULL) + continue; + def_w =3D symlook_needed(name, hash, obj->needed, &defobj1, + in_plt, dlp); + if (def_w =3D=3D NULL) + continue; + if (ELF_ST_BIND(def_w->st_info) !=3D STB_WEAK) { + *defobj_out =3D defobj1; + return (def_w); + } + if (def =3D=3D NULL) { + def =3D def_w; + defobj =3D defobj1; + } + } + if (def !=3D NULL) + *defobj_out =3D defobj; + return def; +} + +/* * Search the symbol table of a single shared object for a symbol of * the given name. Returns a pointer to the symbol, or NULL if no * definition was found. --u3/rZRmxL6MmkK24 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFDm3bC3+MBN1Mb4gRAvzKAJ98LWaKuCubzC2yjwusmmJN8qzxFQCfYUJm Om4bWhSm5E7265AaoOESAfU= =kbCM -----END PGP SIGNATURE----- --u3/rZRmxL6MmkK24--