From owner-freebsd-arch@FreeBSD.ORG Sat Sep 7 11:48:41 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AC10ACBC for ; Sat, 7 Sep 2013 11:48:41 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 6EDB42BF5 for ; Sat, 7 Sep 2013 11:48:41 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 868D546E9 for ; Sat, 7 Sep 2013 11:48:40 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 71E952910D; Sat, 7 Sep 2013 13:48:13 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: freebsd-arch@freebsd.org Subject: COMPAT_32BIT oddness in rtld-elf (was: Re: /usr/lib/private) References: <86zjrut4an.fsf@nine.des.no> Date: Sat, 07 Sep 2013 13:48:13 +0200 In-Reply-To: <86zjrut4an.fsf@nine.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8r?= =?utf-8?Q?grav=22's?= message of "Tue, 03 Sep 2013 15:37:04 +0200") Message-ID: <8638pgkg3m.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 11:48:41 -0000 I'm having trouble understanding this code in libexec/rtld-elf/rtld.c: static void * path_enumerate(const char *path, path_enum_proc callback, void *arg) { #ifdef COMPAT_32BIT const char *trans; #endif if (path =3D=3D NULL) return (NULL); path +=3D strspn(path, ":;"); while (*path !=3D '\0') { size_t len; char *res; len =3D strcspn(path, ":;"); #ifdef COMPAT_32BIT trans =3D lm_findn(NULL, path, len); if (trans) res =3D callback(trans, strlen(trans), arg); else #endif res =3D callback(path, len, arg); if (res !=3D NULL) return (res); path +=3D len; path +=3D strspn(path, ":;"); } return (NULL); } This function is used to traverse paths, such as rtld's built-in search path, LD_LIBRARY_PATH, an Elf object's rpath, etc. As far as I can tell, the result of this is that *in the COMPAT_32BIT case only* it is possible to list one directory as replacing another in libmap.conf. In other words, we could have this in libmap32.conf: /lib /lib32 /usr/lib /usr/lib32 /usr/lib/private /usr/lib32/private instead of hardcoding a different standard search path in rtld.h. What I don't understand is why this functionality is only available in the COMPAT_32BIT case. It seems universally useful to me. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no