Skip to content

bpo-38980: Add -fno-semantic-interposition when building with optimizations #22862

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

Merged
merged 2 commits into from
Oct 21, 2020
Merged
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
8 changes: 8 additions & 0 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
==========

Expand Down
Original file line number Diff line number Diff line change
@@ -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 changes: 8 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

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

There is no conditional activation on --enable-shared because C extensions can also benefit from this (and they inherit the build flags).

*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"
Expand Down
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down