# link.MachO: Add support for the \-x flag \(discard local symbols\)\. · gitcafe/zig

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

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

Visibility: public

Requested revision: f87b443af1f654d3363ce6a1081bdf7932ae354c

Requested commit: f87b443af1f654d3363ce6a1081bdf7932ae354c

Commit: f87b443af1f654d3363ce6a1081bdf7932ae354c

Tree: f4b242f4e9463026e1b53cab879fd21acbbb2e9a

Author: Alex Rønne Petersen

Committer: Alex Rønne Petersen

## Message

```
link.MachO: Add support for the -x flag (discard local symbols).

This can also be extended to ELF later as it means roughly the same thing there.

This addresses the main issue in #21721 but as I don't have a macOS machine to
do further testing on, I can't confirm whether zig cc is able to pass the entire
cgo test suite after this commit. It can, however, cross-compile a basic program
that uses cgo to x86_64-macos-none which previously failed due to lack of -x
support. Unlike previously, the resulting symbol table does not contain local
symbols (such as C static functions).

I believe this satisfies the related donor bounty: https://ziglang.org/news/second-donor-bounty

```

## Parents

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

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