# zig cc: Respect Clang's \-static and \-dynamic flags\. · gitcafe/zig

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

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

Visibility: public

Requested revision: 6a8228603c924f8e091c52b98f8043e02843c358

Requested commit: 6a8228603c924f8e091c52b98f8043e02843c358

Commit: 6a8228603c924f8e091c52b98f8043e02843c358

Tree: c5147dcbdd0e3c4103075924ba6ea70daac3c665

Author: Alex Rønne Petersen

Committer: Alex Rønne Petersen

## Message

```
zig cc: Respect Clang's -static and -dynamic flags.

Before:

    ❯ zig cc main.c -target x86_64-linux-musl && musl-ldd ./a.out
    musl-ldd: ./a.out: Not a valid dynamic program
    ❯ zig cc main.c -target x86_64-linux-musl -static && musl-ldd ./a.out
    musl-ldd: ./a.out: Not a valid dynamic program
    ❯ zig cc main.c -target x86_64-linux-musl -dynamic && musl-ldd ./a.out
    musl-ldd: ./a.out: Not a valid dynamic program

After:

    ❯ zig cc main.c -target x86_64-linux-musl && musl-ldd ./a.out
    musl-ldd: ./a.out: Not a valid dynamic program
    ❯ zig cc main.c -target x86_64-linux-musl -static && musl-ldd ./a.out
    musl-ldd: ./a.out: Not a valid dynamic program
    ❯ zig cc main.c -target x86_64-linux-musl -dynamic && musl-ldd ./a.out
            /lib/ld-musl-x86_64.so.1 (0x72c10019e000)
            libc.so => /lib/ld-musl-x86_64.so.1 (0x72c10019e000)

Closes #11909.

```

## Parents

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

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