# wasm-linker: implement \_\_wasm_call_ctors symbol · gitcafe/zig

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

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

Visibility: public

Requested revision: f8d1efd99ab0ff9ae49a17b437814f4fe329e83b

Requested commit: f8d1efd99ab0ff9ae49a17b437814f4fe329e83b

Commit: f8d1efd99ab0ff9ae49a17b437814f4fe329e83b

Tree: 411dca0d212597b6498098146a2429a75de04490

Author: Luuk de Gram

Committer: Luuk de Gram

## Message

```
wasm-linker: implement __wasm_call_ctors symbol

This implements the `__wasm_call_ctors` symbol. This symbol is
automatically referenced by libc to initialize its constructors.
We first retrieve all constructors from each object file, and then
create a function body that calls each constructor based on its
priority. Constructors are not allowed to have any parameters, but are
allowed to have a return type. When a return type does exist, we simply
drop its value from the stack after calling the constructor to ensure
we pass the stack validator.

```

## Parents

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

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