bpo-38980: Add -fno-semantic-interposition when building with optimizations (GH-22862)

This commit is contained in:
Pablo Galindo 2020-10-21 22:46:52 +01:00 committed by GitHub
parent 27f1bd8787
commit b451b0e9a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 0 deletions

View File

@ -256,6 +256,14 @@ Optimizations
It is about 36% faster now. (Contributed by Pablo Galindo and Yury Selivanov
in :issue:`42093`.)
* When building Python with ``--enable-optimizations`` now
``-fno-semantic-interposition`` is added to both the compile and link line.
This speeds builds of the Python interpreter created with ``--enable-shared``
with ``gcc`` by up to 30%. See `this article
<https://developers.redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-faster-python-3-8-run-speeds/>`_
for more details. (Contributed by Victor Stinner and Pablo Galindo in
:issue:`38980`)
Deprecated
==========

View File

@ -0,0 +1,3 @@
Add ``-fno-semantic-interposition`` to both the compile and link line when
building with ``--enable-optimizations``. Patch by Victor Stinner and Pablo
Galindo.

8
configure vendored
View File

@ -6482,6 +6482,14 @@ if test "$Py_OPT" = 'true' ; then
DEF_MAKE_ALL_RULE="profile-opt"
REQUIRE_PGO="yes"
DEF_MAKE_RULE="build_all"
case $CC in
*gcc*)
CFLAGS_NODIST="$CFLAGS_NODIST -fno-semantic-interposition"
LDFLAGS_NODIST="$LDFLAGS_NODIST -fno-semantic-interposition"
;;
esac
else
DEF_MAKE_ALL_RULE="build_all"
REQUIRE_PGO="no"

View File

@ -1318,6 +1318,14 @@ if test "$Py_OPT" = 'true' ; then
DEF_MAKE_ALL_RULE="profile-opt"
REQUIRE_PGO="yes"
DEF_MAKE_RULE="build_all"
case $CC in
*gcc*)
CFLAGS_NODIST="$CFLAGS_NODIST -fno-semantic-interposition"
LDFLAGS_NODIST="$LDFLAGS_NODIST -fno-semantic-interposition"
;;
esac
else
DEF_MAKE_ALL_RULE="build_all"
REQUIRE_PGO="no"