Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add intial support for wasm32-unknown-wasi #1307
Add intial support for wasm32-unknown-wasi #1307
Changes from 1 commit
87def1f
8662b47
bce4454
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Is this really necessary?
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.
IIRC it was to get some more of the libc APIs to show up, but I can play around with it once we turn this verification on
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.
typo: "bug"/"but"
typo: "improt"/"import"
So IIUC the issue here is that "libc" (wasi/the sysroot) is linked statically into both the Rust code (due to "-C target-feature=+crt-static"), and the C code, and that when these two are linked, two copies of the "libc" are present in the final binary. This is super-unfortunate.
Have you tried whether
-C lto=fat
solves the issue ? That might be too brittle. Alternatively, maybe for this target it might make sense to not link the C code (or the Rust code) to the sysroot when compiling, so that when Rust and C are linked together, there is only one sysroot.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.
Nah this is actually a different issue that's somewhat deeper in LLD and unrelated to linkage/LTO/etc. It has to do with an LLVM module that looks like:
Both
bar1
andbar2
reference the same function, but due to how LLD is implemented these show up as two different functions in the final binary, where the same name is imported twice (giving the same function two different function indices).It's not really an issue, just a minor thing that will likely get fixed in LLD at some point.