Skip to content

Commit

Permalink
Disable has_thread_local on OpenHarmony
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Amanieu authored and yetist committed Jun 3, 2024
1 parent a61d2eb commit 54d2067
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub fn target() -> Target {
features: "+reserve-x18".into(),
mcount: "\u{1}_mcount".into(),
force_emulated_tls: true,
has_thread_local: false,
supported_sanitizers: SanitizerSet::ADDRESS
| SanitizerSet::CFI
| SanitizerSet::LEAK
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/armv7_unknown_linux_ohos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub fn target() -> Target {
crt_static_default: false,
mcount: "\u{1}mcount".into(),
force_emulated_tls: true,
has_thread_local: false,
..super::linux_musl_base::opts()
},
}
Expand Down

0 comments on commit 54d2067

Please sign in to comment.