-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Stage2: wasm-linker - Only export symbols notated as such #10517
Conversation
This is interesting. The error in the CI actually only happens when using |
Note that this very well may be a bug with Wasmtime. Great job btw! |
Should we switch to wasmer in the CI, or perhaps upgrade to a newer wasmtime version? |
It appears that under the current WASI application ABI, instances may assume exports are not accessed when using the Here's how I think we should solve it for now: |
Sounds reasonable to me! |
This exposes a function from stage2 to stage1 to append symbols to automatically export them. This happends under the following conditions: - Target is wasm - User has not provided --export/--rdynamic flags themselves.
c9e6474
to
21c4720
Compare
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.
Nice work! Just need an additional cache input and then this is good to go.
21c4720
to
1b054c3
Compare
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.
After making the previous review, I realized my suggestion about the cache hash is incorrect, since export_symbol_names
depends only on the source files and cannot be overridden by CLI args.
This is good to merge.
1b054c3
to
da6da66
Compare
The Windows failure does look potentially relevant. The failing test is using the wasm32-wasi target. |
7f38005
to
e4fd1e8
Compare
Failure definitely seems to be related to this change, as it is reproducible on the CI. However, I fail to see why this is happening on Windows only. I'll see if I can rent out some cheap Windows VM as I don't own any Windows machine nor have the RAM to run a VM that hosts Windows and is able to build the compiler. Will need some more time to get this PR ready, but we'll get there! |
75a8f43
to
26c526c
Compare
Interestingly, commenting out the call to |
26c526c
to
231ccde
Compare
Also skip exporting non-function symbols when we're building a WASI command using the stage2 llvm backend.
231ccde
to
247b638
Compare
@Luukdegram I got my local Win10 installation setup for development today so can have a look at this failure tomorrow. Will keep you posted! |
This exposes a function from stage2 to stage1 to append symbols to automatically export them.
Stage1 will only call this function when the target is wasm.
The linker will then only append
--export=<symbol>
for when the user has not done so manually and did not provide the-rdynamic
flag also. This allows the user to still override the default behavior do they wish to.I also went ahead and implemented the same behavior for the LLVM backend when using stage2, meaning we can remove all stage1 related code for this without losing the behavior when stage2 becomes the default compiler.
Closes #2910
Closes #7133