Hi Inada-san, You can query the sysconfig module to check how Python has been built. Example: pyvstinner@apu$ python3 Python 3.7.4 (default, Jul 9 2019, 16:32:37) [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information.
import sysconfig
sysconfig.get_config_var('PY_CFLAGS') '-Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv'
sysconfig.get_config_var('PY_CFLAGS_NODIST') '-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -Werror=implicit-function-declaration -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fprofile-use -fprofile-correction'
sysconfig.get_config_var('PY_LDFLAGS') '-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -g'
sysconfig.get_config_var('PY_LDFLAGS_NODIST') '-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -g -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g'
import shlex [opt for opt in shlex.split(sysconfig.get_config_var('PY_CFLAGS') + sysconfig.get_config_var('PY_CFLAGS_NODIST')) if opt.startswith('-O') or 'profile' in opt] ['-O2', '-O2', '-fprofile-use', '-fprofile-correction']
[opt for opt in shlex.split(sysconfig.get_config_var('PY_LDFLAGS') + sysconfig.get_config_var('PY_LDFLAGS_NODIST')) if 'lto' in opt] ['-flto', '-ffat-lto-objects', '-flto-partition=none']
You can see that Fedora 30 /usr/bin/python3.7 is built using -O2 and
has been optimized with PGO (compiler flag -fprofile-use) and LTO
(linker flag -flto).
Victor
Le mar. 15 oct. 2019 à 11:02, Inada Naoki
Hi, all.
I want Homebrew uses `--enable-optimizations` and `--with-lto` option for building Python. But maintainer said:
Given this is not a default option, probably not, unless it is done in upstream (“official”) binaries.
https://github.com/Homebrew/homebrew-core/pull/45337
Are these options used for official macOS binaries? Is there official information about the build step of official binaries?
Regards, -- Inada Naoki
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/EILILECN... Code of Conduct: http://python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.