# link/Wasm: improve symbol resolution · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/4f2143beccb822f42c77d1d6c5ad31388123803e)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 4f2143beccb822f42c77d1d6c5ad31388123803e

Requested commit: 4f2143beccb822f42c77d1d6c5ad31388123803e

Commit: 4f2143beccb822f42c77d1d6c5ad31388123803e

Tree: f17629e9875ad5086ec7e90820096a3746764ca9

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
link/Wasm: improve symbol resolution

This adds additional checks during symbol resolution:
- Ensures function signatures match when a symbol will be replaced.
- Ensures global types match when the symbol is being replaced.
- When both symbols are undefined, ensures they have a matching module name.

Those changes ensure the result will pass the validator when
the runtime compiles the Wasm module.

Additionally, this also slightly changes the behavior when both
the existing symbol and new symbol are both defined. Rather than
always resulting in a collision, it only results in a collision
when both are also weak. Else, the non-weak symbol will be picked.

```

## Parents

- [63c25cc1cc4aef1ae5c7425496d99b30db2f44d7](https://git.cafe/gitcafe/zig/commit/63c25cc1cc4aef1ae5c7425496d99b30db2f44d7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/4f2143beccb822f42c77d1d6c5ad31388123803e?format=markdown)
