-
Notifications
You must be signed in to change notification settings - Fork 25
Initial libstd support #17
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
Conversation
|
I believe the base address can be zero. Probably just using |
5baf0dc to
dee0b04
Compare
|
Good point -- I've adjusted the API accordingly. |
|
CI is failing due to rust-lang/rust#108955 denying |
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.
CI is now fixed, please rebase on latest trunk.
src/unwinder/find_fde/custom.rs
Outdated
| if let Some(text_base) = text_base { | ||
| bases = bases.set_text(text_base as _); | ||
| } | ||
| let eh_frame_hdr = |
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.
On my machine this change is undone by running cargo fmt. Did you have a global rustfmt config?
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 have it as a subdirectory of the rust project, and I think they use some nonstandard settings that rustfmt must have picked up even though it's a different repository.
I've moved it out of the rust directory and re-run cargo fmt without anything in any directories above it.
dee0b04 to
27922b3
Compare
|
On the implementation side; do you think it makes sense to just use 0 as text_base when it's unknown instead of I think you mentioned in Zulip the issue is that LLVM doesn't expose the start of text section by default? Could you give more context about this, and how do you define the custom FDE finder? We might be able to find a solution to use one of the existing FDE finder or get the text base using some other method. |
|
How does the Also it makes sense for this to be a |
|
If you try to get textrel base when it's not set, you get a panic (which will get turned into abort), so it's not exactly the same as getting a zero. However it was pointed out that textrel base isn't actually being used and LLVM libunwind does not support it, so it won't have any observable difference. GCC's unwinder does support textrel and will report 0 if not set, but from some digging it seems that it was only used by IA64 and some other non-mainstream architectures and they are no longer generating it. |
Ah I see; thanks for the explanation. How does it impact whether it's set or not; is it purely during what IP is returned? In which case if it isn't supported anymore is the caller expected to be doing the textrel base offsetting to get the non-reloced address? Are there reasons on why the design choice was made by llvm to not support it?
That makes sense, in that case I can see why |
|
No, |
Support using `unwinding` as a backend for the libstd `unwind` crate. This will enable unwinding support for new targets while allowing us to continue to use `libunwind` from llvm for supported targets. Signed-off-by: Sean Cross <[email protected]>
No platforms currently use relative addressing. Make this parameter optional in order to support targets where this value is not available. Signed-off-by: Sean Cross <[email protected]>
27922b3 to
caab987
Compare
|
I've rebased on top of trunk. I think that What if all of the unwinders were changed to |
|
I'll take this as part of 0.2.0 release. There're some functions that are not supposed to be safe exposed in |
This PR contains two patches required to allow
unwindingto be used withlibstd.As background, I'm porting
libstdto the Xous operating system. This is an embedded target.In the past I've applied patches to
libunwindin order to get it to work, however those patches are very difficult to get upstream. A recent change in llvm made C compiling difficult (https://reviews.llvm.org/D156642), and additional patches will be needed on top of Rust's hacked-up version of LLVM that adds support for SGX.With these patches, along with an
unwindingbackend for the Rustunwindcrate, I'm able to run tests and catch panics in Xous.This patchset does two things:
coreoptional, which is necessary for building as part of the treetext_baseoptional, which is required due to the fact that Xous doesn't have this information and no platforms currently use it anywayWhile it's true that (2) is an API-level change, this API is not documented in either docs.rs or the
examples/directory, so I'm not sure how widely used it is.