-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVR: u32 and u64 behaves like u16 and u32 #83281
Closed
Labels
C-bug
Category: This is a bug.
O-AVR
Target: AVR processors (ATtiny, ATmega, etc.)
requires-nightly
This issue requires a nightly compiler in some way.
Comments
jonas-schievink
added
O-AVR
Target: AVR processors (ATtiny, ATmega, etc.)
requires-nightly
This issue requires a nightly compiler in some way.
labels
Mar 18, 2021
More precisely, it is failing to link the executable. This is a known problem between |
I'm pretty sure this is a duplicate of #82380 |
Seems like a duplicate of #82380, as in #82380 (comment) helps to avoid the linker issue and seems to generate a meaningful code; as for the overflow, unfortunately it's a problem in ufmt. |
Patryk27
added a commit
to Patryk27/compiler-builtins
that referenced
this issue
May 15, 2022
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 :-) ¹ rust-lang/rust#82242, rust-lang/rust#83281 ² https://github.com/gcc-mirror/gcc/blob/31048012db98f5ec9c2ba537bfd850374bdd771f/libgcc/config/avr/lib1funcs.S Closes rust-lang/rust#82242 Closes rust-lang/rust#83281
Patryk27
added a commit
to Patryk27/compiler-builtins
that referenced
this issue
May 17, 2022
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 :-) ¹ rust-lang/rust#82242, rust-lang/rust#83281 ² https://github.com/gcc-mirror/gcc/blob/31048012db98f5ec9c2ba537bfd850374bdd771f/libgcc/config/avr/lib1funcs.S Closes rust-lang/rust#82242 Closes rust-lang/rust#83281
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
O-AVR
Target: AVR processors (ATtiny, ATmega, etc.)
requires-nightly
This issue requires a nightly compiler in some way.
I found out that i32 and u32 behaves like i16 and u16
And i64 and u64 like i32 and u32
I wrote the following code to represent the problem:
Also if i'll write the code for displaying u64, avr-gcc can't flash the .elf file:
I use
nightly-2021-01-07
version because a newer one fails withNot supported instr
errorThe text was updated successfully, but these errors were encountered: