[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-arch
Subject:    Re: COMPAT_32BIT oddness in rtld-elf (was: Re: /usr/lib/private)
From:       John Baldwin <jhb () freebsd ! org>
Date:       2013-09-09 15:27:16
Message-ID: 201309091127.16643.jhb () freebsd ! org
[Download RAW message or body]

On Saturday, September 07, 2013 7:48:13 am Dag-Erling Smørgrav wrote:
> 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 == NULL)
> 	return (NULL);
> 
>     path += strspn(path, ":;");
>     while (*path != '\0') {
> 	size_t len;
> 	char  *res;
> 
> 	len = strcspn(path, ":;");
> #ifdef COMPAT_32BIT
> 	trans = lm_findn(NULL, path, len);
> 	if (trans)
> 	    res = callback(trans, strlen(trans), arg);
> 	else
> #endif
> 	res = callback(path, len, arg);
> 
> 	if (res != NULL)
> 	    return (res);
> 
> 	path += len;
> 	path += 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.

I think it would be fine to make it universally available.  You should talk to 
Doug Ambrisko.  He has patches to extend libmap support to key off OS-version, 
etc. and might already make the directory case universal.

-- 
John Baldwin
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic