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] no longer works #9839

Closed
alexcrichton opened this issue Oct 13, 2013 · 8 comments
Closed

#[no_std] no longer works #9839

alexcrichton opened this issue Oct 13, 2013 · 8 comments

Comments

@alexcrichton
Copy link
Member

Once #9834 gets merged, #[no_std] will no longer work for any crates. The reason for this is that __morestack now requires a rust_stack_exhausted function. We should provide crates linking with #[no_std] a dummy implementation of __morestack which invokes abort() so that they may continue to compile.

Furthermore, a crate should also be able to say "I'm providing my own morestack" and we don't link to libmorestack.a by default regardless.

@huonw
Copy link
Member

huonw commented Oct 13, 2013

Could rust_stack_exhausted be a lang-item that is used (or, at least, checked that it exists) for any function not marked with #[no_split_stack]?

(NB. I have no understanding of the implementation in #9834 at all.)

@alexcrichton
Copy link
Member Author

In theory it's possible, but this can't be a normal language item int he sense that it's required to have #[no_split_stack] and it's also required to very quickly deal with the stack having been overflowed, which without some fun inline assembly and weird dances, will be hard to write in rust.

I do suppose though that a lang item is a nice way to wire this up, but I still like the idea of having a #[no_std] crate "just compile" with fn main(_: int, _: **u8) -> int { 0 } because that's kind of what you expect.

@alexcrichton
Copy link
Member Author

I'm going to close this because I don't believe that there's much to do as a result of this. This attribute "just working" depends on having a solution for whether the __morestack prologue should be present or not. We have chosen for now for this to always be there, so I think that this is essentially working as intended.

@thestinger
Copy link
Contributor

It still doesn't work, though. It's not possible to use freestanding Rust without using clang as the backend. This isn't the only problem, another is that Rust provides no way to mark external functions as not throwing and then inserts calls to the segmented stack adjustment call.

@alexcrichton
Copy link
Member Author

I'd recommend opening up more specific issues for those problems, I don't think this "it doesn't work" blanket issue works very well for tracking progress.

@thestinger
Copy link
Contributor

I don't think metabugs are very useful either, but I'm not sure what the specific solution to these problems should be.

@brson
Copy link
Contributor

brson commented Jan 29, 2014

Is there a followup to this issue?

@thestinger
Copy link
Contributor

#11871 blocks using rustc to compile freestanding/runtimeless code itself without using clang or llc near the Rust version. Rust doesn't install either of these and adding a step to building is quite annoying.

#10780 blocks using static linking rather than link-time optimization.

#10116 is an annoyance forcing the extra step of building a separate crate with memcpy, memmove and memset.

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

4 participants