Skip to content

Conversation

MabezDev
Copy link
Member

The changes from rust-lang/compiler-builtins#517 have landed.

I suppose this might break stuff for people who don't upgrade to 1.70, but they can always add there own stub if they want.

@bugadani
Copy link
Contributor

I think given my curse I'd prefer some conditional compilation trickery that only removes this function when using >= 1.70

@MabezDev
Copy link
Member Author

MabezDev commented Jun 1, 2023

I think given my curse I'd prefer some conditional compilation trickery that only removes this function when using >= 1.70

I'm not sure we should keep this workaround in tbh, even behind a cfg. Anyone using <1.70.0.0 can just add the workaround back into their bin crate. Patching this sort of thing in a library is not a good idea.

@MabezDev
Copy link
Member Author

MabezDev commented Jun 1, 2023

welp I take it back because apparently, soft-float is missing intrinsic's for RISCV too? wtf?

@bjoernQ
Copy link
Contributor

bjoernQ commented Jun 2, 2023

I guess a cfg-gate for Xtensa / RISCV would be good enough plus probably mention this in the README for now (i.e. what a user should do if there they get undefined symbol: floor)

@MabezDev
Copy link
Member Author

MabezDev commented Jun 2, 2023

Maybe (if we don't mind another nightly feature) we can mark it with weak linkage? I really don't like the idea of having this symbol in a library crate, IMO this should really be patched in the final binary crate.

@bugadani
Copy link
Contributor

bugadani commented Jun 2, 2023

this should really be patched in the final binary crate.

This is kinda breaking the stability guarantees that rust usually holds (yes, I know the library is independent of the language, but the philosophy is similar enough): a compiler upgrade shouldn't break existing code. The workaround is easy enough in esp-wifi (though cfg(version) is unstable). I agree that the function has no logical place inside esp-wifi but if this is a problem, it can be moved to some support crate.

@MabezDev
Copy link
Member Author

MabezDev commented Jun 2, 2023

This is kinda breaking the stability guarantees that rust usually holds (yes, I know the library is independent of the language, but the philosophy is similar enough): a compiler upgrade shouldn't break existing code. The workaround is easy enough in esp-wifi (though cfg(version) is unstable). I agree that the function has no logical place inside esp-wifi but if this is a problem, it can be moved to some support crate.

Whilst I agree, this actually introduces a breaking change time bomb for the future, the second this intrinsic is available for RISCV, builds stop working when upgrading the compiler. This is what happened with 1.70.0 using esp-wifi on Xtensa chips. That's what I'm trying to avoid.

Interestingly, it seems the failure is only on the C6 (riscv32imac) but the other chips (riscv32imc) seem to compile fine, no idea why that would be.

@bugadani

This comment was marked as outdated.

@bjoernQ
Copy link
Contributor

bjoernQ commented Jun 2, 2023

This is kinda breaking the stability guarantees that rust usually holds (yes, I know the library is independent of the language, but the philosophy is similar enough): a compiler upgrade shouldn't break existing code. The workaround is easy enough in esp-wifi (though cfg(version) is unstable). I agree that the function has no logical place inside esp-wifi but if this is a problem, it can be moved to some support crate.

Whilst I agree, this actually introduces a breaking change time bomb for the future, the second this intrinsic is available for RISCV, builds stop working when upgrading the compiler. This is what happened with 1.70.0 using esp-wifi on Xtensa chips. That's what I'm trying to avoid.

Interestingly, it seems the failure is only on the C6 (riscv32imac) but the other chips (riscv32imc) seem to compile fine, no idea why that would be.

I think it's only breaking C6 since the blobs for C2/C3 don't include code that needs floor

I guess if it's solvable with weak linking that wouldn't be a bad thing (and we need nightly anyway)

I also agree it shouldn't be ideally solved in the library but will make the user's lives much easier

@MabezDev MabezDev force-pushed the remove-uneeded-intrinsic-stub branch from 96045e2 to f6425ae Compare June 2, 2023 12:22
@MabezDev
Copy link
Member Author

MabezDev commented Jun 2, 2023

I've gone with the weak linkage option because if we're pulling in an unstable feature we may as well use the one that requires less work to maintain.

By the way it looks like in the future all intrinsics from compiler builtins could become weak by default.

Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MabezDev MabezDev merged commit 44110b9 into esp-rs:main Jun 2, 2023
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.

3 participants