Skip to content

fix: ignore weak symbols in get_undefined_symbols#665

Merged
mayeut merged 3 commits intopypa:mainfrom
mayeut:blaklist-ignore-weak
Jan 4, 2026
Merged

fix: ignore weak symbols in get_undefined_symbols#665
mayeut merged 3 commits intopypa:mainfrom
mayeut:blaklist-ignore-weak

Conversation

@mayeut
Copy link
Copy Markdown
Member

@mayeut mayeut commented Jan 3, 2026

Undefined symbols with weak binding are likely optional in runtime. Don't treat them as undefined in auditwheel context.

fix #663

Note: the function get_undefined_symbols is only used to process blacklisted symbols. If the symbol is optional at runtime, we definitely don't need to blacklist it.

Undefined symbols with weak binding are likely optional in runtime.
Don't treat them as undefined in auditwheel context.
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.24%. Comparing base (dbef2a6) to head (b80234d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #665   +/-   ##
=======================================
  Coverage   95.24%   95.24%           
=======================================
  Files          22       22           
  Lines        1829     1829           
  Branches      343      343           
=======================================
  Hits         1742     1742           
  Misses         48       48           
  Partials       39       39           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mayeut mayeut marked this pull request as ready for review January 4, 2026 12:40
@mayeut mayeut requested a review from Copilot January 4, 2026 12:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the handling of weak symbols in ELF binaries by excluding them from the set of undefined symbols. Weak symbols are optional at runtime and should not be treated as required dependencies when checking against blacklisted symbols.

  • Modified get_undefined_symbols() to filter out weak symbols (STB_WEAK binding)
  • Added test to verify that wheels with weak symbols are not incorrectly rejected
  • Refactored wheel download logic in noxfile.py to support downloading multiple test wheels

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/auditwheel/elfutils.py Added check to exclude weak symbols (STB_WEAK) from undefined symbols list
tests/integration/test_bundled_wheels.py Added test validating that cryptography wheel with weak symbols passes manylinux policy check
noxfile.py Refactored pip download commands into reusable _download_wheels_for_tests() function to download both patchelf and cryptography test wheels
.gitignore Added ignore entry for the cryptography test wheel downloaded by noxfile

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/integration/test_bundled_wheels.py
Comment thread noxfile.py Outdated
Comment thread noxfile.py
@mayeut mayeut force-pushed the blaklist-ignore-weak branch from b4bcaf8 to b80234d Compare January 4, 2026 12:54
@mayeut mayeut merged commit 481f3b5 into pypa:main Jan 4, 2026
18 checks passed
@mayeut mayeut deleted the blaklist-ignore-weak branch January 4, 2026 14:16
@mayeut mayeut mentioned this pull request Jan 4, 2026
messense pushed a commit to PyO3/maturin that referenced this pull request Jan 6, 2026
PR #2901 updated the manylinux policies, which now include
`__cxa_thread_atexit_impl`. This symbol is [linked
weakly](https://github.com/rust-lang/rust/blob/4fa80a5e733e2202d7ca4c203c2fdfda41cfe7dc/library/std/src/sys/thread_local/destructors/linux_like.rs#L4)
by the Rust stdlib.

Rather than requiring a bump of the minimum manylinux platform tag for
users, ignore weak symbols in the check. This is in line with changes to
PyPA's auditwheel (pypa/auditwheel#665).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6.5.1 - manylinux_2_12, 2_17 - issue with blacklist changes when compiling with rust.

2 participants