Skip to content

Commit 14c7f71

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 262b679 commit 14c7f71

3 files changed

Lines changed: 16 additions & 21 deletions

File tree

README

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ You should do a "make clean" at the toplevel first.)
4848

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

5454

5555
Profile Guided Optimization
@@ -79,9 +79,10 @@ that is optimized and suitable for distribution or production installation.
7979
Link Time Optimization
8080
----------------------
8181

82-
LTO takes advantages of recent compiler toolchains ability to optimize across
83-
the otherwise arbitrary .o file boundary when building final executables or
84-
shared libraries for additional performance gains.
82+
Enabled via configure's --with-lto flag. LTO takes advantages of recent
83+
compiler toolchains ability to optimize across the otherwise arbitrary .o file
84+
boundary when building final executables or shared libraries for additional
85+
performance gains.
8586

8687

8788
What's New

configure

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ Optional Packages:
15091509
compiler
15101510
--with-suffix=.exe set executable suffix
15111511
--with-pydebug build with Py_DEBUG defined
1512-
--with-optimizations Enable all optimizations when available (LTO, PGO,
1512+
--with-optimizations Enable expensive optimizations (PGO, maybe LTO,
15131513
etc). Disabled by default.
15141514
--with-lto Enable Link Time Optimization in PGO builds.
15151515
Disabled by default.
@@ -6565,13 +6565,10 @@ $as_echo "no" >&6; }
65656565
fi
65666566

65676567
if test "$Py_OPT" = 'true' ; then
6568-
Py_LTO='true'
6569-
case $ac_sys_system in
6570-
Darwin*)
6571-
# At least on macOS El Capitan, LTO does not work with PGO.
6572-
Py_LTO='false'
6573-
;;
6574-
esac
6568+
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
6569+
# compile working code using it and both test_distutils and test_gdb are
6570+
# broken when you do managed to get a toolchain that works with it. People
6571+
# who want LTO need to use --with-lto themselves.
65756572
DEF_MAKE_ALL_RULE="profile-opt"
65766573
REQUIRE_PGO="yes"
65776574
DEF_MAKE_RULE="build_all"

configure.ac

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ AC_SUBST(DEF_MAKE_ALL_RULE)
12351235
AC_SUBST(DEF_MAKE_RULE)
12361236
Py_OPT='false'
12371237
AC_MSG_CHECKING(for --with-optimizations)
1238-
AC_ARG_WITH(optimizations, AS_HELP_STRING([--with-optimizations], [Enable all optimizations when available (LTO, PGO, etc). Disabled by default.]),
1238+
AC_ARG_WITH(optimizations, AS_HELP_STRING([--with-optimizations], [Enable expensive optimizations (PGO, maybe LTO, etc). Disabled by default.]),
12391239
[
12401240
if test "$withval" != no
12411241
then
@@ -1247,13 +1247,10 @@ else
12471247
fi],
12481248
[AC_MSG_RESULT(no)])
12491249
if test "$Py_OPT" = 'true' ; then
1250-
Py_LTO='true'
1251-
case $ac_sys_system in
1252-
Darwin*)
1253-
# At least on macOS El Capitan, LTO does not work with PGO.
1254-
Py_LTO='false'
1255-
;;
1256-
esac
1250+
# Intentionally not forcing Py_LTO='true' here. Too many toolchains do not
1251+
# compile working code using it and both test_distutils and test_gdb are
1252+
# broken when you do managed to get a toolchain that works with it. People
1253+
# who want LTO need to use --with-lto themselves.
12571254
DEF_MAKE_ALL_RULE="profile-opt"
12581255
REQUIRE_PGO="yes"
12591256
DEF_MAKE_RULE="build_all"

0 commit comments

Comments
 (0)