@@ -138,18 +138,20 @@ pub unsafe fn __aeabi_ldivmod() {
138138 intrinsics:: unreachable ( ) ;
139139}
140140
141+ // The following functions use weak linkage to allow users to override
142+ // with custom implementation.
141143// FIXME: The `*4` and `*8` variants should be defined as aliases.
142144
143145#[ cfg( not( target_os = "ios" ) ) ]
144146#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
145- #[ cfg_attr ( thumb , linkage = "weak" ) ]
147+ #[ linkage = "weak" ]
146148pub unsafe extern "aapcs" fn __aeabi_memcpy ( dest : * mut u8 , src : * const u8 , n : usize ) {
147149 :: mem:: memcpy ( dest, src, n) ;
148150}
149151
150152#[ cfg( not( target_os = "ios" ) ) ]
151153#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
152- #[ cfg_attr ( thumb , linkage = "weak" ) ]
154+ #[ linkage = "weak" ]
153155pub unsafe extern "aapcs" fn __aeabi_memcpy4 ( dest : * mut u8 , src : * const u8 , mut n : usize ) {
154156 // We are guaranteed 4-alignment, so accessing at u32 is okay.
155157 let mut dest = dest as * mut u32 ;
@@ -167,43 +169,43 @@ pub unsafe extern "aapcs" fn __aeabi_memcpy4(dest: *mut u8, src: *const u8, mut
167169
168170#[ cfg( not( target_os = "ios" ) ) ]
169171#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
170- #[ cfg_attr ( thumb , linkage = "weak" ) ]
172+ #[ linkage = "weak" ]
171173pub unsafe extern "aapcs" fn __aeabi_memcpy8 ( dest : * mut u8 , src : * const u8 , n : usize ) {
172174 __aeabi_memcpy4 ( dest, src, n) ;
173175}
174176
175177#[ cfg( not( target_os = "ios" ) ) ]
176178#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
177- #[ cfg_attr ( thumb , linkage = "weak" ) ]
179+ #[ linkage = "weak" ]
178180pub unsafe extern "aapcs" fn __aeabi_memmove ( dest : * mut u8 , src : * const u8 , n : usize ) {
179181 :: mem:: memmove ( dest, src, n) ;
180182}
181183
182184#[ cfg( not( any( target_os = "ios" , target_env = "msvc" ) ) ) ]
183185#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
184- #[ cfg_attr ( thumb , linkage = "weak" ) ]
186+ #[ linkage = "weak" ]
185187pub unsafe extern "aapcs" fn __aeabi_memmove4 ( dest : * mut u8 , src : * const u8 , n : usize ) {
186188 __aeabi_memmove ( dest, src, n) ;
187189}
188190
189191#[ cfg( not( any( target_os = "ios" , target_env = "msvc" ) ) ) ]
190192#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
191- #[ cfg_attr ( thumb , linkage = "weak" ) ]
193+ #[ linkage = "weak" ]
192194pub unsafe extern "aapcs" fn __aeabi_memmove8 ( dest : * mut u8 , src : * const u8 , n : usize ) {
193195 __aeabi_memmove ( dest, src, n) ;
194196}
195197
196198#[ cfg( not( target_os = "ios" ) ) ]
197199#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
198- #[ cfg_attr ( thumb , linkage = "weak" ) ]
200+ #[ linkage = "weak" ]
199201pub unsafe extern "aapcs" fn __aeabi_memset ( dest : * mut u8 , n : usize , c : i32 ) {
200202 // Note the different argument order
201203 :: mem:: memset ( dest, c, n) ;
202204}
203205
204206#[ cfg( not( target_os = "ios" ) ) ]
205207#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
206- #[ cfg_attr ( thumb , linkage = "weak" ) ]
208+ #[ linkage = "weak" ]
207209pub unsafe extern "aapcs" fn __aeabi_memset4 ( dest : * mut u8 , mut n : usize , c : i32 ) {
208210 let mut dest = dest as * mut u32 ;
209211
@@ -221,28 +223,28 @@ pub unsafe extern "aapcs" fn __aeabi_memset4(dest: *mut u8, mut n: usize, c: i32
221223
222224#[ cfg( not( target_os = "ios" ) ) ]
223225#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
224- #[ cfg_attr ( thumb , linkage = "weak" ) ]
226+ #[ linkage = "weak" ]
225227pub unsafe extern "aapcs" fn __aeabi_memset8 ( dest : * mut u8 , n : usize , c : i32 ) {
226228 __aeabi_memset4 ( dest, n, c) ;
227229}
228230
229231#[ cfg( not( target_os = "ios" ) ) ]
230232#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
231- #[ cfg_attr ( thumb , linkage = "weak" ) ]
233+ #[ linkage = "weak" ]
232234pub unsafe extern "aapcs" fn __aeabi_memclr ( dest : * mut u8 , n : usize ) {
233235 __aeabi_memset ( dest, n, 0 ) ;
234236}
235237
236238#[ cfg( not( any( target_os = "ios" , target_env = "msvc" ) ) ) ]
237239#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
238- #[ cfg_attr ( thumb , linkage = "weak" ) ]
240+ #[ linkage = "weak" ]
239241pub unsafe extern "aapcs" fn __aeabi_memclr4 ( dest : * mut u8 , n : usize ) {
240242 __aeabi_memset4 ( dest, n, 0 ) ;
241243}
242244
243245#[ cfg( not( any( target_os = "ios" , target_env = "msvc" ) ) ) ]
244246#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
245- #[ cfg_attr ( thumb , linkage = "weak" ) ]
247+ #[ linkage = "weak" ]
246248pub unsafe extern "aapcs" fn __aeabi_memclr8 ( dest : * mut u8 , n : usize ) {
247249 __aeabi_memset4 ( dest, n, 0 ) ;
248250}
0 commit comments