[Xcb] pthread stubs in libX11 vs. libxcb
Alan Coopersmith
alan.coopersmith at oracle.com
Thu Sep 29 15:53:50 UTC 2022
On 9/29/22 08:44, Uli Schlachter wrote:
> Hi,
>
> Am 29.09.22 um 02:29 schrieb Alan Coopersmith:
> [...]
>> Which in hindsight, sounds a lot like that bug 162 linked above - the libX11
>> xlib_ctor would call XInitThreads() at library load time, which would use the
>> stubs to fake initializing the mutexes, and then libxcb would be loaded later
>> (likely when XOpenDisplay() is called) pulling in the real pthreads library,
>
> Why is libxcb only loaded later? I would expect that by the time XInitThreads()
> can be called, the dynamic linker has at least loaded all dependent libraries.
> So, if libxcb links against libpthread, then libpthread should already be loaded
> at this time.
>
> Is this thinking wrong?
I'm not familiar with the runtime linkers on all platforms, but I know at least
on Solaris, lazy loading won't load the library until the first reference to it
is made (or a search needs to be made for a reference that doesn't have direct
binding information to record what library to load for it).
I also don't know if the ordering between library loading and init section
execution is well defined.
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Engineering - https://blogs.oracle.com/solaris
More information about the xorg-devel
mailing list