Bug 2607 - -fvisibility=hidden patch for libX11
Summary: -fvisibility=hidden patch for libX11
Status: RESOLVED WONTFIX
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: git
Hardware: All All
: high enhancement
Assignee: Bernie Innocenti
QA Contact: Xorg Project Team
URL:
Whiteboard: 2011BRB_Reviewed
Keywords: patch
Depends on:
Blocks:
 
Reported: 2005-02-23 20:53 UTC by Bernie Innocenti
Modified: 2011-10-04 11:43 UTC (History)
8 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Part 1/4 (750 bytes, patch)
2005-02-23 20:54 UTC, Bernie Innocenti
no flags Details | Splinter Review
Part 2/4. (1.59 KB, patch)
2005-02-23 20:55 UTC, Bernie Innocenti
no flags Details | Splinter Review
Part 3/4. (151.31 KB, patch)
2005-02-23 20:55 UTC, Bernie Innocenti
no flags Details | Splinter Review
Part 4/4. (1.03 KB, patch)
2005-02-23 20:55 UTC, Bernie Innocenti
no flags Details | Splinter Review
Part 3/4. (151.63 KB, patch)
2005-02-23 22:40 UTC, Bernie Innocenti
no flags Details | Splinter Review
Part 2/4 (1.50 KB, patch)
2005-03-03 13:57 UTC, Bernie Innocenti
no flags Details | Splinter Review
Part 3/4. (151.46 KB, patch)
2005-03-20 18:16 UTC, Bernie Innocenti
no flags Details | Splinter Review
XORG_VISIBILITY macro (1.15 KB, patch)
2007-05-03 12:06 UTC, Tilman Sauerbeck
no flags Details | Splinter Review
Add _X_EXPORT's for libX11 (281.48 KB, patch)
2007-05-03 12:13 UTC, Tilman Sauerbeck
no flags Details | Splinter Review

Description Bernie Innocenti 2005-02-23 20:53:51 UTC
Tested with several toolkits and applications, but only on Linux.
Comment 1 Bernie Innocenti 2005-02-23 20:54:41 UTC
Created attachment 1969 [details] [review]
Part 1/4
Comment 2 Bernie Innocenti 2005-02-23 20:55:04 UTC
Created attachment 1970 [details] [review]
Part 2/4.
Comment 3 Bernie Innocenti 2005-02-23 20:55:26 UTC
Created attachment 1971 [details] [review]
Part 3/4.
Comment 4 Bernie Innocenti 2005-02-23 20:55:46 UTC
Created attachment 1972 [details] [review]
Part 4/4.
Comment 5 Bernie Innocenti 2005-02-23 22:25:16 UTC
Oops: 
 
/usr/lib/vmware/bin/vmware: symbol lookup error: /usr/lib/vmware/bin/vmware: 
undefined symbol: XauFileName 
 
Please wait for an updated patch. 
Comment 6 Bernie Innocenti 2005-02-23 22:40:59 UTC
Created attachment 1973 [details] [review]
Part 3/4.
Comment 7 Alexander Gottwald 2005-02-24 06:36:42 UTC
The patches define APIENTRY __stdcall for Cygwin and MinGW. This chabges the
library ABI. Is this really intended?
Comment 8 Alexander Gottwald 2005-02-24 07:49:21 UTC
-fvisibility is not available with cygwin gcc. Most likely because that switch
only effects ELF binaries. 

If X11APIENTRY is defined as __stdcall it is required in the .c file as well
otherwise defintion and declaration of the function do not match

Comment 9 Bernie Innocenti 2005-02-27 23:19:16 UTC
The logic has been copied over from Mesa.  Using __stdcall
is customary in Windows DLL entries, but we could leave it
alone for backwards compatibility.  What's the preferred
solution?

As for repeating __stdcall on function definition, I've just
realised this is needed.  Since I can't easily test on Cygwin,
if we're going to remove __stdcall anyway, I'd prefer to
postpne this other change to a later patch.
Comment 10 Alexander Gottwald 2005-02-28 06:16:22 UTC
cygwin can not use __stdcall since this would break DLL compatibility. Since
there is no real need and benefit from __stdcall anyway (apart from slightly
smaller executables) I'd keep native windows builds without __stdcall too.

- symbols were __cdecl since ages (even the msvc compiled DLLs must have been
without __stdcall)
- change breaks ABI
- no real benefit from change
- need for adjusting function declarations too

==> no __stdcall ever
Comment 11 Bernie Innocenti 2005-03-03 13:57:12 UTC
Created attachment 2014 [details] [review]
Part 2/4

Don't change the existing ABI by adding __cdecl for Cygwin/MingW.
Comment 12 Bernie Innocenti 2005-03-03 13:58:57 UTC
(In reply to comment #10)

Sorry for the longish delay... Could you please build
on Cygwin just to make sure everything still works?
Comment 13 Bernie Innocenti 2005-03-15 19:41:52 UTC
PING!  This patch is still unreviewed.  Did anyone test it?

Before submitting additional patches for other libraries
I'd prefer to see this one approved.  Of course I'll be
glad to rework it if needed.
Comment 14 Bernie Innocenti 2005-03-20 18:16:15 UTC
Created attachment 2167 [details] [review]
Part 3/4.

Restore an "extern" that was removed by mistake from the _Xdebug declaration.
Comment 15 Alexander Gottwald 2005-04-06 08:25:05 UTC
On cygwin and mingw it does build ok. I only hope I've removed the old patches
completely before applying the new ones. 
Comment 16 Erik Andren 2006-04-18 05:04:36 UTC
ping and add patch keyword
Comment 17 Daniel Stone 2006-06-03 02:54:35 UTC
we can use _X_HIDDEN and _X_EXPORT nowadays.  so can you please rework part #3
to use those?
Comment 18 Daniel Stone 2007-02-27 01:25:35 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 19 Tilman Sauerbeck 2007-05-03 12:06:30 UTC
Created attachment 9856 [details] [review]
XORG_VISIBILITY macro

This autoconf macro will check for gcc 4+, and if present, append -fvisibility=hidden to CFLAGS.
Obviously this macro can only be used once a project has marked the public API with _X_EXPORT.
Comment 20 Tilman Sauerbeck 2007-05-03 12:13:03 UTC
Created attachment 9857 [details] [review]
Add _X_EXPORT's for libX11

This patch, based on on attachment 2167 [details] [review], adds the necessary _X_EXPORT tags to libX11.

I added them to both the headers and the function definitions for completeness' sake. Also you can quickly see what's supposed to be part of the public API when editing the code and what's not. I'd rather not depend on including the headers in the source code to get the _X_EXPORT tags.

Some of these functions have prototypes in proto/kbproto. I just won't attach the patch for that, because I'm lazy. It does the obvious thing anyway :P

These two patches result in 386 less symbols in libX11.so. Not sure whether I missed a few which are needed. So, someone have a look at this.
Comment 21 Bernie Innocenti 2007-10-01 09:35:18 UTC
Ping?
Comment 22 Matt Turner 2010-12-03 16:18:50 UTC
(In reply to comment #21)
> Ping?

Please send these patches to xorg-devel@lists.x.org for review/inclusion. They're going to be continually ignored here.
Comment 23 Jeremy Huddleston Sequoia 2011-10-03 19:17:34 UTC
Please update your patches against current git and send to xorg-devel for 
review.  If this isn't done in the next month or so, I'll close this as 
WONTFIX.  I appreciate the effort and am sorry that this has bitrot for so 
long, but if you do that, the changes will be acted upon.
Comment 24 Julien Cristau 2011-10-04 11:23:25 UTC
> --- Comment #23 from Jeremy Huddleston <jeremyhu@freedesktop.org> 2011-10-03 19:17:34 PDT ---
> Please update your patches against current git and send to xorg-devel for 
> review.  If this isn't done in the next month or so, I'll close this as 
> WONTFIX.  I appreciate the effort and am sorry that this has bitrot for so 
> long, but if you do that, the changes will be acted upon.
> 
I asked ajax about this a while back, and he said he'd rather not change
this stuff.  So I guess this is a wontfix.
(I had previously sent out some patches, see the thread starting at
<1249040982-16446-1-git-send-email-jcristau@debian.org>)
Comment 25 Jeremy Huddleston Sequoia 2011-10-04 11:43:02 UTC
Ok, well I prefer annotation, but it is Xlib so maybe it's just too big of a can of worms at this point.


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.