stage2: wasm - Initial C-ABI implementation #11521
Merged
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.
This implements an initial round of changes to support the C-ABI as specified by https://github.com/WebAssembly/tool-conventions/blob/main/BasicCABI.md.
The goal of these changes is to implement the base required to support linking with compiler-rt. As compiler-rt will be built by the LLVM backend by default, we must ensure the ABI's between the backends match. Above mentioned C-ABI matches that of clang to ensure we have maximum compatibility with other compilers as well.
There are definitely some rough edges with regards to branching (in the backend) and codegen that could be improved. But before doing that, I'd like to implement basic compiler-rt linking first, so I get a better view of how to structure the backend.
In the near future, I'd like to enable the C-ABI tests specified in https://github.com/ziglang/zig/tree/master/test/stage1/c_abi for the wasm backend as well.