Skip to content

Commit 29f17a4

Browse files
gh-96761: Fix build process of the clang compiler for _bootstrap_python (gh-96945)
Co-authored-by: Matthias Goergens <[email protected]> (cherry picked from commit 83d84e6) Co-authored-by: Dong-hee Na <[email protected]>
1 parent 9eb1e6c commit 29f17a4

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix the build process of clang compiler for :program:`_bootstrap_python` if
2+
LTO optimization is applied. Patch by Matthias Görgens and Dong-hee Na.

configure

+37-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+4-2
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,7 @@ then
17821782
fi
17831783
AC_MSG_RESULT($PROFILE_TASK)
17841784

1785-
# Make llvm-relatec checks work on systems where llvm tools are not installed with their
1785+
# Make llvm-related checks work on systems where llvm tools are not installed with their
17861786
# normal names in the default $PATH (ie: Ubuntu). They exist under the
17871787
# non-suffixed name in their versioned llvm directory.
17881788

@@ -1836,8 +1836,10 @@ esac
18361836
if test "$Py_LTO" = 'true' ; then
18371837
case $CC in
18381838
*clang*)
1839-
dnl flag to disable lto during linking
18401839
LDFLAGS_NOLTO="-fno-lto"
1840+
dnl Clang linker requires -flto in order to link objects with LTO information.
1841+
dnl Thin LTO is faster and works for object files with full LTO information, too.
1842+
AX_CHECK_COMPILE_FLAG([-flto=thin],[LDFLAGS_NOLTO="-flto=thin"],[LDFLAGS_NOLTO="-flto"])
18411843
AC_SUBST(LLVM_AR)
18421844
AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
18431845
AC_SUBST(LLVM_AR_FOUND)

0 commit comments

Comments
 (0)