Skip to content
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

Compatibility issue with rust 1.82. #862

Closed
kareled opened this issue Aug 26, 2024 · 7 comments
Closed

Compatibility issue with rust 1.82. #862

kareled opened this issue Aug 26, 2024 · 7 comments
Labels
type: bug Something isn't working

Comments

@kareled
Copy link

kareled commented Aug 26, 2024

Hello,
not sure where to log it, but with update to 1.82 nightly my project link fails with missing __defmt_default_panic␍

The project builds for armv7emhf and it links fine code unchanged with various rustc toolchains up to including 1.81 nightly. Always using nightly due to RTIC usage. With nightly from 2024-08-03 (my first obtained nightly of 1.82 family) it starts to complain and fail while being linked with:

  = note: rust-lld: error: C:\Users\gardas\git\develop\target\thumbv7em-none-eabihf\debug\build\defmt-e20cffcd2d13aae7\out\defmt.x:7: symbol not found: __defmt_default_panic␍
          rust-lld: error: C:\Users\gardas\git\develop\target\thumbv7em-none-eabihf\debug\build\defmt-e20cffcd2d13aae7\out\defmt.x:7: symbol not found: __defmt_default_panic␍
          rust-lld: error: C:\Users\gardas\git\develop\target\thumbv7em-none-eabihf\debug\build\defmt-e20cffcd2d13aae7\out\defmt.x:7: symbol not found: __defmt_default_panic␍
          rust-lld: error: C:\Users\gardas\git\develop\target\thumbv7em-none-eabihf\debug\build\defmt-e20cffcd2d13aae7\out\defmt.x:7: symbol not found: __defmt_default_panic␍

          flip-link: the native linker failed to link the program normally; please check your project configuration and linker scripts

If this is not defmt issue, please recommend where to report it while closing. Thanks!

@Urhengulas Urhengulas added the type: bug Something isn't working label Aug 27, 2024
@skade
Copy link
Contributor

skade commented Oct 8, 2024

This is due to upstream bug rust-lang/rust#131164

@Urhengulas
Copy link
Member

@Dirbaio said:

A possible workaround defmt could do is adding EXTERN(_defmt_panic) to the linker script. The side effect is it'd prevent the panic handler from being optimized out when it's truly unused, I think.

I can confirm this works as a workaround on current beta. Let's hope it won't be necessary, but if the upstream fix does not make it into stable we can use it.

@Urhengulas
Copy link
Member

It probably should be EXTERN(__defmt_default_panic) instead of EXTERN(_defmt_panic)

@Dirbaio
Copy link
Contributor

Dirbaio commented Oct 9, 2024

I think EXTERN(_defmt_panic) is better because if the user has defined their own panic handler, i'tll just force-keep that one, and the default one will be optimized out. If you do EXTERN(__defmt_default_panic) it'll force-keep the default one even if the user has overridden it.

(I haven't actually tested this, i'm just guessing based on my mental model of how links work which might be wrong because linkers are cursed)

@Urhengulas
Copy link
Member

Current beta contains the fix, so no action is necessary from our side. We will still have a look if adding the extern to the linker script makes sense in case the issue comes back.

@jannic
Copy link
Contributor

jannic commented Oct 16, 2024

Stable pre-release (https://internals.rust-lang.org/t/rust-1-82-0-pre-release-testing/21705) also contains the fix.

@Urhengulas
Copy link
Member

Perfect. Thanks to everyone involved in managing the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants
@skade @jannic @Dirbaio @Urhengulas @kareled and others