Skip to content

Update toolchain to 2025-04-27 #651

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

Merged
merged 1 commit into from
Apr 28, 2025
Merged

Update toolchain to 2025-04-27 #651

merged 1 commit into from
Apr 28, 2025

Conversation

Rahix
Copy link
Owner

@Rahix Rahix commented Apr 18, 2025

Some floating point intrinsics were added in this newer version which helps on systems where these intrinsics are not provided by avr-gcc.

Cc: @Patryk27

@Rahix
Copy link
Owner Author

Rahix commented Apr 18, 2025

@Patryk27, can you check the CI failures please? Looks like there was a panicking code-path left in one of the intrinsics if I interpret this correctly?

@Patryk27
Copy link
Contributor

Okie, will check! 🦀

@Patryk27
Copy link
Contributor

Status: not really a bug, it's the same case as rust-lang/rust#139737 (comment).

tl;dr sometimes for unreachable code paths LLVM inserts a special kind of panic-instruction - e.g. on x86 this:

#[inline(never)]
pub fn foo() {
    unsafe {
        core::hint::unreachable_unchecked();
    }
}

... gets compiled into:

playground::foo:
	ud2

... with ud2 being this sort of hardware-level panic / abort instruction.

There's no ud2 equivalent for AVR, so LLVM just inserts a call to a function called abort, expecting for user to define what should happen then (we might loop {}, write something to uart, blink leds etc.). Notably, this is different from #[panic_handler], because panic!() is a Rust-specific construct, while trapping (aborting) is much more low-level (there's no &PanicInfo available etc.).

Overall:

So tl;dr not a bug - at the same time, I understand that 99% of people don't want to be bothered with this, "do whatever" will work just fine for them; I think we might be able to get the best of both worlds (provide a default function, but allow to overwrite it) by utilizing weak symbols (we'd create a weak fn abort() within compiler-builtins).

I'll experiment and report back.

@Patryk27
Copy link
Contributor

Ok, seems we're ready!

I've checked nightly-2025-04-27 and the examples build on my machine now 🙂

Some floating point intrinsics were added in this newer version which
helps on systems where these intrinsics are not provided by avr-gcc.
@Rahix Rahix force-pushed the nightly-2025-04-17 branch from 90abdf7 to 5a67aae Compare April 28, 2025 01:16
@Rahix Rahix changed the title Update toolchain to 2025-04-17 Update toolchain to 2025-04-27 Apr 28, 2025
@Rahix Rahix force-pushed the nightly-2025-04-17 branch from 5a67aae to fcfce82 Compare April 28, 2025 01:31
@Rahix
Copy link
Owner Author

Rahix commented Apr 28, 2025

Very nice, thanks you!!

@Rahix Rahix merged commit 8def780 into main Apr 28, 2025
27 checks passed
@Rahix Rahix deleted the nightly-2025-04-17 branch April 28, 2025 01:35
Rahix added a commit to Rahix/avr-hal-template that referenced this pull request Apr 28, 2025
See [1] for details.

Some floating point intrinsics were added in this newer version which
helps on systems where these intrinsics are not provided by avr-gcc.

[1]: Rahix/avr-hal#651
Rahix added a commit to Rahix/avr-device that referenced this pull request Apr 28, 2025
See [1] for details.

Some floating point intrinsics were added in this newer version which
helps on systems where these intrinsics are not provided by avr-gcc.

[1]: Rahix/avr-hal#651
Rahix added a commit to Rahix/avr-device that referenced this pull request Apr 28, 2025
See [1] for details.

Some floating point intrinsics were added in this newer version which
helps on systems where these intrinsics are not provided by avr-gcc.

[1]: Rahix/avr-hal#651
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Projects making floating-point operations fail building during linking after toolchain version bump
2 participants