Skip to content

Commit b012f68

Browse files
authored
[3.13] gh-145801: Use gcc -fprofile-update=atomic for PGO builds (#145802) (#145893)
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. (cherry picked from commit 08a018e)
1 parent 3ae8cc8 commit b012f68

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-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: 38 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
@@ -2137,7 +2137,10 @@ case "$CC_BASENAME" in
21372137
fi
21382138
;;
21392139
*)
2140-
PGO_PROF_GEN_FLAG="-fprofile-generate"
2140+
AX_CHECK_COMPILE_FLAG(
2141+
[-fprofile-update=atomic],
2142+
[PGO_PROF_GEN_FLAG="-fprofile-generate -fprofile-update=atomic"],
2143+
[PGO_PROF_GEN_FLAG="-fprofile-generate"])
21412144
PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"
21422145
LLVM_PROF_MERGER="true"
21432146
LLVM_PROF_FILE=""

0 commit comments

Comments
 (0)