Skip to content

Commit 823c1a8

Browse files
committed
Address review feedback.
Use "versionchanged: next". Use WITH_SAVE_ENV macro.
1 parent f74b453 commit 823c1a8

3 files changed

Lines changed: 46 additions & 20 deletions

File tree

‎Doc/using/configure.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ also be used to improve performance.
744744
than macOS, configure tries ``-fuse-ld=lld`` if the configured linker cannot
745745
link a Clang LTO program.
746746

747-
.. versionchanged:: 3.16
747+
.. versionchanged:: next
748748
Fall back to ``lld`` when the configured linker cannot link Clang LTO
749749
programs.
750750

‎configure‎

Lines changed: 34 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎configure.ac‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,16 +2223,19 @@ if test "$Py_LTO" = 'true' ; then
22232223
LTOCFLAGS="$LTOFLAGS"
22242224
# GNU ld needs LLVMgold.so for Clang LTO. If the configured linker
22252225
# cannot link LTO objects, try lld, which does not need that plugin.
2226-
save_LDFLAGS="$LDFLAGS"
2227-
LDFLAGS="$LDFLAGS $LDFLAGS_NODIST $LTOFLAGS"
2228-
AC_MSG_CHECKING([whether Clang LTO works with the configured linker])
2229-
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [clang_lto_link=yes], [clang_lto_link=no])
2230-
AC_MSG_RESULT([$clang_lto_link])
2231-
if test "$clang_lto_link" = no; then
2232-
LDFLAGS="$LDFLAGS -fuse-ld=lld"
2233-
AC_MSG_CHECKING([whether Clang LTO works with lld])
2226+
WITH_SAVE_ENV([
2227+
LDFLAGS="$LDFLAGS $LDFLAGS_NODIST $LTOFLAGS"
2228+
AC_MSG_CHECKING([whether Clang LTO works with the configured linker])
22342229
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [clang_lto_link=yes], [clang_lto_link=no])
22352230
AC_MSG_RESULT([$clang_lto_link])
2231+
])
2232+
if test "$clang_lto_link" = no; then
2233+
WITH_SAVE_ENV([
2234+
LDFLAGS="$LDFLAGS -fuse-ld=lld"
2235+
AC_MSG_CHECKING([whether Clang LTO works with lld])
2236+
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [clang_lto_link=yes], [clang_lto_link=no])
2237+
AC_MSG_RESULT([$clang_lto_link])
2238+
])
22362239
if test "$clang_lto_link" = no; then
22372240
AC_MSG_ERROR([m4_normalize([
22382241
Clang LTO requires a working LTO-aware linker.
@@ -2243,7 +2246,6 @@ if test "$Py_LTO" = 'true' ; then
22432246
LTOFLAGS="$LTOFLAGS -fuse-ld=lld"
22442247
LDFLAGS_NOLTO="$LDFLAGS_NOLTO -fuse-ld=lld"
22452248
fi
2246-
LDFLAGS="$save_LDFLAGS"
22472249
;;
22482250
esac
22492251
;;

0 commit comments

Comments
 (0)