Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo: -bundle_loader without the need for -undefined #103356

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rickmark
Copy link

@rickmark rickmark commented Apr 7, 2023

This is a illustrative PR - it removes the need for -undefined dynamic_lookup by creating a stub bundle loader (that defines each of the expected Python ABI symbols) and then linking each core module using -bundle_loader python3.12.pyabi -flat_namespace. This causes modules to both be checked for all symbols (yay) as well as a flat namespace (unfortunate but perhaps required as symbols may be defined in python or libpython3.12.dylib depending on compile type). If it were possible, a potential improvement on this design would be to be able to define those symbols coming from python (python3.12.symbols is a list) as being flat namespace, but not requiring it wholesale. Another possible fix is if the lines in libpython that do the dlopen can specify the self module as the effective bundle loader, then without flat namespace, the loader could specify that the required symbols are coming from the current module (which is either the bin or the shared library). dlopen seems to only assume the bundle loader is the main executable.

Basically, at this point its just hacking around dlopen on macOS to specify the true bundle loader image as the shared library if need be and the removal of -flat_namespace to make this 100% legit

https://opensource.apple.com/source/dyld/dyld-519.2.2/dyld3/APIs_macOS.cpp.auto.html

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Apr 7, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants