File tree Expand file tree Collapse file tree 5 files changed +40
-13
lines changed Expand file tree Collapse file tree 5 files changed +40
-13
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ scoped_threadpool = "0.1.8"
33
33
[target .thumbv6m-none-eabi .dependencies ]
34
34
atomic-polyfill = { version = " 0.1.2" , optional = true }
35
35
36
+ [target .riscv32i-unknown-none-elf .dependencies ]
37
+ atomic-polyfill = { version = " 0.1.4" , optional = true }
38
+
39
+ [target .riscv32imc-unknown-none-elf .dependencies ]
40
+ atomic-polyfill = { version = " 0.1.4" , optional = true }
41
+
36
42
[dependencies ]
37
43
hash32 = " 0.2.1"
38
44
Original file line number Diff line number Diff line change @@ -21,23 +21,44 @@ fn main() -> Result<(), Box<dyn Error>> {
21
21
println ! ( "cargo:rustc-cfg=armv7a" ) ;
22
22
}
23
23
24
- // built-in targets with no atomic / CAS support as of nightly-2019-12-17
24
+ // built-in targets with no atomic / CAS support as of nightly-2022-01-13
25
+ // AND not supported by the atomic-polyfill crate
25
26
// see the `no-atomics.sh` / `no-cas.sh` script sitting next to this file
26
27
match & target[ ..] {
27
- "msp430-none-elf" | "riscv32i-unknown-none-elf" | "riscv32imc-unknown-none-elf" => { }
28
+ "avr-unknown-gnu-atmega328"
29
+ | "bpfeb-unknown-none"
30
+ | "bpfel-unknown-none"
31
+ | "msp430-none-elf"
32
+ // | "riscv32i-unknown-none-elf" // supported by atomic-polyfill
33
+ // | "riscv32imc-unknown-none-elf" // supported by atomic-polyfill
34
+ | "thumbv4t-none-eabi"
35
+ // | "thumbv6m-none-eabi" // supported by atomic-polyfill
36
+ => { }
28
37
29
38
_ => {
30
39
println ! ( "cargo:rustc-cfg=has_cas" ) ;
31
40
}
32
41
} ;
33
42
34
43
match & target[ ..] {
35
- "msp430-none-elf" | "riscv32i-unknown-none-elf" | "riscv32imc-unknown-none-elf" => { }
44
+ "avr-unknown-gnu-atmega328"
45
+ | "msp430-none-elf"
46
+ // | "riscv32i-unknown-none-elf" // supported by atomic-polyfill
47
+ // | "riscv32imc-unknown-none-elf" // supported by atomic-polyfill
48
+ => { }
36
49
37
50
_ => {
38
51
println ! ( "cargo:rustc-cfg=has_atomics" ) ;
39
52
}
40
53
} ;
41
54
55
+ // Let the code know if it should use atomic-polyfill or not
56
+ match & target[ ..] {
57
+ "thumbv6m-none-eabi" | "riscv32i-unknown-none-elf" | "riscv32imc-unknown-none-elf" => {
58
+ println ! ( "cargo:rustc-cfg=use_atomic_polyfill" ) ;
59
+ }
60
+ _ => { }
61
+ }
62
+
42
63
Ok ( ( ) )
43
64
}
Original file line number Diff line number Diff line change 84
84
85
85
use core:: { cell:: UnsafeCell , mem:: MaybeUninit } ;
86
86
87
- #[ cfg( all( feature = "mpmc_large" , not( armv6m ) ) ) ]
87
+ #[ cfg( all( feature = "mpmc_large" , not( use_atomic_polyfill ) ) ) ]
88
88
type AtomicTargetSize = core:: sync:: atomic:: AtomicUsize ;
89
- #[ cfg( all( feature = "mpmc_large" , armv6m ) ) ]
89
+ #[ cfg( all( feature = "mpmc_large" , use_atomic_polyfill ) ) ]
90
90
type AtomicTargetSize = atomic_polyfill:: AtomicUsize ;
91
- #[ cfg( all( not( feature = "mpmc_large" ) , not( armv6m ) ) ) ]
91
+ #[ cfg( all( not( feature = "mpmc_large" ) , not( use_atomic_polyfill ) ) ) ]
92
92
type AtomicTargetSize = core:: sync:: atomic:: AtomicU8 ;
93
- #[ cfg( all( not( feature = "mpmc_large" ) , armv6m ) ) ]
93
+ #[ cfg( all( not( feature = "mpmc_large" ) , use_atomic_polyfill ) ) ]
94
94
type AtomicTargetSize = atomic_polyfill:: AtomicU8 ;
95
95
96
- #[ cfg( not( armv6m ) ) ]
96
+ #[ cfg( not( use_atomic_polyfill ) ) ]
97
97
type Ordering = core:: sync:: atomic:: Ordering ;
98
- #[ cfg( armv6m ) ]
98
+ #[ cfg( use_atomic_polyfill ) ]
99
99
type Ordering = atomic_polyfill:: Ordering ;
100
100
101
101
#[ cfg( feature = "mpmc_large" ) ]
Original file line number Diff line number Diff line change 3
3
pub use core:: ptr:: NonNull as Ptr ;
4
4
use core:: { cell:: UnsafeCell , ptr} ;
5
5
6
- #[ cfg( armv6m ) ]
6
+ #[ cfg( use_atomic_polyfill ) ]
7
7
use atomic_polyfill:: { AtomicPtr , Ordering } ;
8
8
9
- #[ cfg( not( armv6m ) ) ]
9
+ #[ cfg( not( use_atomic_polyfill ) ) ]
10
10
use core:: sync:: atomic:: { AtomicPtr , Ordering } ;
11
11
12
12
/// Unfortunate implementation detail required to use the
Original file line number Diff line number Diff line change @@ -81,10 +81,10 @@ use core::{
81
81
sync:: atomic,
82
82
} ;
83
83
84
- #[ cfg( armv6m ) ]
84
+ #[ cfg( use_atomic_polyfill ) ]
85
85
use atomic_polyfill:: { AtomicUsize , Ordering } ;
86
86
87
- #[ cfg( not( armv6m ) ) ]
87
+ #[ cfg( not( use_atomic_polyfill ) ) ]
88
88
use core:: sync:: atomic:: { AtomicUsize , Ordering } ;
89
89
90
90
use crate :: pool:: { self , stack:: Ptr , Node } ;
You can’t perform that action at this time.
0 commit comments