diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-06-04 03:44:55 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-06-04 06:48:19 +0200 |
| commit | a81fb5fb76131d0df3042f20e2d20a3b9216b254 (patch) | |
| tree | 65306edd14da5500e59a54107d159b248237e78a /src/Compilation.zig | |
| parent | 826e1c30ba81884e1a8fad8664b3da17953d89d1 (diff) | |
| download | zig-a81fb5fb76131d0df3042f20e2d20a3b9216b254.tar.gz zig-a81fb5fb76131d0df3042f20e2d20a3b9216b254.zip | |
compiler: Rework PIE option logic.
To my knowledge, the only platforms that actually *require* PIE are Fuchsia and
Android, and the latter *only* when building a dynamically-linked executable.
OpenBSD and macOS both strongly encourage using PIE by default, but it isn't
technically required. So for the latter platforms, we enable it by default but
don't enforce it.
Also, importantly, if we're building an object file or a static library, and the
user hasn't explicitly told us whether to build PIE or non-PIE code (and the
target doesn't require PIE), we should *not* default to PIE. Doing so produces
code that cannot be linked into non-PIE output. In other words, building an
object file or a static library as PIE is an optimization only to be done when
the user knows that it'll end up in a PIE executable in the end.
Closes #21837.
Diffstat (limited to 'src/Compilation.zig')
0 files changed, 0 insertions, 0 deletions
