https://github.com/python/cpython/pull/140422

--- configure.orig	2025-10-14 21:46:08
+++ configure	2025-10-21 21:52:29
@@ -13836,7 +13878,15 @@
   aarch64-linux-gnu) :
     perf_trampoline=yes ;; #(
   darwin) :
-    perf_trampoline=yes ;; #(
+    case $host_cpu in #(
+  p*pc*) :
+    perf_trampoline=no ;; #(
+  *) :
+    perf_trampoline=yes
+                 ;; #(
+  *) :
+     ;;
+esac ;; #(
   *) :
     perf_trampoline=no
  ;;
--- Python/perf_trampoline.c.orig	2025-10-14 21:46:08
+++ Python/perf_trampoline.c	2025-10-21 15:33:32
@@ -145,6 +145,9 @@ any DWARF information available for them).
 #include <unistd.h>               // sysconf()
 #include <sys/time.h>           // gettimeofday()
 
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#  define MAP_ANONYMOUS MAP_ANON
+#endif
 
 #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
 #define PY_HAVE_INVALIDATE_ICACHE
--- Python/perf_jit_trampoline.c.orig	2025-10-14 21:46:08
+++ Python/perf_jit_trampoline.c	2025-10-21 21:13:23
@@ -78,7 +78,18 @@
 #include <sys/time.h>             // Time functions (gettimeofday)
 #if defined(__linux__)
 #  include <sys/syscall.h>        // System call interface
+#endif
+
+#if defined(__APPLE__)
+#include <AvailabilityMacros.h>
+#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) \
+        && (!defined(MAC_OS_X_VERSION_10_12) || \
+        MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12)
+#define PY_PERF_JIT_USE_MACH_TIME
+#include <stdint.h>
+#include <mach/mach_time.h>       // mach_absolute_time
 #endif
+#endif
 
 // =============================================================================
 //                           CONSTANTS AND CONFIGURATION
@@ -284,6 +295,12 @@ static int64_t get_current_monotonic_ticks(void) {
  * Returns: Current monotonic time in nanoseconds since an arbitrary epoch
  */
 static int64_t get_current_monotonic_ticks(void) {
+#if defined(__APPLE__) && defined(PY_PERF_JIT_USE_MACH_TIME)
+    /* clock_gettime() is not available before macOS 10.12.
+     * mach_absolute_time() should always return a value in
+     * nanoseconds on x86. */
+    return (int64_t)mach_absolute_time();
+#else
     struct timespec ts;
     if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
         Py_UNREACHABLE();  // Should never fail on supported systems
@@ -295,6 +312,7 @@ static int64_t get_current_monotonic_ticks(void) {
     result *= nanoseconds_per_second;
     result += ts.tv_nsec;
     return result;
+#endif
 }
 
 /*
