@@ -21,7 +21,7 @@ macro_rules! __unless_target_features {
21
21
}
22
22
23
23
// Linux runtime detection of target CPU features using `getauxval`.
24
- #[ cfg( target_os = "linux" ) ]
24
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
25
25
#[ macro_export]
26
26
#[ doc( hidden) ]
27
27
macro_rules! __detect_target_features {
@@ -32,7 +32,7 @@ macro_rules! __detect_target_features {
32
32
}
33
33
34
34
/// Linux helper function for calling `getauxval` to get `AT_HWCAP`.
35
- #[ cfg( target_os = "linux" ) ]
35
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
36
36
pub fn getauxval_hwcap ( ) -> u64 {
37
37
unsafe { libc:: getauxval ( libc:: AT_HWCAP ) }
38
38
}
@@ -48,7 +48,7 @@ macro_rules! __detect_target_features {
48
48
}
49
49
50
50
// Linux `expand_check_macro`
51
- #[ cfg( target_os = "linux" ) ]
51
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
52
52
macro_rules! __expand_check_macro {
53
53
( $( ( $name: tt, $hwcap: ident) ) ,* $( , ) ?) => {
54
54
#[ macro_export]
@@ -64,7 +64,7 @@ macro_rules! __expand_check_macro {
64
64
}
65
65
66
66
// Linux `expand_check_macro`
67
- #[ cfg( target_os = "linux" ) ]
67
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
68
68
__expand_check_macro ! {
69
69
( "aes" , AES ) , // Enable AES support.
70
70
( "sha2" , SHA2 ) , // Enable SHA1 and SHA256 support.
@@ -78,7 +78,7 @@ __expand_check_macro! {
78
78
/// provide that mapping accordingly.
79
79
///
80
80
/// See this issue for more info: <https://github.com/RustCrypto/utils/issues/395>
81
- #[ cfg( target_os = "linux" ) ]
81
+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
82
82
pub mod hwcaps {
83
83
use libc:: c_ulong;
84
84
@@ -167,7 +167,12 @@ macro_rules! check {
167
167
}
168
168
169
169
// On other targets, runtime CPU feature detection is unavailable
170
- #[ cfg( not( any( target_os = "ios" , target_os = "linux" , target_os = "macos" ) ) ) ]
170
+ #[ cfg( not( any(
171
+ target_os = "ios" ,
172
+ target_os = "linux" ,
173
+ target_os = "android" ,
174
+ target_os = "macos"
175
+ ) ) ) ]
171
176
#[ macro_export]
172
177
#[ doc( hidden) ]
173
178
macro_rules! __detect_target_features {
0 commit comments