New submission from STINNER Victor <vstin...@python.org>:

When Python is built without --enable-shared, the "Py_FrozenMain" is not 
exported.

When Python is built with --enable-shared, the "Py_FrozenMain" is exported as 
expected.

I can reproduce the issue with attached reproduce.tar.gz example:

* build.sh exports "func1" symbol
* build_ar.sh doesn't export the "func1" symbol

The difference is that build.sh links directly two object files (.o) into a 
binary, whereas build_ar.sh creates a static library (.a) and then link the 
static library into a binary.

Python is always built with a static library (libpythonVERSION.a) which causes 
the issue.

A solution is to pass -Wl,--whole-archive option to the linker to export *all* 
symbols exported by all object files, and not only export symbols of the object 
files which are used.

I'm not sure why, but "Py_FrozenMain" is the *only* impacted symbol of the 
whole C API.

This issue was discovered by Petr Viktorin who works on the stable ABI:
https://mail.python.org/archives/list/capi-...@python.org/thread/5QLI3NUP3OSGLCCIBAQOTX4GEJQBWJ6F/

----------
components: C API
files: reproduce.tar.gz
messages: 393675
nosy: vstinner
priority: normal
severity: normal
status: open
title: "Py_FrozenMain" symbol is not exported
versions: Python 3.11
Added file: https://bugs.python.org/file50043/reproduce.tar.gz

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44133>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to