From aa874ea0d020aee90595c2adfb43866fcaabfdb7 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 18 Apr 2022 22:27:09 -0400 Subject: python module: default extensions to hidden symbol visibility python compiled extensions should never need to expose any symbol other than PyInit_* which is declared with default visibility via PyMODINIT_FUNC on supported compilers. Thus, a reasonably sane default is to mark any other symbols as hidden, while still respecting any manually specified visibility. Gate this on the version of python itself, as not all versions decorate PyMODINIT_FUNC properly. --- mesonbuild/modules/python.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mesonbuild') diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 324dfc8..1be9acf 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -533,6 +533,10 @@ class PythonInstallation(ExternalProgramHolder): kwargs['name_prefix'] = '' kwargs['name_suffix'] = suffix + if 'gnu_symbol_visibility' not in kwargs and \ + (self.is_pypy or mesonlib.version_compare(self.version, '>=3.9')): + kwargs['gnu_symbol_visibility'] = 'inlineshidden' + return self.interpreter.func_shared_module(None, args, kwargs) @disablerIfNotFound -- cgit v1.1