Skip to content

Commit 69e3f7a

Browse files
committed
Disable has_thread_local on OpenHarmony
OpenHarmony uses emulated TLS, which doesn't link properly when using thread-local variables across crate boundaries with `-C prefer-dynamic`. This PR makes thread_local! use pthreads directly instead.
1 parent 932c173 commit 69e3f7a

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

compiler/rustc_target/src/spec/aarch64_unknown_linux_ohos.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub fn target() -> Target {
1818
features: "+reserve-x18".into(),
1919
mcount: "\u{1}_mcount".into(),
2020
force_emulated_tls: true,
21+
has_thread_local: false,
2122
supported_sanitizers: SanitizerSet::ADDRESS
2223
| SanitizerSet::CFI
2324
| SanitizerSet::LEAK

compiler/rustc_target/src/spec/armv7_unknown_linux_ohos.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn target() -> Target {
2121
crt_static_default: false,
2222
mcount: "\u{1}mcount".into(),
2323
force_emulated_tls: true,
24+
has_thread_local: false,
2425
..super::linux_musl_base::opts()
2526
},
2627
}

0 commit comments

Comments
 (0)