# link: don't link system libs by the wasm linker · gitcafe/zig

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

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

Visibility: public

Requested revision: b82d6422ac5c0a68b812319f689b66b52b0eaf59

Requested commit: b82d6422ac5c0a68b812319f689b66b52b0eaf59

Commit: b82d6422ac5c0a68b812319f689b66b52b0eaf59

Tree: 77d72cbf28a637f523ac27ccbc0a2499a75a501a

Author: Jakub Konka

Committer: Jakub Konka

## Message

````
link: don't link system libs by the wasm linker

The only allowed system libraries that we can link are libraries
that are part of the sysroot such as libc or WASI emulated
subcomponents. This is required as Wasm allows to defer symbol
resolution until load time.

For example, the following import in Zig

```zig
extern "wasi_snapshot_preview1" fn proc_exit() void;
```

would normally result in appending `-lwasi_snapshot_preview1` flag
to the linker line. However, for Wasm/WASI, the symbol is provided
at load rather than link time, therefore, the linker should not be
concerned with resolving the symbol. As a result, we should not
consider system libs by the Wasm linker.

````

## Parents

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

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