Skip to content
Tcl Source Code History Of Ticket 2959069
Login

History Of Ticket 2959069

Artifacts Associated With Ticket 2959069

  1. Ticket change [dd1911511d] (rid 114595) by nijtmans on 2010-02-25 22:43:57:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. 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.
      
    4. foundin initialized to: "None"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "nijtmans"
    10. subsystem initialized to: "52. Portability Support"
    11. title initialized to: "Deprecate MODULE_SCOPE"
    12. type initialized to: "Patch"
  2. Ticket change [cdea993894] (rid 95970) by nijtmans on 2010-02-26 05:43:57:

    1. icomment:
      
      
      File Added - 364439: visibility_hidden.patch
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  3. Ticket change [429a4beafc] (rid 116410) by nijtmans on 2010-02-26 05:44:58:

    1. assignee changed to: "das"
  4. Ticket change [266f94ff7f] (rid 88347) by das on 2010-02-26 06:02:08:

    1. assignee changed to: "nijtmans"
    2. 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)
      
      
    3. login: "das"
    4. mimetype: "text/plain"
    5. username: "das"
  5. Ticket change [3498ac0b4b] (rid 106781) by nijtmans on 2010-02-26 06:53:31:

    1. 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?
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  6. Ticket change [b42dd7228e] (rid 124982) by das on 2010-02-26 14:15:44:

    1. 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.
      
      
    2. login: "das"
    3. mimetype: "text/plain"
    4. username: "das"
  7. Ticket change [ebdea736f2] (rid 103607) by nijtmans on 2010-02-26 16:37:56:

    1. 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.
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  8. Ticket change [6cffe22790] (rid 128622) by nijtmans on 2010-02-26 16:41:00:

    1. 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.
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. title changed to: "Support for -fvisibility=hidden"
    5. username: "nijtmans"
  9. Ticket change [b72eab9faf] (rid 125540) by dkf on 2010-02-26 16:52:28:

    1. 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.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  10. Ticket change [13eaffcbf1] (rid 124301) by nijtmans on 2010-03-03 05:29:16:

    1. icomment:
      
      
      File Deleted - 364439: 
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  11. Ticket change [a10e1075b2] (rid 96912) by nijtmans on 2010-03-03 05:29:51:

    1. icomment:
      
      
      File Added - 365183: visibility_hidden.patch
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  12. Ticket change [d1875d9e02] (rid 113368) by nijtmans on 2010-03-03 05:35:26:

    1. icomment:
      New version of patch, reverting to the current
      behavior if -fvisibility=hidden is not available.
      So, no regression.
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  13. Ticket change [18a509bb7b] (rid 122694) by nijtmans on 2010-03-03 06:54:27:

    1. icomment:
      
      
      File Deleted - 365183: 
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  14. Ticket change [3a814edbc9] (rid 112573) by nijtmans on 2010-03-03 06:55:29:

    1. icomment:
      
      
      File Added - 365189: visibility_hidden.patch
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  15. Add attachment "visibility_hidden.patch" [8da3d587a5] (rid 127968) by nijtmans on 2010-03-03 06:55:29.

  16. Ticket change [175c079805] (rid 122479) by nijtmans on 2010-03-03 06:58:48:

    1. 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!
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  17. Ticket change [9de2d853ac] (rid 96386) by nijtmans on 2010-03-03 06:58:49:

    1. assignee changed to: "das"
  18. Ticket change [de0a7303fc] (rid 114782) by nijtmans on 2010-03-03 06:59:06:

    1. resolution changed to: "Fixed"
  19. Ticket change [6f38b01a02] (rid 100279) by dkf on 2010-03-03 16:34:39:

    1. icomment:
      Seems to function correctly for me on OSX (as in "a clean configure and build with it works"). Great!
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  20. Ticket change [6b4edfec4a] (rid 128307) by nijtmans on 2010-03-03 16:50:39:

    1. 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!
      
      
      
    2. login: "nijtmans"
    3. mimetype: "text/plain"
    4. username: "nijtmans"
  21. Ticket change [e0a54ad441] (rid 115233) by dkf on 2010-03-03 20:17:46:

    1. 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)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. username: "dkf"
  22. Ticket change [69d7621f2d] (rid 128049) by nijtmans on 2010-04-29 20:03:37:

    1. closedate changed to: "2010-04-29T13:03:37"
    2. closer changed to: "nijtmans"
    3. icomment:
      Adding additional warning options seems out-of-scope for this Issue. If everything works fine, this simply should be closed. Agreed?
      
      
    4. login: "nijtmans"
    5. mimetype: "text/plain"
    6. status changed to: "Pending"
    7. username: "nijtmans"
  23. Ticket change [213a9ac62f] (rid 130546) by sf-robot on 2010-05-14 09:20:18:

    1. closedate changed to: "2010-05-14T02:20:18"
    2. closer changed to: "sf-robot"
    3. 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).
      
      
    4. login: "sf-robot"
    5. mimetype: "text/plain"
    6. status changed to: "Closed"
    7. username: "sf-robot"
  24. Ticket change [b6c68976cd] (rid 135637) by jan.nijtmans on 2013-11-19 09:11:01:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2456615.88265944"
    3. closer changed to: "jan.nijtmans"
    4. 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.
      
    5. 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.
      
    6. login: "jan.nijtmans"
    7. mimetype: "text/x-fossil-wiki"
    8. severity changed to: "Minor"