Skip to content

BLD: Force all internal extension symbols to be hidden - #32209

Merged
ksunden merged 1 commit into
matplotlib:mainfrom
QuLogic:hidden-symbols
Aug 21, 2026
Merged

ksunden merged 1 commit into
matplotlib:mainfrom
QuLogic:hidden-symbols

Conversation

@QuLogic

@QuLogic QuLogic commented Aug 14, 2026

Copy link
Copy Markdown
Member

PR summary

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.

By making symbols like FT_Init_Freetype local, it ensures that they cannot be resolved by other global versions, such as a system copy loaded beforehand. It also allows the linker to discard more sections for unused code, saving us approximately 6.6% in shared library space.

Fixes #32208

AI Disclosure

None

PR quality check

  • Use an expressive title, e.g. "Fix title font property precedence"
  • New and changed code is tested
  • [n/a] Plotting related features are demonstrated in an example
  • [n/a] New features and API changes have release notes
  • [n/a] Documentation complies with general and docstring guidelines

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.

By making symbols like `FT_Init_Freetype` local, it ensures that they
cannot be resolved by other global versions, such as a system copy
loaded beforehand. It also allows the linker to discard more sections
for unused code, saving us approximately 6.6% in shared library space.
@QuLogic QuLogic added this to the v3.11.2 milestone Aug 14, 2026
@QuLogic QuLogic added the CI: Run cibuildwheel Run wheel building tests on a PR label Aug 14, 2026
@ksunden
ksunden merged commit 84aaf23 into matplotlib:main Aug 21, 2026
52 of 53 checks passed
@QuLogic
QuLogic deleted the hidden-symbols branch August 21, 2026 18:42
QuLogic added a commit that referenced this pull request Aug 21, 2026
…209-on-v3.11.x

Backport PR #32209 on branch v3.11.x (BLD: Force all internal extension symbols to be hidden)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: Run cibuildwheel Run wheel building tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Wheel's freetype binding can conflict with system library

3 participants