Skip to content

bpo-44133: Export Py_FrozenMain() symbol. #29876

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

Closed
wants to merge 3 commits into from
Closed
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 Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,12 @@ Build Changes
``libdb`` 3.x and 4.x are no longer supported.
(Contributed by Christian Heimes in :issue:`45747`.)

* The Python binary now builds the libpython static library using
``-Wl,--whole-archive`` or ``-Wl,-all_load`` linker option to
export all symbols exported by object files.
Previously, the ``Py_FrozenMain`` symbol was not exported.
(Contributed by Hai Shi and Victor Stinner in :issue:`44133`.)

C API Changes
=============

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The Python binary now builds the libpython static library using
``-Wl,--whole-archive`` or ``-Wl,-all_load`` linker option to
export all symbols exported by object files.
Previously, the ``Py_FrozenMain`` symbol was not exported.
Patch by Hai Shi and Victor Stinner.
17 changes: 11 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -6479,12 +6479,17 @@ $as_echo "#define Py_ENABLE_SHARED 1" >>confdefs.h
esac
else # shared is disabled
PY_ENABLE_SHARED=0
case $ac_sys_system in
CYGWIN*)
BLDLIBRARY='$(LIBRARY)'
LDLIBRARY='libpython$(LDVERSION).dll.a'
;;
esac
case $ac_sys_system in #(
CYGWIN*) :
BLDLIBRARY='$(LIBRARY)'
LDLIBRARY='libpython$(LDVERSION).dll.a' ;; #(
Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*) :
BLDLIBRARY='-Wl,--whole-archive $(LDLIBRARY) -Wl,--no-whole-archive' ;; #(
Darwin*) :
BLDLIBRARY='-Wl,-all_load $(LDLIBRARY)' ;; #(
*) :
;;
esac
fi

if test "$cross_compiling" = yes; then
Expand Down
14 changes: 8 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1295,12 +1295,14 @@ if test $enable_shared = "yes"; then
esac
else # shared is disabled
PY_ENABLE_SHARED=0
case $ac_sys_system in
CYGWIN*)
BLDLIBRARY='$(LIBRARY)'
LDLIBRARY='libpython$(LDVERSION).dll.a'
;;
esac
AS_CASE([$ac_sys_system],
[CYGWIN*],
[BLDLIBRARY='$(LIBRARY)'
LDLIBRARY='libpython$(LDVERSION).dll.a'],
[Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*],
[BLDLIBRARY='-Wl,--whole-archive $(LDLIBRARY) -Wl,--no-whole-archive'],
[Darwin*],
[BLDLIBRARY='-Wl,-all_load $(LDLIBRARY)'])
fi

if test "$cross_compiling" = yes; then
Expand Down