-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lang/rust: pull over fixes to rust 1.79 from pkgsrc-wip:
1) Turn off the use ot thread local storage on NetBSD/aarch64, due to NetBSD PR#58154 and our desire to support systems built before the fix was applied. 2) Use the fixed 1.78.0 bootstrap for NetBSD/aarch64 (which is now built with the workaround from #1 applied). 3) Reinstate the patches to the openssl-sys and openssl-src vendor crates, and their checksum fixes, taken from pkgsrc-wip rust 1.78.0 and adapted. 4) Make the NetBSD/sparc64 target spec more similar to the other sparc64 targets. Does not resolve the cross-build problem, sadly.
- Loading branch information
Showing
11 changed files
with
283 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ust/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__be__unknown__netbsd.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
$NetBSD: patch-compiler_rustc__target_src_spec_targets_aarch64__be__unknown__netbsd.rs,v 1.1 2024/07/31 08:05:50 he Exp $ | ||
|
||
NetBSD aarch64 has a bug in the thread-local storage implementation, | ||
ref. PR#58154. Turn it off for now. | ||
Ideally should check whether the version has the fix or not, but | ||
e.g. __NetBSD_Version__ isn't easily available here that I know... | ||
|
||
--- 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() | ||
}, | ||
} |
17 changes: 17 additions & 0 deletions
17
lang/rust/patches/patch-compiler_rustc__target_src_spec_targets_aarch64__unknown__netbsd.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
$NetBSD: patch-compiler_rustc__target_src_spec_targets_aarch64__unknown__netbsd.rs,v 1.1 2024/07/31 08:05:50 he Exp $ | ||
|
||
NetBSD aarch64 has a bug in the thread-local storage implementation, | ||
ref. PR#58154. Turn it off for now. | ||
Ideally should check whether the version has the fix or not, but | ||
e.g. __NetBSD_Version__ isn't easily available here that I know... | ||
|
||
--- 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() | ||
}, | ||
} |
29 changes: 29 additions & 0 deletions
29
lang/rust/patches/patch-compiler_rustc__target_src_spec_targets_sparc64__unknown__netbsd.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
$NetBSD: patch-compiler_rustc__target_src_spec_targets_sparc64__unknown__netbsd.rs,v 1.1 2024/07/31 08:05:50 he Exp $ | ||
|
||
Make more similar to other sparc64 target specs. | ||
|
||
--- compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs.orig 2006-07-24 01:21:28.000000000 +0000 | ||
+++ compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs | ||
@@ -1,11 +1,13 @@ | ||
use crate::abi::Endian; | ||
-use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions}; | ||
+use crate::spec::{base, Cc, LinkerFlavor, Lld, Target}; | ||
|
||
pub fn target() -> Target { | ||
let mut base = base::netbsd::opts(); | ||
base.cpu = "v9".into(); | ||
base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]); | ||
base.max_atomic_width = Some(64); | ||
+ base.endian = Endian::Big; | ||
+ base.mcount = "__mcount".into(); | ||
|
||
Target { | ||
llvm_target: "sparc64-unknown-netbsd".into(), | ||
@@ -18,6 +20,6 @@ pub fn target() -> Target { | ||
pointer_width: 64, | ||
data_layout: "E-m:e-i64:64-n32:64-S128".into(), | ||
arch: "sparc64".into(), | ||
- options: TargetOptions { endian: Endian::Big, mcount: "__mcount".into(), ..base }, | ||
+ options: base, | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...rust/patches/patch-vendor_openssl-src-111.28.1+1.1.1w_openssl_Configurations_10-main.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
$NetBSD: patch-vendor_openssl-src-111.28.1+1.1.1w_openssl_Configurations_10-main.conf,v 1.1 2024/07/31 08:05:50 he Exp $ | ||
|
||
Replicate part of | ||
https://github.com/openssl/openssl/pull/15086 | ||
|
||
--- vendor/openssl-src-111.28.1+1.1.1w/openssl/Configurations/10-main.conf.orig 2006-07-24 01:21:28.000000000 +0000 | ||
+++ vendor/openssl-src-111.28.1+1.1.1w/openssl/Configurations/10-main.conf | ||
@@ -950,6 +950,10 @@ my %targets = ( | ||
shared_cflag => "-fPIC", | ||
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)", | ||
}, | ||
+ "NetBSD-generic32" => { | ||
+ inherit_from => [ "BSD-generic32" ], | ||
+ ex_libs => add(threads("-latomic")), | ||
+ }, | ||
"BSD-generic64" => { | ||
inherit_from => [ "BSD-generic32" ], | ||
bn_ops => "SIXTY_FOUR_BIT_LONG", |
64 changes: 64 additions & 0 deletions
64
lang/rust/patches/patch-vendor_openssl-src-111.28.1+1.1.1w_src_lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
$NetBSD: patch-vendor_openssl-src-111.28.1+1.1.1w_src_lib.rs,v 1.1 2024/07/31 08:05:50 he Exp $ | ||
|
||
Provide defaults for the various NetBSD targets. | ||
|
||
--- vendor/openssl-src-111.28.1+1.1.1w/src/lib.rs.orig 2006-07-24 01:21:28.000000000 +0000 | ||
+++ vendor/openssl-src-111.28.1+1.1.1w/src/lib.rs | ||
@@ -239,6 +239,8 @@ impl Build { | ||
"aarch64-unknown-freebsd" => "BSD-generic64", | ||
"aarch64-unknown-linux-gnu" => "linux-aarch64", | ||
"aarch64-unknown-linux-musl" => "linux-aarch64", | ||
+ "aarch64-unknown-netbsd" => "BSD-generic64", | ||
+ "aarch64_be-unknown-netbsd" => "BSD-generic64", | ||
"aarch64-pc-windows-msvc" => "VC-WIN64-ARM", | ||
"arm-linux-androideabi" => "linux-armv4", | ||
"armv7-linux-androideabi" => "linux-armv4", | ||
@@ -249,14 +251,17 @@ impl Build { | ||
"armv5te-unknown-linux-gnueabi" => "linux-armv4", | ||
"armv5te-unknown-linux-musleabi" => "linux-armv4", | ||
"armv6-unknown-freebsd" => "BSD-generic32", | ||
+ "armv6-unknown-netbsd-eabihf" => "BSD-generic32", | ||
"armv7-unknown-freebsd" => "BSD-generic32", | ||
"armv7-unknown-linux-gnueabi" => "linux-armv4", | ||
"armv7-unknown-linux-musleabi" => "linux-armv4", | ||
"armv7-unknown-linux-gnueabihf" => "linux-armv4", | ||
"armv7-unknown-linux-musleabihf" => "linux-armv4", | ||
+ "armv7-unknown-netbsd-eabihf" => "BSD-generic32", | ||
"asmjs-unknown-emscripten" => "gcc", | ||
"i586-unknown-linux-gnu" => "linux-elf", | ||
"i586-unknown-linux-musl" => "linux-elf", | ||
+ "i586-unknown-netbsd" => "BSD-x86-elf", | ||
"i686-apple-darwin" => "darwin-i386-cc", | ||
"i686-linux-android" => "linux-elf", | ||
"i686-pc-windows-gnu" => "mingw", | ||
@@ -264,6 +269,7 @@ impl Build { | ||
"i686-unknown-freebsd" => "BSD-x86-elf", | ||
"i686-unknown-linux-gnu" => "linux-elf", | ||
"i686-unknown-linux-musl" => "linux-elf", | ||
+ "i686-unknown-netbsd" => "BSD-x86-elf", | ||
"loongarch64-unknown-linux-gnu" => "linux-generic64", | ||
"mips-unknown-linux-gnu" => "linux-mips32", | ||
"mips-unknown-linux-musl" => "linux-mips32", | ||
@@ -273,9 +279,11 @@ impl Build { | ||
"mips64el-unknown-linux-muslabi64" => "linux64-mips64", | ||
"mipsel-unknown-linux-gnu" => "linux-mips32", | ||
"mipsel-unknown-linux-musl" => "linux-mips32", | ||
+ "mipsel-unknown-netbsd" => "NetBSD-generic32", | ||
"powerpc-unknown-freebsd" => "BSD-generic32", | ||
"powerpc-unknown-linux-gnu" => "linux-ppc", | ||
"powerpc-unknown-linux-gnuspe" => "linux-ppc", | ||
+ "powerpc-unknown-netbsd" => "BSD-generic32", | ||
"powerpc64-unknown-freebsd" => "BSD-generic64", | ||
"powerpc64-unknown-linux-gnu" => "linux-ppc64", | ||
"powerpc64-unknown-linux-musl" => "linux-ppc64", | ||
@@ -283,8 +291,10 @@ impl Build { | ||
"powerpc64le-unknown-linux-gnu" => "linux-ppc64le", | ||
"powerpc64le-unknown-linux-musl" => "linux-ppc64le", | ||
"riscv64gc-unknown-linux-gnu" => "linux-generic64", | ||
+ "riscv64gc-unknown-netbsd" => "BSD-generic64", | ||
"s390x-unknown-linux-gnu" => "linux64-s390x", | ||
"s390x-unknown-linux-musl" => "linux64-s390x", | ||
+ "sparc64-unknown-netbsd" => "BSD-generic64", | ||
"x86_64-apple-darwin" => "darwin64-x86_64-cc", | ||
"x86_64-linux-android" => "linux-x86_64", | ||
"x86_64-pc-windows-gnu" => "mingw64", |
30 changes: 30 additions & 0 deletions
30
lang/rust/patches/patch-vendor_openssl-sys-0.9.102_build_find__normal.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
$NetBSD: patch-vendor_openssl-sys-0.9.102_build_find__normal.rs,v 1.1 2024/07/31 08:05:51 he Exp $ | ||
|
||
Add hack for Darwin when homebrew is installed. | ||
|
||
--- vendor/openssl-sys-0.9.102/build/find_normal.rs.orig 2006-07-24 01:21:28.000000000 +0000 | ||
+++ vendor/openssl-sys-0.9.102/build/find_normal.rs | ||
@@ -72,23 +72,6 @@ fn resolve_with_wellknown_location(dir: | ||
fn find_openssl_dir(target: &str) -> OsString { | ||
let host = env::var("HOST").unwrap(); | ||
|
||
- if host == target && target.ends_with("-apple-darwin") { | ||
- let homebrew_dir = match target { | ||
- "aarch64-apple-darwin" => "/opt/homebrew", | ||
- _ => "/usr/local", | ||
- }; | ||
- | ||
- if let Some(dir) = resolve_with_wellknown_homebrew_location(homebrew_dir) { | ||
- return dir.into(); | ||
- } else if let Some(dir) = resolve_with_wellknown_location("/opt/pkg") { | ||
- // pkgsrc | ||
- return dir.into(); | ||
- } else if let Some(dir) = resolve_with_wellknown_location("/opt/local") { | ||
- // MacPorts | ||
- return dir.into(); | ||
- } | ||
- } | ||
- | ||
try_pkg_config(); | ||
try_vcpkg(); | ||
|
23 changes: 23 additions & 0 deletions
23
lang/rust/patches/patch-vendor_openssl-sys-0.9.102_build_main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$NetBSD: patch-vendor_openssl-sys-0.9.102_build_main.rs,v 1.1 2024/07/31 08:05:51 he Exp $ | ||
|
||
Patterned after Linux and Android, on 32-bit NetBSD ports | ||
include -latomic. Parts of this inspired by | ||
https://github.com/sfackler/rust-openssl/commit/a0a1d1d29263abb7c47fc2e58cef8dab13762a45 | ||
|
||
--- vendor/openssl-sys-0.9.102/build/main.rs.orig 2006-07-24 01:21:28.000000000 +0000 | ||
+++ vendor/openssl-sys-0.9.102/build/main.rs | ||
@@ -142,6 +142,14 @@ fn main() { | ||
println!("cargo:rustc-link-lib=atomic"); | ||
} | ||
|
||
+ // Patterned of the above, make sure we include -latomic | ||
+ // on ilp32 ports (yes, this only tests the "p32" part). | ||
+ if env::var("CARGO_CFG_TARGET_OS").unwrap() == "netbsd" | ||
+ && env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32" | ||
+ { | ||
+ println!("cargo:rustc-link-lib=atomic"); | ||
+ } | ||
+ | ||
if kind == "static" && target.contains("windows") { | ||
println!("cargo:rustc-link-lib=dylib=gdi32"); | ||
println!("cargo:rustc-link-lib=dylib=user32"); |
30 changes: 30 additions & 0 deletions
30
lang/rust/patches/patch-vendor_openssl-sys-0.9.92_build_find__normal.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
$NetBSD: patch-vendor_openssl-sys-0.9.92_build_find__normal.rs,v 1.1 2024/07/31 08:05:51 he Exp $ | ||
|
||
Add hack for Darwin when homebrew is installed. | ||
|
||
--- vendor/openssl-sys-0.9.92/build/find_normal.rs.orig 2006-07-24 01:21:28.000000000 +0000 | ||
+++ vendor/openssl-sys-0.9.92/build/find_normal.rs | ||
@@ -72,23 +72,6 @@ fn resolve_with_wellknown_location(dir: | ||
fn find_openssl_dir(target: &str) -> OsString { | ||
let host = env::var("HOST").unwrap(); | ||
|
||
- if host == target && target.ends_with("-apple-darwin") { | ||
- let homebrew_dir = match target { | ||
- "aarch64-apple-darwin" => "/opt/homebrew", | ||
- _ => "/usr/local", | ||
- }; | ||
- | ||
- if let Some(dir) = resolve_with_wellknown_homebrew_location(homebrew_dir) { | ||
- return dir.into(); | ||
- } else if let Some(dir) = resolve_with_wellknown_location("/opt/pkg") { | ||
- // pkgsrc | ||
- return dir.into(); | ||
- } else if let Some(dir) = resolve_with_wellknown_location("/opt/local") { | ||
- // MacPorts | ||
- return dir.into(); | ||
- } | ||
- } | ||
- | ||
try_pkg_config(); | ||
try_vcpkg(); | ||
|
23 changes: 23 additions & 0 deletions
23
lang/rust/patches/patch-vendor_openssl-sys-0.9.92_build_main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
$NetBSD: patch-vendor_openssl-sys-0.9.92_build_main.rs,v 1.1 2024/07/31 08:05:51 he Exp $ | ||
|
||
Patterned after Linux and Android, on 32-bit NetBSD ports | ||
include -latomic. Parts of this inspired by | ||
https://github.com/sfackler/rust-openssl/commit/a0a1d1d29263abb7c47fc2e58cef8dab13762a45 | ||
|
||
--- vendor/openssl-sys-0.9.92/build/main.rs.orig 2006-07-24 01:21:28.000000000 +0000 | ||
+++ vendor/openssl-sys-0.9.92/build/main.rs | ||
@@ -115,6 +115,14 @@ fn main() { | ||
println!("cargo:rustc-link-lib={}={}", kind, lib); | ||
} | ||
|
||
+ // Patterned of the above, make sure we include -latomic | ||
+ // on ilp32 ports (yes, this only tests the "p32" part). | ||
+ if env::var("CARGO_CFG_TARGET_OS").unwrap() == "netbsd" | ||
+ && env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32" | ||
+ { | ||
+ println!("cargo:rustc-link-lib=atomic"); | ||
+ } | ||
+ | ||
if kind == "static" && target.contains("windows") { | ||
println!("cargo:rustc-link-lib=dylib=gdi32"); | ||
println!("cargo:rustc-link-lib=dylib=user32"); |