For division and modulo, AVR uses a custom calling convention that does
not match compiler_builtins' expectations, leading to non-working code¹.
Ideally we'd just use hand-written naked functions (as, afair, ARM
does), but that's a lot of code to port², so hopefully we'll be able to
do it gradually later.
For the time being, I'd suggest not compiling problematic functions for
AVR target - this causes avr-gcc (which is a mandatory part of Rust+AVR
toolchain anyway) to link hand-written assembly from libgcc, which is
confirmed to work.
I've tested the code locally on simavr and the patch seems to be working
correctly :-)
¹ https://github.com/rust-lang/rust/issues/82242,
https://github.com/rust-lang/rust/issues/83281
²
|
||
|---|---|---|
| .. | ||
| compiler-builtins | ||