Artifacts Associated With Ticket 2959069fffffffffffffffffffffffffffffffff
Ticket change [dd1911511d] (rid 114595) by nijtmans on 2010-02-25 22:43:57:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Here is a patch, which makes the MODULE_SCOPE machinery unnecessary when using gcc. It makes everything compile with the gcc option -fvisibility=hidden (when available), so the EXPORT macro controls which symbols are exported. I am very interested to know whether Darwin, on which MODULE_SCOPE is currently translated by "__private_extern__" has a similar compiler options, making all symbols hidden by default, except the ones explicitely exported. Then MODULE_SCOPE can fully be deprecated.
- foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nijtmans"
- subsystem initialized to: "52. Portability Support"
- title initialized to: "Deprecate MODULE_SCOPE"
- type initialized to: "Patch"
Ticket change [cdea993894] (rid 95970) by nijtmans on 2010-02-26 05:43:57:
- icomment:
File Added - 364439: visibility_hidden.patch
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [429a4beafc] (rid 116410) by nijtmans on 2010-02-26 05:44:58:
- assignee changed to: "das"
Ticket change [266f94ff7f] (rid 88347) by das on 2010-02-26 06:02:08:
- assignee changed to: "nijtmans"
- icomment:
with recent enough gcc, we use visibility hidden on Darwin as well, but with older gcc that did not support visibility attributes yet we fall back to the Apple extension private_extern. MODULE_SCOPE affords us the flexibility to accommodate compiler/linkers that don't have an option to hide symbols by default and only export certain marked symbols. After all the work adding MODULE_SCOPE everywhere, where is the need/benefit to removing it again? Note that there are compilers (e.g. clang) that support __attribute__((__visibility__("hidden"))) but do not have the same commandline flags as gcc, your patch would be a regression there, the check for the attribute should remain as a fallback if the test for -fvisibility=hidden fails. Also, the current patch does not seem to test for __attribute__((__visibility__("default"))), which you will presumably need for the EXPORT macro ? (also not part of the patch) - login: "das"
- mimetype: "text/plain"
- username: "das"
Ticket change [3498ac0b4b] (rid 106781) by nijtmans on 2010-02-26 06:53:31:
- icomment:
Thanks for the reaction! - The handling of __attribute__((__visibility__("default"))) is done in tcl.h, and this is already available. Also, the needed -DBUILD_tcl and -DBUILD_tk is already part of the current Makefile.in. It should work for Darwin as is.... > After all the work adding MODULE_SCOPE everywhere, where is the > need/benefit to removing it again? I wouldn't start removing it, until it's been well tested on all platforms. (I called it 'deprecate', not 'remove'). However, being obliged to decorate all exported symbols with EXTERN and all others with MODULE_SCOPE, that's asking for trouble forgetting one. Before starting with this, I compared the list of Tk exported symbols, and found two problematic symbols. One that didn't respect the EXTERN because of a missing include (TkpCmapStressed), another symbol that was not supposed to be exported at all (TkSetTransientFor). I fixed those two, but with -fvisibility=hidden, it would already have been discovered long ago.... Anyway, it's not high priority. I agree that the attribute should be kept as fallback. Any more remarks? - login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [b42dd7228e] (rid 124982) by das on 2010-02-26 14:15:44:
- icomment:
as mentioned, IMO it would be better to have a configure check for __attribute__ ((visibility("default"))), gcc > 3 is not the only compiler that supports this, so the check in tcl.h will miss some cases and be a regression over the current state of things. as far as discovering mistakenly exported symbols, that's what the 'checkexports' and 'checkstubs' makefile targets are there for... I try to remember to run these shortly before a release to make sure that we didn't forget any decorations. All that said, I am strongly in favor of using -fvisibility=hidden when available, I just think it would be a shame to loose the extra flexibility the current scheme affords us w.r.t non-gcc compilers/linkers. - login: "das"
- mimetype: "text/plain"
- username: "das"
- icomment:
Ticket change [ebdea736f2] (rid 103607) by nijtmans on 2010-02-26 16:37:56:
- icomment:
>All that said, I am strongly in favor of using -fvisibility=hidden when >available, I just think it would be a shame to loose the extra flexibility >the current scheme affords us w.r.t non-gcc compilers/linkers. Yes, I fully agree with that. My goal is first get gcc 4.x working with -fvisibility=hidden, and for all other compilers keep using the current MODULE_SCOPE method. Then later we can always extend it to let other compilers use their -fvisiliby=hidden variant.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [6cffe22790] (rid 128622) by nijtmans on 2010-02-26 16:41:00:
- icomment:
This means, in fact, that the title of this Issue is wrong. The goal is not to phase out MODULE_SCOPE, the goal is to add support for compilers who, like gcc 4.x have a command line option to make all symbols hidden except especially decorated ones.
- login: "nijtmans"
- mimetype: "text/plain"
- title changed to: "Support for -fvisibility=hidden"
- username: "nijtmans"
- icomment:
Ticket change [b72eab9faf] (rid 125540) by dkf on 2010-02-26 16:52:28:
- icomment:
Since we're going to be supporting all sorts of different compilers (on some platforms I use, I've got gcc 2.* still) for a long time across lots of platforms, I can't see that removing MODULE_SCOPE is necessarily a good move. The "get the overall visibility right" is an audit requirement, and we have make targets to support it. If you want to rewrite configure so as to allow for the case you describe (compiler flag, etc.) then that could be trialled. But that's a configure change and not a change to the Tcl and Tk sources.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [13eaffcbf1] (rid 124301) by nijtmans on 2010-03-03 05:29:16:
- icomment:
File Deleted - 364439:
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [a10e1075b2] (rid 96912) by nijtmans on 2010-03-03 05:29:51:
- icomment:
File Added - 365183: visibility_hidden.patch
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [d1875d9e02] (rid 113368) by nijtmans on 2010-03-03 05:35:26:
- icomment:
New version of patch, reverting to the current behavior if -fvisibility=hidden is not available. So, no regression.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [18a509bb7b] (rid 122694) by nijtmans on 2010-03-03 06:54:27:
- icomment:
File Deleted - 365183:
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [3a814edbc9] (rid 112573) by nijtmans on 2010-03-03 06:55:29:
- icomment:
File Added - 365189: visibility_hidden.patch
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Add attachment "visibility_hidden.patch" [8da3d587a5] (rid 127968) by nijtmans on 2010-03-03 06:55:29.
Ticket change [175c079805] (rid 122479) by nijtmans on 2010-03-03 06:58:48:
- icomment:
Patch was still not 100% correct, but now it is. DKF's and DAS's remark handled. Checked in for HEAD. Assigning to das, could you please check if everything works on mac as well? I am pretty sure it works as is, but checking never hurts. Thanks!
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [9de2d853ac] (rid 96386) by nijtmans on 2010-03-03 06:58:49:
- assignee changed to: "das"
Ticket change [de0a7303fc] (rid 114782) by nijtmans on 2010-03-03 06:59:06:
- resolution changed to: "Fixed"
Ticket change [6f38b01a02] (rid 100279) by dkf on 2010-03-03 16:34:39:
- icomment:
Seems to function correctly for me on OSX (as in "a clean configure and build with it works"). Great!
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [6b4edfec4a] (rid 128307) by nijtmans on 2010-03-03 16:50:39:
- icomment:
Thanks, Donal. But it might be that, because of this change, some symbols that were exported before, are not exported any more. I found and fixed 2 such cases in Tk. Every such difference is a bug, unrelated to this change! I can see 2 possibilities for this to happen: - A missing #include, so the EXTERN in this include is not picked up by the compiler - symbols which neither have EXTERN nor MODULE_SCOPE. So, could anyone do a build (both Tcl and Tk) with the current "configure" script and the previous one, and compare the list of exported symbols. It should be exactly the same!
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [e0a54ad441] (rid 115233) by dkf on 2010-03-03 20:17:46:
- icomment:
Maybe we should consider adding -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes (at least for gcc in debug mode; don't need to worry random builders, but do want to be able to audit for blunders)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [69d7621f2d] (rid 128049) by nijtmans on 2010-04-29 20:03:37:
- closedate changed to: "2010-04-29T13:03:37"
- closer changed to: "nijtmans"
- icomment:
Adding additional warning options seems out-of-scope for this Issue. If everything works fine, this simply should be closed. Agreed?
- login: "nijtmans"
- mimetype: "text/plain"
- status changed to: "Pending"
- username: "nijtmans"
Ticket change [213a9ac62f] (rid 130546) by sf-robot on 2010-05-14 09:20:18:
- closedate changed to: "2010-05-14T02:20:18"
- closer changed to: "sf-robot"
- icomment:
allow_comments - 1 This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
- login: "sf-robot"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "sf-robot"
Ticket change [b6c68976cd] (rid 135637) by jan.nijtmans on 2013-11-19 09:11:01:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2456615.88265944"
- closer changed to: "jan.nijtmans"
- comment changed to:
Here is a patch, which makes the MODULE_SCOPE machinery unnecessary when using gcc. It makes everything compile with the gcc option -fvisibility=hidden (when available), so the EXPORT macro controls which symbols are exported. I am very interested to know whether Darwin, on which MODULE_SCOPE is currently translated by "__private_extern__" has a similar compiler options, making all symbols hidden by default, except the ones explicitely exported. Then MODULE_SCOPE can fully be deprecated.
- icomment:
Reported by Stuart Cassoff: ================================= Hi! Here's some snippets from an obsd discussion on symbol visibility. I thought you might find it interesting. Stu ... 2) declares the internal functions explicitly hidden, instead of using -fvisibility=hidden and default declarations in sndio.h Why (2)? Well, -fvisibility=hidden doesn't actually get you the full performance benefits, as it only affects definitions and not declarations. The result is that inter-file file calls still use the PLT unless you explicitly declare the internal functions hidden.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- severity changed to: "Minor"