@@ -9,19 +9,18 @@ unsafe extern "C" {
99}
1010
1111// SAFETY: these are defined in compiler-builtins
12- // FIXME(extern_custom), this isn't always the correct ABI
13- unsafe extern "aapcs" {
12+ unsafe extern "custom" {
1413 // AAPCS is not always the correct ABI for these intrinsics, but we only use this to
1514 // forward another `__aeabi_` call so it doesn't matter.
16- fn __aeabi_idiv ( a : i32 , b : i32 ) -> i32 ;
15+ fn __aeabi_idiv ( ) ;
1716}
1817
1918intrinsics ! {
2019 // NOTE This function and the ones below are implemented using assembly because they are using a
2120 // custom calling convention which can't be implemented using a normal Rust function.
2221 #[ unsafe ( naked) ]
2322 #[ cfg( not( target_env = "msvc" ) ) ]
24- pub unsafe extern "C " fn __aeabi_uidivmod( ) {
23+ pub unsafe extern "custom " fn __aeabi_uidivmod( ) {
2524 core:: arch:: naked_asm!(
2625 "push {{lr}}" ,
2726 "sub sp, sp, #4" ,
@@ -35,7 +34,7 @@ intrinsics! {
3534 }
3635
3736 #[ unsafe ( naked) ]
38- pub unsafe extern "C " fn __aeabi_uldivmod( ) {
37+ pub unsafe extern "custom " fn __aeabi_uldivmod( ) {
3938 core:: arch:: naked_asm!(
4039 "push {{r4, lr}}" ,
4140 "sub sp, sp, #16" ,
@@ -51,7 +50,7 @@ intrinsics! {
5150 }
5251
5352 #[ unsafe ( naked) ]
54- pub unsafe extern "C " fn __aeabi_idivmod( ) {
53+ pub unsafe extern "custom " fn __aeabi_idivmod( ) {
5554 core:: arch:: naked_asm!(
5655 "push {{r0, r1, r4, lr}}" ,
5756 "bl {trampoline}" ,
@@ -64,7 +63,7 @@ intrinsics! {
6463 }
6564
6665 #[ unsafe ( naked) ]
67- pub unsafe extern "C " fn __aeabi_ldivmod( ) {
66+ pub unsafe extern "custom " fn __aeabi_ldivmod( ) {
6867 core:: arch:: naked_asm!(
6968 "push {{r4, lr}}" ,
7069 "sub sp, sp, #16" ,
@@ -135,8 +134,8 @@ intrinsics! {
135134 /// eight bytes.
136135 #[ cfg( not( target_vendor = "apple" ) ) ]
137136 pub unsafe extern "aapcs" fn __aeabi_memcpy8( dst: * mut u8 , src: * const u8 , n: usize ) {
138- debug_assert!( dst. addr( ) & 7 == 0 ) ;
139- debug_assert!( src. addr( ) & 7 == 0 ) ;
137+ debug_assert!( dst. addr( ) . is_multiple_of ( 8 ) ) ;
138+ debug_assert!( src. addr( ) . is_multiple_of ( 8 ) ) ;
140139
141140 // SAFETY: memcpy preconditions apply, less strict alignment.
142141 unsafe { __aeabi_memcpy4( dst, src, n) } ;
@@ -161,8 +160,8 @@ intrinsics! {
161160 /// four bytes.
162161 #[ cfg( not( any( target_vendor = "apple" , target_env = "msvc" ) ) ) ]
163162 pub unsafe extern "aapcs" fn __aeabi_memmove4( dst: * mut u8 , src: * const u8 , n: usize ) {
164- debug_assert!( dst. addr( ) & 3 == 0 ) ;
165- debug_assert!( src. addr( ) & 3 == 0 ) ;
163+ debug_assert!( dst. addr( ) . is_multiple_of ( 4 ) ) ;
164+ debug_assert!( src. addr( ) . is_multiple_of ( 4 ) ) ;
166165
167166 // SAFETY: same preconditions, less strict aligment.
168167 unsafe { __aeabi_memmove( dst, src, n) } ;
@@ -176,8 +175,8 @@ intrinsics! {
176175 /// eight bytes.
177176 #[ cfg( not( any( target_vendor = "apple" , target_env = "msvc" ) ) ) ]
178177 pub unsafe extern "aapcs" fn __aeabi_memmove8( dst: * mut u8 , src: * const u8 , n: usize ) {
179- debug_assert!( dst. addr( ) & 7 == 0 ) ;
180- debug_assert!( src. addr( ) & 7 == 0 ) ;
178+ debug_assert!( dst. addr( ) . is_multiple_of ( 8 ) ) ;
179+ debug_assert!( src. addr( ) . is_multiple_of ( 8 ) ) ;
181180
182181 // SAFETY: memmove preconditions apply, less strict alignment.
183182 unsafe { __aeabi_memmove( dst, src, n) } ;
@@ -236,7 +235,7 @@ intrinsics! {
236235 /// eight bytes.
237236 #[ cfg( not( target_vendor = "apple" ) ) ]
238237 pub unsafe extern "aapcs" fn __aeabi_memset8( dst: * mut u8 , n: usize , c: i32 ) {
239- debug_assert!( dst. addr( ) & 7 == 0 ) ;
238+ debug_assert!( dst. addr( ) . is_multiple_of ( 8 ) ) ;
240239
241240 // SAFETY: memset preconditions apply, less strict alignment.
242241 unsafe { __aeabi_memset4( dst, n, c) } ;
@@ -261,7 +260,7 @@ intrinsics! {
261260 /// four bytes.
262261 #[ cfg( not( any( target_vendor = "apple" , target_env = "msvc" ) ) ) ]
263262 pub unsafe extern "aapcs" fn __aeabi_memclr4( dst: * mut u8 , n: usize ) {
264- debug_assert!( dst. addr( ) & 3 == 0 ) ;
263+ debug_assert!( dst. addr( ) . is_multiple_of ( 4 ) ) ;
265264
266265 // SAFETY: memclr preconditions apply, less strict alignment.
267266 unsafe { __aeabi_memset4( dst, n, 0 ) } ;
@@ -275,7 +274,7 @@ intrinsics! {
275274 /// eight bytes.
276275 #[ cfg( not( any( target_vendor = "apple" , target_env = "msvc" ) ) ) ]
277276 pub unsafe extern "aapcs" fn __aeabi_memclr8( dst: * mut u8 , n: usize ) {
278- debug_assert!( dst. addr( ) & 7 == 0 ) ;
277+ debug_assert!( dst. addr( ) . is_multiple_of ( 8 ) ) ;
279278
280279 // SAFETY: memclr preconditions apply, less strict alignment.
281280 unsafe { __aeabi_memset4( dst, n, 0 ) } ;
0 commit comments