-
Notifications
You must be signed in to change notification settings - Fork 241
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
Solve the issue of not being able to override existing builtin functions under LTO. #728
Conversation
Solve the issue of not recognizing builtin functions under LTO.
@@ -37,6 +37,7 @@ | |||
|
|||
#![warn(missing_docs)] | |||
#![no_std] | |||
#![feature(naked_functions)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is my understanding correct that this is not stable yet ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's only on nightly. Are we going to use it on stable too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This library targets stable rust, yes. So nightly features can't be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that even stabilizing naked is not enough. Using compiler_builtins requires nightly.
But we can change it to default weak in rust. I think the key here is still to stabilize the naked first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please help me verify that the current modification works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, what can I do?
Currently, it doesn't build. Obviously not with stable, but I also get errors with nightly:
$ cargo +nightly build --release
[...]
Compiling rp2040-hal v0.9.1 (/home/jan/rp2040/rp-rs/rp-hal/rp2040-hal)
error: invalid instruction
--> rp2040-hal/src/sio.rs:299:22
|
299 | "hwdivider_head",
| ^
|
note: instantiated into assembly here
--> <inline asm>:1:2
|
1 | hwdivider_head
| ^
[...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this error yet. But I was able to compile it successfully at https://github.com/rp-rs/rp2040-project-template. I also need add compiler_builtins = { version = "0.1.104", features = ["weak-intrinsics"] }
to the rp2040-project-template.
I believe there are ways to not use |
Solve the rp-rs/rp2040-project-template#71 issue of not recognizing builtin functions under LTO.
Also set the builtin functions in compiler_builtins to weak.