Date: Sat, 07 Sep 2013 13:48:13 +0200 From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> To: freebsd-arch@freebsd.org Subject: COMPAT_32BIT oddness in rtld-elf (was: Re: /usr/lib/private) Message-ID: <8638pgkg3m.fsf@nine.des.no> 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 %2B0200") References: <86zjrut4an.fsf@nine.des.no>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8638pgkg3m.fsf>
