From 38de7cd895bedd7ec054def00c9b383b9b3414d5 Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Mon, 7 Jun 2021 16:21:09 -0600 Subject: [PATCH 1/4] add support for clang thin lto via --with-lto=thin --- configure | 33 ++++++++++++++++++++------------- configure.ac | 31 +++++++++++++++++++------------ 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/configure b/configure index 1756d25d16fa47..84064661b120cb 100755 --- a/configure +++ b/configure @@ -1545,7 +1545,7 @@ Optional Packages: --with-trace-refs enable tracing references for debugging purpose (default is no) --with-assertions build with C assertions enabled (default is no) - --with-lto enable Link-Time-Optimization in any build (default + --with-lto[=no|thin] enable Link-Time-Optimization in any build (default is no) --with-hash-algorithm=[fnv|siphash24] select hash algorithm for use in Python/pyhash.c @@ -6585,16 +6585,23 @@ $as_echo_n "checking for --with-lto... " >&6; } # Check whether --with-lto was given. if test "${with_lto+set}" = set; then : withval=$with_lto; -if test "$withval" != no -then - Py_LTO='true' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; }; -else - Py_LTO='false' - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + LTO_ARG='' + if test "$withval" = no + then + Py_LTO='false' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; -fi + elif test "$withval" = yes + then + Py_LTO='true' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; + else + Py_LTO='true' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$withval\"" >&5 +$as_echo "\"$withval\"" >&6; }; + LTO_ARG="=$withval" + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -6732,11 +6739,11 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;} case $ac_sys_system in Darwin*) # Any changes made here should be reflected in the GCC+Darwin case below - LTOFLAGS="-flto -Wl,-export_dynamic" - LTOCFLAGS="-flto" + LTOFLAGS="-flto$LTO_ARG -Wl,-export_dynamic" + LTOCFLAGS="-flto$LTO_ARG" ;; *) - LTOFLAGS="-flto" + LTOFLAGS="-flto$LTO_ARG" ;; esac ;; diff --git a/configure.ac b/configure.ac index 2f792aa60ee40f..f6d0101c037fca 100644 --- a/configure.ac +++ b/configure.ac @@ -1360,16 +1360,23 @@ fi # Enable LTO flags AC_MSG_CHECKING(for --with-lto) -AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [enable Link-Time-Optimization in any build (default is no)]), +AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto@<:@=no|thin@:>@], [enable Link-Time-Optimization in any build (default is no)]), + [ -if test "$withval" != no -then - Py_LTO='true' - AC_MSG_RESULT(yes); -else - Py_LTO='false' - AC_MSG_RESULT(no); -fi], + LTO_ARG='' + if test "$withval" = no + then + Py_LTO='false' + AC_MSG_RESULT(no); + elif test "$withval" = yes + then + Py_LTO='true' + AC_MSG_RESULT(yes); + else + Py_LTO='true' + AC_MSG_RESULT("$withval"); + LTO_ARG="=$withval" + fi], [AC_MSG_RESULT(no)]) if test "$Py_LTO" = 'true' ; then case $CC in @@ -1405,11 +1412,11 @@ if test "$Py_LTO" = 'true' ; then case $ac_sys_system in Darwin*) # Any changes made here should be reflected in the GCC+Darwin case below - LTOFLAGS="-flto -Wl,-export_dynamic" - LTOCFLAGS="-flto" + LTOFLAGS="-flto$LTO_ARG -Wl,-export_dynamic" + LTOCFLAGS="-flto$LTO_ARG" ;; *) - LTOFLAGS="-flto" + LTOFLAGS="-flto$LTO_ARG" ;; esac ;; From 5a36cd4aaaf15e6fa568d08eea01502a2cbe018a Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 18 Jul 2021 05:35:33 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst diff --git a/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst b/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst new file mode 100644 index 00000000000000..81bf623fbf57aa --- /dev/null +++ b/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst @@ -0,0 +1 @@ +Add support for building with clang's "thin" link time optimization using `--with-lto=thin`. \ No newline at end of file From 625321e164bda2c4cc6252d540b9e286a8d5ab21 Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Sat, 17 Jul 2021 23:41:01 -0600 Subject: [PATCH 3/4] blurb fixup --- .../next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst b/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst index 81bf623fbf57aa..7dcc09f8566808 100644 --- a/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst +++ b/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst @@ -1 +1 @@ -Add support for building with clang's "thin" link time optimization using `--with-lto=thin`. \ No newline at end of file +Add support for building with clang's "thin" link time optimization using ``--with-lto=thin``. From 9405a02f4c50e235d01d942bd91eb4bea2a86e96 Mon Sep 17 00:00:00 2001 From: Brett Holman Date: Sat, 17 Jul 2021 23:46:38 -0600 Subject: [PATCH 4/4] Fix blurb file name and rst format. --- ...340.1xHAZP.rst => 2021-07-18-05-35-33.bpo-44340.1xHAZP.rst} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename Misc/NEWS.d/next/Build/{2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst => 2021-07-18-05-35-33.bpo-44340.1xHAZP.rst} (67%) diff --git a/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst b/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-44340.1xHAZP.rst similarity index 67% rename from Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst rename to Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-44340.1xHAZP.rst index 7dcc09f8566808..11054463723372 100644 --- a/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-bpo-44340.1xHAZP.rst +++ b/Misc/NEWS.d/next/Build/2021-07-18-05-35-33.bpo-44340.1xHAZP.rst @@ -1 +1,2 @@ -Add support for building with clang's "thin" link time optimization using ``--with-lto=thin``. +Add support for building with clang's "thin" link time optimization using +``--with-lto=thin``.