Bug 640 - Moving of libXThrStub into libX11
Summary: Moving of libXThrStub into libX11
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: git
Hardware: x86 (IA32) FreeBSD
: high normal
Assignee: Xorg Project Team
QA Contact:
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2004-05-18 18:57 UTC by Eric Anholt
Modified: 2006-11-29 16:27 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
move of UIThrStubs.c to X11 and fixing of some thread defines (23.81 KB, patch)
2004-05-19 04:17 UTC, Eric Anholt
no flags Details | Splinter Review

Description Eric Anholt 2004-05-18 18:57:13 UTC
Background: On OpenBSD, and on old FreeBSD, libc lacks pthread stubs.  This is a
problem because libX11 needs to support threading, but shouldn't cause all X
programs to be linked against the threading library.  The solution is
libXThrStub (UIThrStubs.c), which provides weak symbols to stub threading
functions, which are ignored if the application links against the thread library.

However, it seems silly to me to have this as a separate library.  There are two
consumers of it: libX11 and libGL.  Anyone linking against libGL is linking
against libX11 anyway.  Moving the UIThrStubs.c code into libX11 removes some
os-specific mess in config/cf/ and removes a library from the system that's not
used by anyone but libX11.

Attached is a patch for review that does the UIThrStubs.c move (which I would do
with a repocopy, if approved) and cleans up/fixes some threading imake defines
on BSDs.  Any feedback on this?
Comment 1 Eric Anholt 2004-05-19 04:17:18 UTC
Created attachment 299 [details] [review]
move of UIThrStubs.c to X11 and fixing of some thread defines
Comment 2 Matthieu Herrb 2004-05-29 07:00:41 UTC
BTW, this is what is already done in OpenBSD's XF4's tree, for the same reason 
that Eric mentions. 
I don't remember why I never tried to commit it back to XFree86 though. 
Comment 3 Eric Anholt 2004-05-29 09:35:23 UTC
Committed a fixed-up variation of this patch.
Comment 4 Eric Anholt 2004-12-25 16:18:59 UTC
This change broke threading on FreeBSD 4.x, and we've noticed it widely with
glib threads apps as of the 6.8.1 update.  The issue is (afaik) that our libc_r
pthread symbols are weak (why?  I don't know.), so having the weak stubs in
libX11 causes the weak stubs to be selected instead of the real ones in libc_r,
while having them in a separate library pulled in by libX11 works.  I think the
change needs to be backed out.
Comment 5 Erik Andren 2006-05-21 18:43:28 UTC
Are the changes currently backed out or is this not an issue anymore?
Comment 6 Erik Andren 2006-06-28 12:17:21 UTC
Ping!
Comment 7 Eric Anholt 2006-11-29 15:50:48 UTC
With the libpthread-stubs in libxcb, I'm happy that this bug is done with now.
Comment 8 Jamey Sharp 2006-11-29 16:27:17 UTC
Is this bug really fixed? I didn't remove the thread stubs from libX11, even
though when linked with libxcb it'll pull libpthread-stubs in too. Somebody who
can test on a system that needs thread stubs probably should do that. In
particular, I haven't checked that libpthread-stubs has a superset of the stubs
provided by libX11 or libGL. If libpthread-stubs is missing any, a patch would
be appreciated.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.