# link: handle \-u flag in all linkers · gitcafe/zig

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

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

Visibility: public

Requested revision: a88c0b4d089d286e36351cf476c8d982fb730541

Requested commit: a88c0b4d089d286e36351cf476c8d982fb730541

Commit: a88c0b4d089d286e36351cf476c8d982fb730541

Tree: a4d985e8a6bd7f7b36b66f24e21e1ff53ff5303a

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
link: handle -u flag in all linkers

Also clean up parsing of linker args - reuse `ArgsIterator`.

In MachO, ensure we add every symbol marked with `-u` as undefined
before proceeding with symbol resolution. Additionally, ensure those
symbols are never garbage collected.

MachO entry_in_dylib test: pass `-u _my_main` when linking executable
so that it is not incorrectly garbage collected by the linker.

```

## Parents

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

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