msg177883 - (view) |
Author: Stefan Krah (skrah) *  |
Date: 2012-12-21 17:15 |
This issue is for the _decimal specific parts from #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? |
|
|
msg177886 - (view) |
Author: Stefan Krah (skrah) *  |
Date: 2012-12-21 17:22 |
Adding everyone from issue #4555, in case you can think of a different (portable) solution for hiding symbols (with minimal effort). |
|
|
msg177890 - (view) |
Author: Meador Inge (meador.inge) *  |
Date: 2012-12-21 19:51 |
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; |
|
|
msg177894 - (view) |
Author: Stefan Krah (skrah) *  |
Date: 2012-12-21 20:50 |
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. |
|
|
msg177896 - (view) |
Author: Meador Inge (meador.inge) *  |
Date: 2012-12-21 21:06 |
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. |
|
|
msg177904 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-12-21 22:28 |
New changeset 24f6c6f3b7bf by Stefan Krah in branch '3.3': Issue #16745: Hide a couple of symbols by making them local. http://hg.python.org/cpython/rev/24f6c6f3b7bf |
|
|
msg177941 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-12-22 13:25 |
New changeset 51b0a150f8aa by Stefan Krah in branch '3.3': Issue #16745: Hide symbols in _decimal.so. http://hg.python.org/cpython/rev/51b0a150f8aa |
|
|
msg177959 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-12-22 22:09 |
New changeset ccc372b37fbb by Stefan Krah in branch '3.3': Issue #16745: The gcc visibility pragma is buggy on OpenIndiana and NetBSD. http://hg.python.org/cpython/rev/ccc372b37fbb |
|
|