diff --git a/configure b/configure index b2024bab2fb065..7d8772585f87d9 100755 --- a/configure +++ b/configure @@ -7640,7 +7640,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PROFILE_TASK" >&5 $as_echo "$PROFILE_TASK" >&6; } -# Make llvm-relatec checks work on systems where llvm tools are not installed with their +# Make llvm-related checks work on systems where llvm tools are not installed with their # normal names in the default $PATH (ie: Ubuntu). They exist under the # non-suffixed name in their versioned llvm directory. @@ -7705,7 +7705,7 @@ fi if test "$Py_LTO" = 'true' ; then case $CC in *clang*) - LDFLAGS_NOLTO="-fno-lto" + LDFLAGS_NOLTO="-flto=${Py_LTO_POLICY}" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}llvm-ar", so it can be a program name with args. diff --git a/configure.ac b/configure.ac index a61adcc817e82f..27f872985d182c 100644 --- a/configure.ac +++ b/configure.ac @@ -1774,7 +1774,7 @@ then fi AC_MSG_RESULT($PROFILE_TASK) -# Make llvm-relatec checks work on systems where llvm tools are not installed with their +# Make llvm-related checks work on systems where llvm tools are not installed with their # normal names in the default $PATH (ie: Ubuntu). They exist under the # non-suffixed name in their versioned llvm directory. @@ -1828,8 +1828,9 @@ esac if test "$Py_LTO" = 'true' ; then case $CC in *clang*) - dnl flag to disable lto during linking - LDFLAGS_NOLTO="-fno-lto" + dnl Clang linker requires -flto in order to link objects with LTO information. + dnl Thin LTO is faster and works for object files with full LTO information, too. + AX_CHECK_COMPILE_FLAG([-flto=thin],[LDFLAGS_NOLTO="-flto=thin"],[LDFLAGS_NOLTO="-flto"]) AC_SUBST(LLVM_AR) AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path}) AC_SUBST(LLVM_AR_FOUND)