[RFC] Prevent tailcall optimizations of libdl functions

Florian Weimer fweimer@redhat.com
Wed Jan 25 14:32:00 GMT 2017


On 01/25/2017 03:08 PM, 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.

Is there a specific requirement in POSIX to that effect, or is it an 
accident as the result of how POSIX and ISO C interact?

As far as I can tell, ISO C specifies function pointer equality by 
saying that pointers compare equal iff they refer to the “same […] 
function”, but the standard does not seem to define what makes two 
functions the same.

(But even if it is fully conforming or acceptable for other reasons, I 
dislike the __dso_handle technique because it is too complex.)

Thanks,
Florian



More information about the Libc-alpha mailing list