@@ -138,18 +138,20 @@ pub unsafe fn __aeabi_ldivmod() {
138
138
intrinsics:: unreachable ( ) ;
139
139
}
140
140
141
+ // The following functions use weak linkage to allow users to override
142
+ // with custom implementation.
141
143
// FIXME: The `*4` and `*8` variants should be defined as aliases.
142
144
143
145
#[ cfg( not( target_os = "ios" ) ) ]
144
146
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
145
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
147
+ #[ linkage = "weak" ]
146
148
pub unsafe extern "aapcs" fn __aeabi_memcpy ( dest : * mut u8 , src : * const u8 , n : usize ) {
147
149
:: mem:: memcpy ( dest, src, n) ;
148
150
}
149
151
150
152
#[ cfg( not( target_os = "ios" ) ) ]
151
153
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
152
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
154
+ #[ linkage = "weak" ]
153
155
pub unsafe extern "aapcs" fn __aeabi_memcpy4 ( dest : * mut u8 , src : * const u8 , mut n : usize ) {
154
156
// We are guaranteed 4-alignment, so accessing at u32 is okay.
155
157
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
167
169
168
170
#[ cfg( not( target_os = "ios" ) ) ]
169
171
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
170
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
172
+ #[ linkage = "weak" ]
171
173
pub unsafe extern "aapcs" fn __aeabi_memcpy8 ( dest : * mut u8 , src : * const u8 , n : usize ) {
172
174
__aeabi_memcpy4 ( dest, src, n) ;
173
175
}
174
176
175
177
#[ cfg( not( target_os = "ios" ) ) ]
176
178
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
177
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
179
+ #[ linkage = "weak" ]
178
180
pub unsafe extern "aapcs" fn __aeabi_memmove ( dest : * mut u8 , src : * const u8 , n : usize ) {
179
181
:: mem:: memmove ( dest, src, n) ;
180
182
}
181
183
182
184
#[ cfg( not( any( target_os = "ios" , target_env = "msvc" ) ) ) ]
183
185
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
184
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
186
+ #[ linkage = "weak" ]
185
187
pub unsafe extern "aapcs" fn __aeabi_memmove4 ( dest : * mut u8 , src : * const u8 , n : usize ) {
186
188
__aeabi_memmove ( dest, src, n) ;
187
189
}
188
190
189
191
#[ cfg( not( any( target_os = "ios" , target_env = "msvc" ) ) ) ]
190
192
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
191
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
193
+ #[ linkage = "weak" ]
192
194
pub unsafe extern "aapcs" fn __aeabi_memmove8 ( dest : * mut u8 , src : * const u8 , n : usize ) {
193
195
__aeabi_memmove ( dest, src, n) ;
194
196
}
195
197
196
198
#[ cfg( not( target_os = "ios" ) ) ]
197
199
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
198
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
200
+ #[ linkage = "weak" ]
199
201
pub unsafe extern "aapcs" fn __aeabi_memset ( dest : * mut u8 , n : usize , c : i32 ) {
200
202
// Note the different argument order
201
203
:: mem:: memset ( dest, c, n) ;
202
204
}
203
205
204
206
#[ cfg( not( target_os = "ios" ) ) ]
205
207
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
206
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
208
+ #[ linkage = "weak" ]
207
209
pub unsafe extern "aapcs" fn __aeabi_memset4 ( dest : * mut u8 , mut n : usize , c : i32 ) {
208
210
let mut dest = dest as * mut u32 ;
209
211
@@ -221,28 +223,28 @@ pub unsafe extern "aapcs" fn __aeabi_memset4(dest: *mut u8, mut n: usize, c: i32
221
223
222
224
#[ cfg( not( target_os = "ios" ) ) ]
223
225
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
224
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
226
+ #[ linkage = "weak" ]
225
227
pub unsafe extern "aapcs" fn __aeabi_memset8 ( dest : * mut u8 , n : usize , c : i32 ) {
226
228
__aeabi_memset4 ( dest, n, c) ;
227
229
}
228
230
229
231
#[ cfg( not( target_os = "ios" ) ) ]
230
232
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
231
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
233
+ #[ linkage = "weak" ]
232
234
pub unsafe extern "aapcs" fn __aeabi_memclr ( dest : * mut u8 , n : usize ) {
233
235
__aeabi_memset ( dest, n, 0 ) ;
234
236
}
235
237
236
238
#[ cfg( not( any( target_os = "ios" , target_env = "msvc" ) ) ) ]
237
239
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
238
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
240
+ #[ linkage = "weak" ]
239
241
pub unsafe extern "aapcs" fn __aeabi_memclr4 ( dest : * mut u8 , n : usize ) {
240
242
__aeabi_memset4 ( dest, n, 0 ) ;
241
243
}
242
244
243
245
#[ cfg( not( any( target_os = "ios" , target_env = "msvc" ) ) ) ]
244
246
#[ cfg_attr( not( feature = "mangled-names" ) , no_mangle) ]
245
- #[ cfg_attr ( thumb , linkage = "weak" ) ]
247
+ #[ linkage = "weak" ]
246
248
pub unsafe extern "aapcs" fn __aeabi_memclr8 ( dest : * mut u8 , n : usize ) {
247
249
__aeabi_memset4 ( dest, n, 0 ) ;
248
250
}
0 commit comments