@@ -20,12 +20,14 @@ use core::ops::{BitOr, Shl};
20
20
mod impls;
21
21
22
22
#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
23
+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
23
24
pub unsafe extern "C" fn memcpy ( dest : * mut u8 , src : * const u8 , n : usize ) -> * mut u8 {
24
25
impls:: copy_forward ( dest, src, n) ;
25
26
dest
26
27
}
27
28
28
29
#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
30
+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
29
31
pub unsafe extern "C" fn memmove ( dest : * mut u8 , src : * const u8 , n : usize ) -> * mut u8 {
30
32
let delta = ( dest as usize ) . wrapping_sub ( src as usize ) ;
31
33
if delta >= n {
@@ -39,12 +41,14 @@ pub unsafe extern "C" fn memmove(dest: *mut u8, src: *const u8, n: usize) -> *mu
39
41
}
40
42
41
43
#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
44
+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
42
45
pub unsafe extern "C" fn memset ( s : * mut u8 , c : c_int , n : usize ) -> * mut u8 {
43
46
impls:: set_bytes ( s, c as u8 , n) ;
44
47
s
45
48
}
46
49
47
50
#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
51
+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
48
52
pub unsafe extern "C" fn memcmp ( s1 : * const u8 , s2 : * const u8 , n : usize ) -> i32 {
49
53
let mut i = 0 ;
50
54
while i < n {
@@ -59,6 +63,7 @@ pub unsafe extern "C" fn memcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
59
63
}
60
64
61
65
#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
66
+ #[ cfg_attr( not( all( target_os = "windows" , target_env = "gnu" ) ) , linkage = "weak" ) ]
62
67
pub unsafe extern "C" fn bcmp ( s1 : * const u8 , s2 : * const u8 , n : usize ) -> i32 {
63
68
memcmp ( s1, s2, n)
64
69
}
0 commit comments