From 64e90aab1ef3f564286c125baf1274150c27c445 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 2 Aug 2026 13:40:10 +0000 Subject: [PATCH 04/25] rustc-1.74.0: gate the pthread-parker fallback on a cfg, not the arch libdispatch exists on Mac OS X 10.6, and 10.6 runs on PowerPC - "powerpc-apple-darwin is by definition 10.4/10.5" doesn't hold, and a 10.6/ppc build wants the dispatch-based Darwin parker. Availability is a property of the deployment target, not the architecture, and std has no cfg for the OS version - so make the fallback opt-in: the std patch keys on `--cfg no_libdispatch`, and the stable-1.74.0-macos-powerpc build_std override sets it (that override targets 10.4/10.5). A 10.6+ build uses an override without the cfg and keeps the dispatch parker. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_0179wmF1vKBsFua4Wh36WFc5 --- rustc-1.74.0-src.patch | 11 ++++++----- .../stable-1.74.0-macos-powerpc/build_std.txt | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rustc-1.74.0-src.patch b/rustc-1.74.0-src.patch index 2ab41dc9..25ecc2a2 100644 --- a/rustc-1.74.0-src.patch +++ b/rustc-1.74.0-src.patch @@ -161,17 +161,18 @@ crate::sys::unix::os::set_errno(libc::ENOSYS); crate::ptr::null_mut() -# The Darwin thread parker needs libdispatch (10.6+); powerpc-apple-darwin is 10.4/10.5, so use the generic pthread parker. +# The Darwin thread parker needs libdispatch (10.6+); deployment targets older than that +# opt out via `--cfg no_libdispatch` (set in the powerpc build_std script override). --- library/std/src/sys/unix/thread_parking/mod.rs +++ library/std/src/sys/unix/thread_parking/mod.rs @@ -18,6 +18,10 @@ target_os = "watchos", target_os = "tvos", ), -+ // The Darwin parker is built on libdispatch, which is 10.6+. -+ // powerpc-apple-darwin is by definition 10.4/10.5, so it falls through -+ // to the generic pthread parker. -+ not(target_arch = "powerpc"), ++ // The Darwin parker is built on libdispatch, which is 10.6+. Deployment targets ++ // older than that set `--cfg no_libdispatch` (see the build_std script override ++ // for powerpc, which targets 10.4/10.5) to get the generic pthread parker. ++ not(no_libdispatch), not(miri), ))] { mod darwin; diff --git a/script-overrides/stable-1.74.0-macos-powerpc/build_std.txt b/script-overrides/stable-1.74.0-macos-powerpc/build_std.txt index a58d6478..7ee8fd7d 100644 --- a/script-overrides/stable-1.74.0-macos-powerpc/build_std.txt +++ b/script-overrides/stable-1.74.0-macos-powerpc/build_std.txt @@ -1,2 +1,3 @@ cargo:rustc-cfg=backtrace_in_libstd cargo:rustc-env=STD_ENV_ARCH=powerpc +cargo:rustc-cfg=no_libdispatch -- 2.43.0