Skip to content

Commit 83d84e6

Browse files
pythongh-96761: Fix build process of the clang compiler for _bootstrap_python (pythongh-96945)
Co-authored-by: Matthias Goergens <[email protected]>
1 parent 9d432b4 commit 83d84e6

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
@@ -1774,7 +1774,7 @@ then
17741774
fi
17751775
AC_MSG_RESULT($PROFILE_TASK)
17761776

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

@@ -1828,8 +1828,10 @@ esac
18281828
if test "$Py_LTO" = 'true' ; then
18291829
case $CC in
18301830
*clang*)
1831-
dnl flag to disable lto during linking
18321831
LDFLAGS_NOLTO="-fno-lto"
1832+
dnl Clang linker requires -flto in order to link objects with LTO information.
1833+
dnl Thin LTO is faster and works for object files with full LTO information, too.
1834+
AX_CHECK_COMPILE_FLAG([-flto=thin],[LDFLAGS_NOLTO="-flto=thin"],[LDFLAGS_NOLTO="-flto"])
18331835
AC_SUBST(LLVM_AR)
18341836
AC_PATH_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
18351837
AC_SUBST(LLVM_AR_FOUND)

0 commit comments

Comments
 (0)