Skip to content

Commit 9cbfa79

Browse files
committed
issue28032: never imply --with-lto as part of --with-optimizations.
Too many build tool chains do not properly support it, including building and linking an executable fine that simply segfaults when you try to run it (such as debian jessie 8.5's gcc 4.9). On others where it does appear to build (ubuntu 16.04's gcc 5.4) there are still test_distutils and test_gdb failures to deal with. We're not going to spend time attempting to maintain a complicated white list of what does and doesn't work in our configure.ac file.
1 parent a661009 commit 9cbfa79

3 files changed

Lines changed: 16 additions & 19 deletions

File tree

README

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ top level directory.
175175

176176
To get an optimized build of Python, "configure --with-optimizations" before
177177
you run make. This sets the default make targets up to enable Profile Guided
178-
Optimization (PGO) and Link Time Optimization (LTO) on most platforms.
179-
For more details, see the sections bellow.
178+
Optimization (PGO) and may be used to auto-enable Link Time Optimization (LTO)
179+
on some platforms. For more details, see the sections bellow.
180180

181181
Once you have built a Python interpreter, see the subsections below on
182182
testing and installation. If you run into trouble, see the next
@@ -217,9 +217,10 @@ that is optimized and suitable for distribution or production installation.
217217
Link Time Optimization
218218
----------------------
219219

220-
LTO takes advantages of recent compiler toolchains ability to optimize across
221-
the otherwise arbitrary .o file boundary when building final executables or
222-
shared libraries for additional performance gains.
220+
Enabled via configure's --with-lto flag. LTO takes advantages of recent
221+
compiler toolchains ability to optimize across the otherwise arbitrary .o file
222+
boundary when building final executables or shared libraries for additional
223+
performance gains.
223224

224225

225226
Troubleshooting

configure

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ Optional Packages:
15001500
compiler
15011501
--with-suffix=.exe set executable suffix
15021502
--with-pydebug build with Py_DEBUG defined
1503-
--with-optimizations Enable all optimizations when available (LTO, PGO,
1503+
--with-optimizations Enable expensive optimizations (PGO, maybe LTO,
15041504
etc). Disabled by default.
15051505
--with-lto Enable Link Time Optimization in PGO builds.
15061506
Disabled by default.
@@ -6423,12 +6423,10 @@ $as_echo "no" >&6; }
64236423
fi
64246424
64256425
if test "$Py_OPT" = 'true' ; then
6426-
case $ac_sys_system in
6427-
Darwin*)
6428-
# At least on macOS El Capitan, LTO does not work with PGO.
6429-
Py_LTO='false'
6430-
;;
6431-
esac
6426+
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
6427+
# compile working code using it and both test_distutils and test_gdb are
6428+
# broken when you do managed to get a toolchain that works with it. People
6429+
# who want LTO need to use --with-lto themselves.
64326430
Py_LTO='true'
64336431
DEF_MAKE_ALL_RULE="profile-opt"
64346432
REQUIRE_PGO="yes"

configure.ac

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ AC_SUBST(DEF_MAKE_ALL_RULE)
13851385
AC_SUBST(DEF_MAKE_RULE)
13861386
Py_OPT='false'
13871387
AC_MSG_CHECKING(for --with-optimizations)
1388-
AC_ARG_WITH(optimizations, AS_HELP_STRING([--with-optimizations], [Enable all optimizations when available (LTO, PGO, etc). Disabled by default.]),
1388+
AC_ARG_WITH(optimizations, AS_HELP_STRING([--with-optimizations], [Enable expensive optimizations (PGO, maybe LTO, etc). Disabled by default.]),
13891389
[
13901390
if test "$withval" != no
13911391
then
@@ -1397,12 +1397,10 @@ else
13971397
fi],
13981398
[AC_MSG_RESULT(no)])
13991399
if test "$Py_OPT" = 'true' ; then
1400-
case $ac_sys_system in
1401-
Darwin*)
1402-
# At least on macOS El Capitan, LTO does not work with PGO.
1403-
Py_LTO='false'
1404-
;;
1405-
esac
1400+
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
1401+
# compile working code using it and both test_distutils and test_gdb are
1402+
# broken when you do managed to get a toolchain that works with it. People
1403+
# who want LTO need to use --with-lto themselves.
14061404
Py_LTO='true'
14071405
DEF_MAKE_ALL_RULE="profile-opt"
14081406
REQUIRE_PGO="yes"

0 commit comments

Comments
 (0)