From b8038fd7e1ac941f294bcfb1c9f7c79d415a20ff Mon Sep 17 00:00:00 2001 From: 12101111 Date: Sun, 5 Oct 2025 22:38:03 +0800 Subject: [PATCH] fix building with dynamically linked musl --- crash-handler/src/unix/pthread_interpose.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crash-handler/src/unix/pthread_interpose.rs b/crash-handler/src/unix/pthread_interpose.rs index 171e847..8dc9f86 100644 --- a/crash-handler/src/unix/pthread_interpose.rs +++ b/crash-handler/src/unix/pthread_interpose.rs @@ -28,7 +28,7 @@ struct PthreadCreateParams { /// in the `pthread_key` destructor static mut THREAD_DESTRUCTOR_KEY: libc::pthread_key_t = 0; -#[cfg(all(target_env = "musl", not(miri)))] +#[cfg(all(target_env = "musl", target_feature = "crt-static", not(miri)))] unsafe extern "C" { /// This is the weak alias for `pthread_create`. We declare this so we can /// use its address when targeting musl, as we can't lookup the actual @@ -66,7 +66,7 @@ pub extern "C" fn pthread_create( // used to uninstall and unmap the alternate stack INIT.call_once(|| unsafe { cfg_if::cfg_if! { - if #[cfg(target_env = "musl")] { + if #[cfg(all(target_env = "musl", target_feature = "crt-static"))] { let ptr = __pthread_create as *mut c_void; } else { const RTLD_NEXT: *mut c_void = -1isize as *mut c_void;