bpo-44133: Export Py_FrozenMain() symbol by vstinner · Pull Request #26130 · python/cpython

Conversation

@vstinner

The Python binary now builds the libpython static library using
"-Wl,--whole-archive" linker option to export all symbols exported by
object files. Previously, the "Py_FrozenMain" symbol was not
exported.

https://bugs.python.org/issue44133

The Python binary now builds the libpython static library using
"-Wl,--whole-archive" linker option to export all symbols exported by
object files. Previously, the "Py_FrozenMain" symbol was not
exported.

pablogsal

Choose a reason for hiding this comment

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

This needs backport to 3.10 at the very least, no?

shreyanavigyan

@vstinner

I'm not sure that it makes sense to treat a python executable binary as a library, and so expect that all symbols are exported.

@pablogsal

I'm not sure that it makes sense to treat a python executable binary as a library

It absolutely does, if not, how can C extensions get access to the C-API?

corona10

Choose a reason for hiding this comment

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

clang does not support --whole-archive can we use -all_load on macOS for that purpose?

@github-actions

This PR is stale because it has been open for 30 days with no activity.

@vstinner

-Wl,--whole-archive is not as portable as as expected. IMO another approach should be taken. Don't use the static library to link the "python" binary, "simply" pass the whole list of all object files.

@shihai1991

-Wl,--whole-archive is not as portable as as expected. IMO another approach should be taken. Don't use the static library to link the "python" binary, "simply" pass the whole list of all object files.

I use --whole-archive or all_load in configure.ac. It works in my local centos vm. #29876

Labels