Skip to content

Commit 08a018e

Browse files
authored
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.
1 parent f105265 commit 08a018e

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
When Python build is optimized with GCC using PGO, use
2+
``-fprofile-update=atomic`` option to use atomic operations when updating
3+
profile information. This option reduces the risk of gcov Data Files (.gcda)
4+
corruption which can cause random GCC crashes. Patch by Victor Stinner.

configure

Lines changed: 41 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,7 +2084,10 @@ case "$ac_cv_cc_name" in
20842084
fi
20852085
;;
20862086
gcc)
2087-
PGO_PROF_GEN_FLAG="-fprofile-generate"
2087+
AX_CHECK_COMPILE_FLAG(
2088+
[-fprofile-update=atomic],
2089+
[PGO_PROF_GEN_FLAG="-fprofile-generate -fprofile-update=atomic"],
2090+
[PGO_PROF_GEN_FLAG="-fprofile-generate"])
20882091
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
20892092
LLVM_PROF_MERGER="true"
20902093
LLVM_PROF_FILE=""

0 commit comments

Comments
 (0)