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

Generate a $start function when compiling a binary. #108

Open
lachlansneff opened this issue Apr 5, 2018 · 9 comments
Open

Generate a $start function when compiling a binary. #108

lachlansneff opened this issue Apr 5, 2018 · 9 comments

Comments

@lachlansneff
Copy link

Currently, rust doesn't not generate a $start function when compiling a binary to wasm. This should be added at some point.

@mgattozzi
Copy link
Contributor

This is part of what's being discussed in #16

@alexcrichton
Copy link
Contributor

This was also the subject of https://github.com/rust-lang-nursery/rust-wasm/issues/18 which has a lot of detailed discussion about start and such. I believe the overall conclusion is that we'd want an opt-in to using the start symbol, and bundlers may adopt a convention of auto-running a main symbol at an appropriate time.

@lachlansneff
Copy link
Author

Okay, an opt-in solution sounds good. I'm not sure how libstd would support this, though, since it seems to have a single entry point for all architectures in rt.rs.

@alexcrichton
Copy link
Contributor

@lachlansneff oh the main symbol itself is manufactured in the compiler so I don't think it'll be too too difficult here. We should probably go ahead and change the main symbol to not have any arguments on wasm.

@lachlansneff
Copy link
Author

Is there any progress on this? Nebulet is very close to being ready for application and driver development and it waiting on this.

@alexcrichton
Copy link
Contributor

Currently, no, but a champion to design and implement it would be most welcome!

@lachlansneff
Copy link
Author

Sure, I'd be happy to! I'll need some guidance though; I haven't delved into the rustc internals before.

@lachlansneff
Copy link
Author

Also, I'm not so sure about opt-in. Seems to me that having a fn main() in your program counts as opt-in to me.

@lachlansneff
Copy link
Author

lachlansneff commented Jun 25, 2018

This was discussed in the last meeting and it was decided that rustc should generate a start function.

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

3 participants