File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,12 @@ fn main() {
258258 {
259259 println ! ( "cargo:rustc-link-lib=z" ) ;
260260 } else if target. contains ( "netbsd" ) {
261+ // On NetBSD/i386, gcc and g++ is built for i486 (to maximize backward compat)
262+ // However, LLVM insists on using 64-bit atomics.
263+ // This gives rise to a need to link rust itself with -latomic for these targets
264+ if target. starts_with ( "i586" ) || target. starts_with ( "i686" ) {
265+ println ! ( "cargo:rustc-link-lib=atomic" ) ;
266+ }
261267 println ! ( "cargo:rustc-link-lib=z" ) ;
262268 println ! ( "cargo:rustc-link-lib=execinfo" ) ;
263269 }
Original file line number Diff line number Diff line change 1+ use crate :: spec:: { StackProbeType , Target , TargetOptions } ;
2+
3+ pub fn target ( ) -> Target {
4+ let mut base = super :: netbsd_base:: opts ( ) ;
5+ base. cpu = "pentium" . into ( ) ;
6+ base. max_atomic_width = Some ( 64 ) ;
7+ base. stack_probes = StackProbeType :: Call ;
8+
9+ Target {
10+ llvm_target : "i586-unknown-netbsdelf" . into ( ) ,
11+ pointer_width : 32 ,
12+ data_layout : "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
13+ f64:32:64-f80:32-n8:16:32-S128"
14+ . into ( ) ,
15+ arch : "x86" . into ( ) ,
16+ options : TargetOptions { mcount : "__mcount" . into ( ) , ..base } ,
17+ }
18+ }
Original file line number Diff line number Diff line change @@ -1564,6 +1564,7 @@ supported_targets! {
15641564 ( "aarch64_be-unknown-netbsd" , aarch64_be_unknown_netbsd) ,
15651565 ( "armv6-unknown-netbsd-eabihf" , armv6_unknown_netbsd_eabihf) ,
15661566 ( "armv7-unknown-netbsd-eabihf" , armv7_unknown_netbsd_eabihf) ,
1567+ ( "i586-unknown-netbsd" , i586_unknown_netbsd) ,
15671568 ( "i686-unknown-netbsd" , i686_unknown_netbsd) ,
15681569 ( "powerpc-unknown-netbsd" , powerpc_unknown_netbsd) ,
15691570 ( "riscv64gc-unknown-netbsd" , riscv64gc_unknown_netbsd) ,
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ target | std | notes
152152` i586-pc-windows-msvc ` | * | 32-bit Windows w/o SSE [ ^ x86_32-floats-x87 ]
153153` i586-unknown-linux-gnu ` | ✓ | 32-bit Linux w/o SSE (kernel 3.2, glibc 2.17) [ ^ x86_32-floats-x87 ]
154154` i586-unknown-linux-musl ` | ✓ | 32-bit Linux w/o SSE, MUSL [ ^ x86_32-floats-x87 ]
155+ [ ` i586-unknown-netbsd ` ] ( platform-support/netbsd.md ) | ✓ | 32-bit x86, restricted to Pentium
155156[ ` i686-linux-android ` ] ( platform-support/android.md ) | ✓ | 32-bit x86 Android [ ^ x86_32-floats-return-ABI ]
156157` i686-unknown-freebsd ` | ✓ | 32-bit FreeBSD [ ^ x86_32-floats-return-ABI ]
157158` i686-unknown-linux-musl ` | ✓ | 32-bit Linux with MUSL [ ^ x86_32-floats-return-ABI ]
You can’t perform that action at this time.
0 commit comments