mirror of
https://github.com/python/cpython.git
synced 2026-05-31 06:40:53 +00:00
gh-145801: Use gcc -fprofile-update=atomic for PGO builds (#145802)
When Python build is optimized with GCC using PGO, use -fprofile-update=atomic option to use atomic operations when updating profile information. This option reduces the risk of gcov Data Files (.gcda) corruption which can cause random GCC crashes.
This commit is contained in:
parent
f105265538
commit
08a018ebe0
3 changed files with 49 additions and 2 deletions
|
|
@ -0,0 +1,4 @@
|
|||
When Python build is optimized with GCC using PGO, use
|
||||
``-fprofile-update=atomic`` option to use atomic operations when updating
|
||||
profile information. This option reduces the risk of gcov Data Files (.gcda)
|
||||
corruption which can cause random GCC crashes. Patch by Victor Stinner.
|
||||
42
configure
generated
vendored
42
configure
generated
vendored
|
|
@ -9083,7 +9083,47 @@ case "$ac_cv_cc_name" in
|
|||
fi
|
||||
;;
|
||||
gcc)
|
||||
PGO_PROF_GEN_FLAG="-fprofile-generate"
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fprofile-update=atomic" >&5
|
||||
printf %s "checking whether C compiler accepts -fprofile-update=atomic... " >&6; }
|
||||
if test ${ax_cv_check_cflags___fprofile_update_atomic+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else case e in #(
|
||||
e)
|
||||
ax_check_save_flags=$CFLAGS
|
||||
CFLAGS="$CFLAGS -fprofile-update=atomic"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
ax_cv_check_cflags___fprofile_update_atomic=yes
|
||||
else case e in #(
|
||||
e) ax_cv_check_cflags___fprofile_update_atomic=no ;;
|
||||
esac
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
CFLAGS=$ax_check_save_flags ;;
|
||||
esac
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fprofile_update_atomic" >&5
|
||||
printf "%s\n" "$ax_cv_check_cflags___fprofile_update_atomic" >&6; }
|
||||
if test "x$ax_cv_check_cflags___fprofile_update_atomic" = xyes
|
||||
then :
|
||||
PGO_PROF_GEN_FLAG="-fprofile-generate -fprofile-update=atomic"
|
||||
else case e in #(
|
||||
e) PGO_PROF_GEN_FLAG="-fprofile-generate" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
|
||||
LLVM_PROF_MERGER="true"
|
||||
LLVM_PROF_FILE=""
|
||||
|
|
|
|||
|
|
@ -2084,7 +2084,10 @@ case "$ac_cv_cc_name" in
|
|||
fi
|
||||
;;
|
||||
gcc)
|
||||
PGO_PROF_GEN_FLAG="-fprofile-generate"
|
||||
AX_CHECK_COMPILE_FLAG(
|
||||
[-fprofile-update=atomic],
|
||||
[PGO_PROF_GEN_FLAG="-fprofile-generate -fprofile-update=atomic"],
|
||||
[PGO_PROF_GEN_FLAG="-fprofile-generate"])
|
||||
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
|
||||
LLVM_PROF_MERGER="true"
|
||||
LLVM_PROF_FILE=""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue