From d6da34f22179779d057c9a4c64d4dfab73a85b4d Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Thu, 9 Oct 2025 12:33:53 +0200 Subject: [PATCH] gh-101525: Add GCC's LTO-generated function clones, with computed gotos, to BOLT skip list When building with --with-lto, --enable-bolt and --enable-shared, GCC creates optimized function clones with the suffix .lto_priv.0. The sre_ucs*_match functions use computed gotos, which BOLT cannot optimize, so their .lto_priv.0 clones must be skipped as well. Static builds and Clang's LTO implementation are not affected. --- configure | 2 +- configure.ac | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d80340e3015bee..55bbb7731045bd 100755 --- a/configure +++ b/configure @@ -9396,7 +9396,7 @@ fi printf %s "checking BOLT_COMMON_FLAGS... " >&6; } if test -z "${BOLT_COMMON_FLAGS}" then - BOLT_COMMON_FLAGS=" -update-debug-sections -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1 " + BOLT_COMMON_FLAGS=" -update-debug-sections -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1,sre_ucs1_match.lto_priv.0/1,sre_ucs2_match.lto_priv.0/1,sre_ucs4_match.lto_priv.0/1 " fi diff --git a/configure.ac b/configure.ac index 1e0c0f71b7c281..410a3336cb2d09 100644 --- a/configure.ac +++ b/configure.ac @@ -2162,7 +2162,8 @@ then dnl At least LLVM 19.x doesn't support computed gotos in PIC compiled code. dnl Exclude functions containing computed gotos. dnl TODO this may be fixed in LLVM 20.x via https://github.com/llvm/llvm-project/pull/120267. - [-skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1] + dnl GCC's LTO creates .lto_priv.0 clones of these functions. + [-skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1,sre_ucs1_match.lto_priv.0/1,sre_ucs2_match.lto_priv.0/1,sre_ucs4_match.lto_priv.0/1] ")] ) fi