-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make static internals ptr pybind version specific #862
Conversation
(This doesn't affect test suite .so size at all.) |
It's strange that gcc does that. The fix looks good to me. Might be nice to add a comment above the new function template since its purpose is a bit mysterious out of context. (As a side-note, placing |
Under gcc, the `static internals *internals_ptr` is shared across .so's, which breaks for obvious reasons. This commit fixes it by moving the static pointer declaration into a pybind-version-templated function.
a273203
to
9c9f62e
Compare
Added a comment, and removed the unneeded "inline". |
A bit of further investigation: gcc only seems to behave this way when not compiling with With |
Another way to fix this is to compile with |
…cals This commit adds an attribute macro PYBIND11_UNSHARED_STATIC_LOCALS that forces a function to have hidden visibility under gcc. This is needed to force gcc to avoid sharing static local instances across modules (which happens even under a RTLD_LOCAL dlopen()!) This replaces the fix from pybind#862 to use this instead of the version-specific-template internals pointer.
…cals This commit adds an attribute macro PYBIND11_UNSHARED_STATIC_LOCALS that forces a function to have hidden visibility under gcc. This is needed to force gcc to avoid sharing static local instances across modules (which happens even under a RTLD_LOCAL dlopen()!) This updates the workaround from pybind#862 to use this rather than the version-specific-template.
…cals This commit adds an attribute macro PYBIND11_UNSHARED_STATIC_LOCALS that forces a function to have hidden visibility under gcc. This is needed to force gcc to avoid sharing static local instances across modules (which happens even under a RTLD_LOCAL dlopen()!) This updates the workaround from pybind#862 to use this rather than the version-specific-template.
This commit adds a PYBIND11_UNSHARED_STATIC_LOCALS macro that forces a function to have hidden visibility under gcc and gcc-compatible compilers. gcc, in particular, needs this to to avoid sharing static local variables across modules (which happens even under a RTLD_LOCAL dlopen()!). clang doesn't appear to have this issue, but the forced visibility on internal pybind functions certainly won't hurt it and icc. This updates the workaround from pybind#862 to use this rather than the version-specific template.
This commit adds a PYBIND11_UNSHARED_STATIC_LOCALS macro that forces a function to have hidden visibility under gcc and gcc-compatible compilers. gcc, in particular, needs this to to avoid sharing static local variables across modules (which happens even under a RTLD_LOCAL dlopen()!). clang doesn't appear to have this issue, but the forced visibility on internal pybind functions certainly won't hurt it and icc. This updates the workaround from pybind#862 to use this rather than the version-specific template.
This commit adds a PYBIND11_UNSHARED_STATIC_LOCALS macro that forces a function to have hidden visibility under gcc and gcc-compatible compilers. gcc, in particular, needs this to to avoid sharing static local variables across modules (which happens even under a RTLD_LOCAL dlopen()!). clang doesn't appear to have this issue, but the forced visibility on internal pybind functions certainly won't hurt it and icc. This updates the workaround from #862 to use this rather than the version-specific template.
Under gcc, the
static internals *internals_ptr
is shared across .so's, which breaks for obvious reasons.This commit fixes it by moving the static pointer declaration into a pybind-version-templated function.
Fixes #796.