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

#![no_std] support #20

Closed
est31 opened this issue Jun 12, 2018 · 7 comments
Closed

#![no_std] support #20

est31 opened this issue Jun 12, 2018 · 7 comments

Comments

@est31
Copy link

est31 commented Jun 12, 2018

It seems that this library is needed when we want to include addr2line into libstd (rust-lang/rust#46439). In order for this to be possible, we require #![no_std] support though.

@est31
Copy link
Author

est31 commented Jun 12, 2018

I've had a look at the code and most of the stuff seems to be portable, except for the usage of CStr. But as CStr is just a wrapper around C pointers, we can just expose &[c_uchar] instead, or something like that.

@mitsuhiko
Copy link
Contributor

I found the return value of CStr quite annoying to deal with even in std use. I was considering to propose to change it to OsStr but that is also not possible in nostd. One option I find quite appealing is to have name() return &[c_uchar] and have a high level wrapper that converts name into a Path which is what library users are likely to be interested in anyways.

@fitzgen
Copy link
Member

fitzgen commented May 22, 2019

@alexcrichton do you have any ideas on how to both

  • support windows, which uses utf-16 for various section/segment/etc names (aka OsStr)
  • support #![no_std] for inclusion in libstd (no OsStr)

I guess we could have multiple name methods on Segment and SharedLibrary that return the name as a OsStr or raw bytes, and then we can cfg their presence on/off based on what we are targeting...

See also #36

@alexcrichton
Copy link

I honestly haven't really thought through what would be necessary to move backtrace-the-crate to gimli by default, which currently requires this being #![no_std] and such. I think that taking exactly what's there today and #![no_std]-ifying it is probably not the way to go. Something like this crate I don't think really makes sense in a #![no_std] world since backtrace would probably be the only users and that's exclusively because it's built into libstd.

I've written up some thoughts about gimil-by-default in the backtrace crate at rust-lang/backtrace-rs#189. That'll probably change a lot over time though!

@mitsuhiko
Copy link
Contributor

I would generally like to restructure the crate a tad because some of the things here don't necessarily make too much sense at this point. I think it might be useful to see what data backtrace needs from here and then figure out a no-std version specifically for backtrace and nothing more.

@philipc
Copy link
Contributor

philipc commented Oct 2, 2021

backtrace is using addr2line without needing this.

@philipc philipc closed this as completed Oct 2, 2021
@est31
Copy link
Author

est31 commented Oct 2, 2021

Yeah the issue isn't important any more due to the findshlibs dependency having been removed from the backtrace crate: rust-lang/backtrace-rs#314

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

No branches or pull requests

5 participants