Skip to content

Commit 836504e

Browse files
authored
Rollup merge of #109922 - Amanieu:ohos-no_thread_local, r=wesleywiser
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.
2 parents 4b8725b + 69e3f7a commit 836504e

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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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)