BLD: ensure libnpymath and highway static libs use hidden visibility #26286
+3
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The effect this has is that symbols don't get re-exported as public by Python extension modules that link with these shared libraries. E.g., building on macOS arm64 with Clang changes the set of exported symbols for
_multiarray_umath
from:to:
This works for all compilers that support GNU-style
__attribute__((visibility("hidden"))
, which both GCC and Clang do. Tested on SciPy as well, it has the same effect there. For example,scipy.special._ufuncs
was re-exporting all_npy_*
symbols and after this change that is no longer the case.Note that the
libnpyrandom
static library is left alone here. Trying to change visibility there breaks a test for CFFI, because that test is accessing private symbols. This is clearly wrong, but explicitly documented athttps://numpy.org/devdocs/reference/random/extending.html#cffi. So leaving that alone here.
libnpyrandom
isn't used by SciPy anymore and may well have zero users left, so it's not critical.