File tree 4 files changed +26
-0
lines changed
4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,12 @@ fn main() {
258
258
{
259
259
println ! ( "cargo:rustc-link-lib=z" ) ;
260
260
} 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
+ }
261
267
println ! ( "cargo:rustc-link-lib=z" ) ;
262
268
println ! ( "cargo:rustc-link-lib=execinfo" ) ;
263
269
}
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! {
1564
1564
( "aarch64_be-unknown-netbsd" , aarch64_be_unknown_netbsd) ,
1565
1565
( "armv6-unknown-netbsd-eabihf" , armv6_unknown_netbsd_eabihf) ,
1566
1566
( "armv7-unknown-netbsd-eabihf" , armv7_unknown_netbsd_eabihf) ,
1567
+ ( "i586-unknown-netbsd" , i586_unknown_netbsd) ,
1567
1568
( "i686-unknown-netbsd" , i686_unknown_netbsd) ,
1568
1569
( "powerpc-unknown-netbsd" , powerpc_unknown_netbsd) ,
1569
1570
( "riscv64gc-unknown-netbsd" , riscv64gc_unknown_netbsd) ,
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ target | std | notes
152
152
` i586-pc-windows-msvc ` | * | 32-bit Windows w/o SSE [ ^ x86_32-floats-x87 ]
153
153
` i586-unknown-linux-gnu ` | ✓ | 32-bit Linux w/o SSE (kernel 3.2, glibc 2.17) [ ^ x86_32-floats-x87 ]
154
154
` 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
155
156
[ ` i686-linux-android ` ] ( platform-support/android.md ) | ✓ | 32-bit x86 Android [ ^ x86_32-floats-return-ABI ]
156
157
` i686-unknown-freebsd ` | ✓ | 32-bit FreeBSD [ ^ x86_32-floats-return-ABI ]
157
158
` 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