Skip to content

Hide symbols in _decimal.so #60949

Closed
Closed

Description

@skrah
mannequin
BPO 16745
Nosy @malemburg, @loewis, @doko42, @pitrou, @tiran, @skrah, @davidmalcolm, @meadori
Files
  • libmpdec-hide-non-api-symbols.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/skrah'
    closed_at = <Date 2012-12-23.11:09:58.059>
    created_at = <Date 2012-12-21.17:15:33.463>
    labels = ['extension-modules', 'type-feature']
    title = 'Hide symbols in _decimal.so'
    updated_at = <Date 2012-12-23.11:09:58.058>
    user = 'https://github.com/skrah'

    bugs.python.org fields:

    activity = <Date 2012-12-23.11:09:58.058>
    actor = 'skrah'
    assignee = 'skrah'
    closed = True
    closed_date = <Date 2012-12-23.11:09:58.059>
    closer = 'skrah'
    components = ['Extension Modules']
    creation = <Date 2012-12-21.17:15:33.463>
    creator = 'skrah'
    dependencies = []
    files = ['28385']
    hgrepos = []
    issue_num = 16745
    keywords = ['patch']
    message_count = 8.0
    messages = ['177883', '177886', '177890', '177894', '177896', '177904', '177941', '177959']
    nosy_count = 9.0
    nosy_names = ['lemburg', 'loewis', 'doko', 'pitrou', 'christian.heimes', 'skrah', 'dmalcolm', 'meador.inge', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue16745'
    versions = ['Python 3.3', 'Python 3.4']

    Activity

    1. skrah commented on Dec 21, 2012

      skrahmannequin
      MannequinAuthor

      This issue is for the _decimal specific parts from bpo-4555. The patch
      depends on _Pragma (C99) and gcc >= 4.0 for the contents of the pragma.
      I think it will work for clang, too.

      Should the libmpdec API symbols (i.e. the ones starting with mpd_*)
      be hidden for _decimal.c, too?

    2. self-assigned this
      on Dec 21, 2012
    3. skrah commented on Dec 21, 2012

      skrahmannequin
      MannequinAuthor

      Adding everyone from issue bpo-4555, in case you can think of a different
      (portable) solution for hiding symbols (with minimal effort).

    4. meadori commented on Dec 21, 2012

      @meadori
      Member

      Personally I prefer using attributes instead of pragmas. The GCC manual recommends such as well. There are also other sources in Modules/* that use '__attribute__ ((visibility ("hidden")))'. Namely ctypes and zlib.

      I can understand that it is more work, but I find something like the following more readable (I am not actually suggesting names here, just an example):

         #define PY_LOCAL __attribute__ ((visibility ("hidden")))

      ...

         void foo(void) PY_LOCAL;
         void bar(void) PY_LOCAL;
    5. skrah commented on Dec 21, 2012

      skrahmannequin
      MannequinAuthor

      Meador Inge <report@bugs.python.org> wrote:

      Personally I prefer using attributes instead of pragmas. The GCC manual recommends such as well.

      I followed www.akkadia.org/drepper/dsohowto.pdf . Drepper seems to be fine
      with the use of pragmas in internal headers.

      There are also other sources in Modules/* that use '__attribute__ ((visibility ("hidden")))'. Namely ctypes and zlib.

      They do, but for a tiny amount of functions. mpdecimal.h, which is internal
      as far as _decimal.so is concerned, also needs to be changed. There you have
      something like 200 lines of

      [...]
      void mpd_qrescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, const mpd_context_t *ctx, uint32_t *status) Py_HIDDEN;
      void mpd_qrescale_fmt(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, const mpd_context_t *ctx, uint32_t *status) Py_HIDDEN;
      [...],

      which increases the size of the diff between the standalone libmpdec and the
      one shipped with Python.

    6. meadori commented on Dec 21, 2012

      @meadori
      Member

      Ah, I missed how big of a line range these pragmas are covering when I scanned the patch before. In that case, I agree with the current patch.

    7. python-dev commented on Dec 21, 2012

      python-devmannequin
      Mannequin

      New changeset 24f6c6f3b7bf by Stefan Krah in branch '3.3':
      Issue bpo-16745: Hide a couple of symbols by making them local.
      http://hg.python.org/cpython/rev/24f6c6f3b7bf

    8. python-dev commented on Dec 22, 2012

      python-devmannequin
      Mannequin

      New changeset 51b0a150f8aa by Stefan Krah in branch '3.3':
      Issue bpo-16745: Hide symbols in _decimal.so.
      http://hg.python.org/cpython/rev/51b0a150f8aa

    9. python-dev commented on Dec 22, 2012

      python-devmannequin
      Mannequin

      New changeset ccc372b37fbb by Stefan Krah in branch '3.3':
      Issue bpo-16745: The gcc visibility pragma is buggy on OpenIndiana and NetBSD.
      http://hg.python.org/cpython/rev/ccc372b37fbb

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions