diff options
author | Dong-hee Na <donghee.na@python.org> | 2022-09-16 10:40:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-16 10:40:05 (GMT) |
commit | e47b96c44f7b48a1e95de24f38f6e3de879b4d61 (patch) | |
tree | 56cd8f495c33eccdf04681132d1d84009dd5434c /configure | |
parent | 16c33a9676e2f3ef330d09f2ab515c56636fa09f (diff) | |
download | cpython-e47b96c44f7b48a1e95de24f38f6e3de879b4d61.zip cpython-e47b96c44f7b48a1e95de24f38f6e3de879b4d61.tar.gz cpython-e47b96c44f7b48a1e95de24f38f6e3de879b4d61.tar.bz2 |
gh-89536: Use ThinLTO policy if possible (gh-96766)
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 82 |
1 files changed, 79 insertions, 3 deletions
@@ -7837,8 +7837,49 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;} # Any changes made here should be reflected in the GCC+Darwin case below if test $Py_LTO_POLICY = default then - LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto" - LTOCFLAGS="-flto" + # Check that ThinLTO is accepted. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -flto=thin" >&5 +$as_echo_n "checking whether C compiler accepts -flto=thin... " >&6; } +if ${ax_cv_check_cflags___flto_thin+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -flto=thin" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___flto_thin=yes +else + ax_cv_check_cflags___flto_thin=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___flto_thin" >&5 +$as_echo "$ax_cv_check_cflags___flto_thin" >&6; } +if test "x$ax_cv_check_cflags___flto_thin" = xyes; then : + + LTOFLAGS="-flto=thin -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto" + LTOCFLAGS="-flto=thin" + +else + + LTOFLAGS="-flto -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto" + LTOCFLAGS="-flto" + + +fi + else LTOFLAGS="-flto=${Py_LTO_POLICY} -Wl,-export_dynamic -Wl,-object_path_lto,\"\$@\".lto" LTOCFLAGS="-flto=${Py_LTO_POLICY}" @@ -7847,7 +7888,42 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;} *) if test $Py_LTO_POLICY = default then - LTOFLAGS="-flto" + # Check that ThinLTO is accepted + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -flto=thin" >&5 +$as_echo_n "checking whether C compiler accepts -flto=thin... " >&6; } +if ${ax_cv_check_cflags___flto_thin+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -flto=thin" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_check_cflags___flto_thin=yes +else + ax_cv_check_cflags___flto_thin=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___flto_thin" >&5 +$as_echo "$ax_cv_check_cflags___flto_thin" >&6; } +if test "x$ax_cv_check_cflags___flto_thin" = xyes; then : + LTOFLAGS="-flto=thin" +else + LTOFLAGS="-flto" +fi + else LTOFLAGS="-flto=${Py_LTO_POLICY}" fi |