Skip to content

Commit

Permalink
rust178: turn off thread local storage for NetBSD/aarch64*.
Browse files Browse the repository at this point in the history
NetBSD aarch64 has a bug in the thread-local storage implementation,
ref. http://gnats.netbsd.org/58154, and this is responsible for the
build misery experienced earlier, ref.
rust-lang/rust#123551
Therefore: turn it off for now on arm64.

Ideally one could check whether the specific OS version has the fix
or not, but e.g. __NetBSD_Version__ isn't easily available here
that I know, and this goes against the pattern that OS version
should not matter as long as it's >= supported version.
So until the fix for NetBSD PR#58154 has propagated to NetBSD
releases, and the old ones are no longer supported for pkgsrc
(which is going to take a while), this is what we do.
  • Loading branch information
he32 committed Jul 30, 2024
1 parent 7a18e1f commit 375fa82
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rust178/distinfo
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ SHA1 (patch-compiler_rustc__codegen__ssa_src_back_linker.rs) = 6c8f8bbacc544b63b
SHA1 (patch-compiler_rustc__llvm_build.rs) = a4a66d449fc9eb99d648d02a041778a68f4f7ce8
SHA1 (patch-compiler_rustc__target_src_spec_base_netbsd.rs) = 7d910631f49acf2c33fdd191fd3e0f261efae234
SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = a22b5d28997ed9a5565deec9c34322165d563d00
SHA1 (patch-compiler_rustc__target_src_spec_targets_aarch64__be__unknown__netbsd.rs) = b0a26945a8640d53eabca16c27c99fc27c8e5623
SHA1 (patch-compiler_rustc__target_src_spec_targets_aarch64__unknown__netbsd.rs) = bd4f1086033ab21160f1edba1d255ffb4451cbcf
SHA1 (patch-compiler_rustc__target_src_spec_targets_mips64el__unknown__netbsd.rs) = e97b7978cc525db7eadf967d51f4818a3c145754
SHA1 (patch-library_backtrace_src_symbolize_gimli.rs) = 1ab343595e65ff6348f83cffc30e53d764485ff8
SHA1 (patch-library_backtrace_src_symbolize_gimli_elf.rs) = 3b84a462c6bc8245d579452e4c37e3ce13314952
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$NetBSD$

NetBSD aarch64 has a bug in the thread-local storage implementation,
ref. http://gnats.netbsd.org/58154, and this is responsible for the
build misery experienced earlier, ref.
https://github.com/rust-lang/rust/issues/123551
Turn it off for now on arm64.
Ideally should check whether the specific OS version has the fix
or not, but e.g. __NetBSD_Version__ isn't easily available here
that I know, and this goes against the attitude that OS version
should matter as long as it's >= supported version.
So until the fix for NetBSD PR#58154 has propagated to releases,
this is what we do.

--- compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs.orig 2024-07-23 19:21:34.344805113 +0000
+++ compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs
@@ -18,6 +18,7 @@ pub fn target() -> Target {
max_atomic_width: Some(128),
stack_probes: StackProbeType::Inline,
endian: Endian::Big,
+ has_thread_local: false, // ref. NetBSD PR#58154
..base::netbsd::opts()
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$NetBSD$

NetBSD aarch64 has a bug in the thread-local storage implementation,
ref. http://gnats.netbsd.org/58154, and this is responsible for the
build misery experienced earlier, ref.
https://github.com/rust-lang/rust/issues/123551
Turn it off for now on arm64.
Ideally should check whether the specific OS version has the fix
or not, but e.g. __NetBSD_Version__ isn't easily available here
that I know, and this goes against the attitude that OS version
should matter as long as it's >= supported version.
So until the fix for NetBSD PR#58154 has propagated to releases,
this is what we do.

--- compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs.orig 2024-07-23 19:18:44.116841966 +0000
+++ compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs
@@ -17,6 +17,7 @@ pub fn target() -> Target {
mcount: "__mcount".into(),
max_atomic_width: Some(128),
stack_probes: StackProbeType::Inline,
+ has_thread_local: false, // ref. NetBSD PR#58154
..base::netbsd::opts()
},
}

0 comments on commit 375fa82

Please sign in to comment.