Skip to content

Commit

Permalink
linux-musl: Add patch to fix build error on hexagon
Browse files Browse the repository at this point in the history
rust-lang/rust#121666 caused regression on hexagon linux-musl:

```
 ld.lld: error: undefined symbol: pthread_getname_np
```
  • Loading branch information
taiki-e committed Mar 3, 2024
1 parent e8ba521 commit f4527d8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docker/test-base/patches/std+hexagon-unknown-linux-musl.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/src/sys/pal/unix/thread.rs b/src/sys/pal/unix/thread.rs
index 2af6382..acf3ecb 100644
--- a/src/sys/pal/unix/thread.rs
+++ b/src/sys/pal/unix/thread.rs
@@ -225,7 +225,9 @@ pub fn set_name(_name: &CStr) {
// Newlib, Emscripten, and VxWorks have no way to set a thread name.
}

- #[cfg(target_os = "linux")]
+ // Qualcomm fork of musl doesn't have pthread_getname_np.
+ // https://github.com/quic/musl/blob/7243e0d3a9d7e0f08d21fc194a05749e0bb26725/include/pthread.h
+ #[cfg(all(target_os = "linux", not(target_arch = "hexagon")))]
pub fn get_name() -> Option<CString> {
const TASK_COMM_LEN: usize = 16;
let mut name = vec![0u8; TASK_COMM_LEN];
@@ -253,7 +255,7 @@ pub fn get_name() -> Option<CString> {
}

#[cfg(not(any(
- target_os = "linux",
+ all(target_os = "linux", not(target_arch = "hexagon")),
target_os = "macos",
target_os = "ios",
target_os = "tvos",

0 comments on commit f4527d8

Please sign in to comment.