Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/hidden-symbols.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
global:
PyInit_*;
local:
*;
};
10 changes: 10 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,19 @@ else
new_preprocessor = []
endif

# Even though Meson defaults to hidden visibility, our bundled libraries like FreeType
# may themselves export their own symbols individually. So force all symbols other than
# the Python module initialization function to be hidden with a linker version script.
mapfile = 'hidden-symbols.map'
vflag = cc.get_supported_link_arguments([
'-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
])

foreach ext, kwargs : extension_data
additions = {
'cpp_args': [new_preprocessor] + kwargs.get('cpp_args', []),
'link_args': [vflag] + kwargs.get('link_args', []),
'link_depends': [mapfile] + kwargs.get('link_depends', []),
}
py3.extension_module(
ext,
Expand Down
Loading