# wasm-linker: fix type index relocations · gitcafe/zig

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

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

Visibility: public

Requested revision: 2a62dbda0bb5e5c8a1c92a058b684309bd7efeeb

Requested commit: 2a62dbda0bb5e5c8a1c92a058b684309bd7efeeb

Commit: 2a62dbda0bb5e5c8a1c92a058b684309bd7efeeb

Tree: 923fba4c3fff74adf5e5e7f2ec921b6c7825ba46

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm-linker: fix type index relocations

Previously we used the relocation index to find the corresponding
symbol that represents the type. However, the index actually
represents the index into the list of types. We solved this by
first retrieving the original type, and then finding its location
in the new list of types. When the atom file is 'null', it means
the type originates from a Zig function pointer or a synthetic
function. In both cases, the final type index was already resolved
and therefore equals to relocation's index value.

```

## Parents

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

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