Skip to content

Commit cfbf9c1

Browse files
committed
fix: Add (even more) #[avr_skip] for floats
Tale as old as the world - there's an ABI mismatch: rust-lang#527 Fortunately, newest GCCs (from v11, it seems) actually provide most of those intrinsics (even for f64!), so that's pretty cool. (the only intrinsics not provided by GCC are `__powisf2` & `__powidf2`, but our codegen for AVR doesn't emit those anyway.) Fixes rust-lang/rust#118079.
1 parent 2a331a2 commit cfbf9c1

File tree

6 files changed

+10
-0
lines changed

6 files changed

+10
-0
lines changed

src/float/div.rs

+2
Original file line numberDiff line numberDiff line change
@@ -902,11 +902,13 @@ where
902902
}
903903

904904
intrinsics! {
905+
#[avr_skip]
905906
#[arm_aeabi_alias = __aeabi_fdiv]
906907
pub extern "C" fn __divsf3(a: f32, b: f32) -> f32 {
907908
div32(a, b)
908909
}
909910

911+
#[avr_skip]
910912
#[arm_aeabi_alias = __aeabi_ddiv]
911913
pub extern "C" fn __divdf3(a: f64, b: f64) -> f64 {
912914
div64(a, b)

src/float/extend.rs

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ where
7070
}
7171

7272
intrinsics! {
73+
#[avr_skip]
7374
#[aapcs_on_arm]
7475
#[arm_aeabi_alias = __aeabi_f2d]
7576
pub extern "C" fn __extendsfdf2(a: f32) -> f64 {

src/float/mul.rs

+2
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,14 @@ where
185185
}
186186

187187
intrinsics! {
188+
#[avr_skip]
188189
#[aapcs_on_arm]
189190
#[arm_aeabi_alias = __aeabi_fmul]
190191
pub extern "C" fn __mulsf3(a: f32, b: f32) -> f32 {
191192
mul(a, b)
192193
}
193194

195+
#[avr_skip]
194196
#[aapcs_on_arm]
195197
#[arm_aeabi_alias = __aeabi_dmul]
196198
pub extern "C" fn __muldf3(a: f64, b: f64) -> f64 {

src/float/pow.rs

+2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ fn pow<F: Float>(a: F, b: i32) -> F {
2626
}
2727

2828
intrinsics! {
29+
#[avr_skip]
2930
pub extern "C" fn __powisf2(a: f32, b: i32) -> f32 {
3031
pow(a, b)
3132
}
3233

34+
#[avr_skip]
3335
pub extern "C" fn __powidf2(a: f64, b: i32) -> f64 {
3436
pow(a, b)
3537
}

src/float/sub.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ use crate::float::add::__addsf3;
33
use crate::float::Float;
44

55
intrinsics! {
6+
#[avr_skip]
67
#[arm_aeabi_alias = __aeabi_fsub]
78
pub extern "C" fn __subsf3(a: f32, b: f32) -> f32 {
89
__addsf3(a, f32::from_repr(b.repr() ^ f32::SIGN_MASK))
910
}
1011

12+
#[avr_skip]
1113
#[arm_aeabi_alias = __aeabi_dsub]
1214
pub extern "C" fn __subdf3(a: f64, b: f64) -> f64 {
1315
__adddf3(a, f64::from_repr(b.repr() ^ f64::SIGN_MASK))

src/float/trunc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ where
112112
}
113113

114114
intrinsics! {
115+
#[avr_skip]
115116
#[aapcs_on_arm]
116117
#[arm_aeabi_alias = __aeabi_d2f]
117118
pub extern "C" fn __truncdfsf2(a: f64) -> f32 {

0 commit comments

Comments
 (0)