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

Translator for start function (remapstart) #99

Closed
axic opened this issue Jun 2, 2019 · 8 comments · Fixed by #107
Closed

Translator for start function (remapstart) #99

axic opened this issue Jun 2, 2019 · 8 comments · Fixed by #107

Comments

@axic
Copy link
Member

axic commented Jun 2, 2019

  1. Rename the function pointed to by the start section to main. If there is another function named main, rename it (prefix it with _) to avoid conflict – if there this conflicts with another function, keep adding underscore prefixes until it won't.

  2. Remove the start section. (See dropstartfunction.)

@jwasinger
Copy link
Contributor

Gonna take this one on

@jwasinger
Copy link
Contributor

jwasinger commented Jun 4, 2019

(See dropstartfunction.)

What do you mean by this? Referring to the pwasm API I am guessing.

@axic
Copy link
Member Author

axic commented Jun 4, 2019

(See dropstartfunction.)

What do you mean by this? Referring to the pwasm API I am guessing.

https://github.com/wasmx/wasm-chisel/blob/master/libchisel/src/trimstartfunc.rs

@jakelang
Copy link
Collaborator

jakelang commented Jun 8, 2019

@axic I see no real reason to drop the names section, as export names are unique. The names section exists solely as a custom section to aid debuggers and other binary tools.

@axic
Copy link
Member Author

axic commented Jun 8, 2019

The reason is that we were lazy to check if the exported names are duplicated in the names section.

@jakelang
Copy link
Collaborator

jakelang commented Jun 8, 2019

They aren't, and the names section doesn't seem to matter anyway. Maybe introducing another module for that later would make more sense (as opposed to implicit behavior in remapstart).

@axic
Copy link
Member Author

axic commented Jun 8, 2019

We have another which removes sections. It does matter because we don't want to generate an invalid output.

This is the spec: https://webassembly.github.io/spec/core/appendix/custom.html#name-section

@axic
Copy link
Member Author

axic commented Jun 8, 2019

Agreed that other transformations changing the export section don't deal with the names section. We should clarify this and fix if needed, but we can do it after remapstart.

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 a pull request may close this issue.

3 participants