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

Remove weak symbols, use abort for defaults. #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rslawson
Copy link

@rslawson rslawson commented Jan 8, 2025

As per #247, using weak symbols for overridable functions has proven problematic with lto = true. This is a partial reversion of that, though there are still other functions this may yet be done with. There is also another solution to be done as a sort of nightly-only thing with naked functions and #[linkage = "weak"], however I have opted not to go with that seeing as this project doesn't currently require nightly and I don't think this is an issue worth changing that over.

@rslawson rslawson requested a review from a team as a code owner January 8, 2025 10:06
@rslawson
Copy link
Author

rslawson commented Jan 8, 2025

I think there may be something else that I need to do to the linker script, since as it is now it currently fails to build on one of the projects I'm working on with the error

  = note: rust-lld: error: 
          BUG(riscv-rt): start of .heap is not 4-byte aligned
          
          rust-lld: error: 
          BUG(riscv-rt): start of .heap is not 4-byte aligned

@romancardenas
Copy link
Contributor

Try to rebase from master. Build errors should disappear

@romancardenas
Copy link
Contributor

@rslawson please, add a brief note in README.md describing your changes

@rslawson
Copy link
Author

rslawson commented Jan 9, 2025

Yep, they did disappear. I'll make the change to README.md now. Are there any other symbols I should give the same treatment, or is it enough just to change DefaultHandler and ExceptionHandler?

Copy link
Contributor

@romancardenas romancardenas left a comment

Choose a reason for hiding this comment

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

LGTM.

I would like to discuss this work with @rust-embedded/all in the next meeting in case there is a better approach to deal with weak symbols and LTO optimizations in Rust.

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.

2 participants