# stage2: re-use compiler runtime libs across opt modes and strip flag · gitcafe/zig

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

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

Visibility: public

Requested revision: 6ab9268a9024fe8e9076f07cb207107d2cad0876

Requested commit: 6ab9268a9024fe8e9076f07cb207107d2cad0876

Commit: 6ab9268a9024fe8e9076f07cb207107d2cad0876

Tree: 64269aabb1a50ba35b9ac0951d9c365d2916be2e

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: re-use compiler runtime libs across opt modes and strip flag

Previously Zig would need to recompile runtime libs if you changed the
values of --strip or -O. Now, unless the `debug_compiler_runtime_libs`
flag is set (which is currently not exposed to the CLI), Zig will always
choose ReleaseFast or ReleaseSmall for compiler runtime libraries.

When the main application chooses ReleaseFast or ReleaseSmall, that
value is propagated to compiler runtime libraries. Otherwise a decision
is made based on the target, which is currently ReleaseSmall for
freestanding WebAssembly and ReleaseFast for everything else.

Ultimately the purpose of this commit is to have Debug and ReleaseSafe
builds of applications still get optimized builds of, e.g. libcxx and
libunwind, as well as to spend less time unnecessarily rebuilding compiler
runtime libraries.

```

## Parents

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

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