This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC] Prevent tailcall optimizations of libdl functions
On Wed, Jan 25, 2017 at 02:34:32PM +0000, Joseph Myers wrote:
> On Wed, 25 Jan 2017, Rich Felker wrote:
>
> > FWIW this technique is non-conforming, at least for any standard
> > functions it's used on, since it breaks pointer equality. A conforming
> > program can evaluate p1==p2, where p1=dlsym is assigned in one dso and
> > p2=dlsym is assigned in another, and must see equality on a conforming
> > implementation. As such I think this hack needs to be removed from
> > other functions like stat.
>
> A conforming program does not use shared libraries other than those
> provided by the system and POSIX does not define any way to build shared
> libraries. If shared libraries are supported as an extension, ISO C and
> POSIX impose no requirements on how symbol resolution semantics when that
> feature is used might differ from symbol resolution semantics when only
> standard features are used.
While this might be technically defensible, it's nonsensical in
relation to actual practice, especially in the historical context
where the GNU tools have treated static-linking/static-libraries as
deprecated or at best second-class citizens. GNU libtool even makes it
impossible to static-link except for libraries being built in-tree as
part of the same package. As such, from the standpoint of a complete
GNU system using GNU tools, dynamic linking all libraries is the de
facto default, and for them not to have the semantics the C language
defines is a bug.
> (I put stat in the category of "do this differently if we move to
> libc.so.7", i.e. replace the very old versioning mechanism by normal
> symbol versioning if making such an (unlikely) global ABI transition.)
I don't see any reason it couldn't be done in libc.so.6, still having
the old xstat etc. symbols for compatibility but removing stat etc.
from libc_nonshared.a and adding them to libc.so.6.
Rich