Skip to content

Commit fdac511

Browse files
vstinnermiss-islington
authored andcommitted
gh-145801: Use gcc -fprofile-update=atomic for PGO builds (GH-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. (cherry picked from commit 08a018e) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent cedff2d commit fdac511

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
@@ -2072,7 +2072,10 @@ case "$ac_cv_cc_name" in
20722072
fi
20732073
;;
20742074
gcc)
2075-
PGO_PROF_GEN_FLAG="-fprofile-generate"
2075+
AX_CHECK_COMPILE_FLAG(
2076+
[-fprofile-update=atomic],
2077+
[PGO_PROF_GEN_FLAG="-fprofile-generate -fprofile-update=atomic"],
2078+
[PGO_PROF_GEN_FLAG="-fprofile-generate"])
20762079
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
20772080
LLVM_PROF_MERGER="true"
20782081
LLVM_PROF_FILE=""

0 commit comments

Comments
 (0)