]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128472: Add `-skip-funcs` to BOLT options to fix computed goto errors (gh-128511)
authorZanie Blue <contact@zanie.dev>
Tue, 7 Jan 2025 03:02:55 +0000 (21:02 -0600)
committerGitHub <noreply@github.com>
Tue, 7 Jan 2025 03:02:55 +0000 (12:02 +0900)
* Add `-skip-funcs` to BOLT options to fix computed goto errors

Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>
* NEWS

---------

Co-authored-by: Gregory Szorc <gregory.szorc@gmail.com>
Misc/NEWS.d/next/Build/2025-01-04-22-39-10.gh-issue-128472.Wt5E6M.rst [new file with mode: 0644]
configure
configure.ac

diff --git a/Misc/NEWS.d/next/Build/2025-01-04-22-39-10.gh-issue-128472.Wt5E6M.rst b/Misc/NEWS.d/next/Build/2025-01-04-22-39-10.gh-issue-128472.Wt5E6M.rst
new file mode 100644 (file)
index 0000000..c6233e1
--- /dev/null
@@ -0,0 +1,2 @@
+Skip BOLT optimization of functions using computed gotos, fixing errors on
+build with LLVM 19.
index 9024d22d4df5cd80872c96da61687bb5831e1ccd..08c10ff52ce8d544b4c6ae294235a3e8991d9cc0 100755 (executable)
--- a/configure
+++ b/configure
@@ -9398,7 +9398,7 @@ fi
 printf %s "checking BOLT_COMMON_FLAGS... " >&6; }
 if test -z "${BOLT_COMMON_FLAGS}"
 then
-  BOLT_COMMON_FLAGS=-update-debug-sections
+  BOLT_COMMON_FLAGS=" -update-debug-sections -skip-funcs=_PyEval_EvalFrameDefault,sre_ucs1_match/1,sre_ucs2_match/1,sre_ucs4_match/1 "
 
 fi
 
index 86775e03e73d5a06a8154912f22db360110e693a..fb1dd77be167b9d493aa6cec0e8a2f0a4f60e794 100644 (file)
@@ -2170,7 +2170,14 @@ if test -z "${BOLT_COMMON_FLAGS}"
 then
   AS_VAR_SET(
     [BOLT_COMMON_FLAGS],
-    [-update-debug-sections]
+    [m4_normalize("
+      [-update-debug-sections]
+
+      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]
+    ")]
   )
 fi