# frontend: fix stack protector option logic · gitcafe/zig

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

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

Visibility: public

Requested revision: 43720be04af8ddb8334b210ff936a834fb8871a7

Requested commit: 43720be04af8ddb8334b210ff936a834fb8871a7

Commit: 43720be04af8ddb8334b210ff936a834fb8871a7

Tree: 884a175200dc948e2a1bb40fb10472f356f2a9af

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
frontend: fix stack protector option logic

Commit 97e23896a9168132b6d36ca22ae1af10dd53d80d regressed this behavior
because it made target_util.supportsStackProtector *correctly*
notice which zig backend is being used to generate code, while the
logic calling that function *incorrectly assumed* that .zig code is being
compiled, when in reality it might be only C code being compiled.

This commit adjusts the option resolution logic for stack protector so
that it takes into account the zig backend only if there is a zig
compilation unit. A separate piece of logic checks whether clang
supports stack protector for a given target.

closes #18009
closes #18114
closes #18254

```

## Parents

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

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