diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-10-18 00:01:33 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-10-18 17:47:57 -0400 |
| commit | ec21da0d51afa9b688ed99425b307e23a9c57a07 (patch) | |
| tree | c4550372d33a445e2da6ff9eebab0a955e56eea9 /src/Compilation.zig | |
| parent | f9a34131128dffaeac7561afe34956ec2ee17fef (diff) | |
| download | zig-ec21da0d51afa9b688ed99425b307e23a9c57a07.tar.gz zig-ec21da0d51afa9b688ed99425b307e23a9c57a07.zip | |
compiler: fix LTO availability logic
Before this commit, the logic would fail with a "LTO not available"
error if the user set `-fno-lto` which doesn't make sense. This commit
corrects the logic to understand when the user is explicitly requesting
to turn LTO off.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index cb5281c696..8032e67943 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -946,13 +946,13 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { }; const lto = blk: { - if (options.want_lto) |explicit| { - if (!use_lld and !options.target.isDarwin()) + if (options.want_lto) |want_lto| { + if (want_lto and !use_lld and !options.target.isDarwin()) return error.LtoUnavailableWithoutLld; - break :blk explicit; + break :blk want_lto; } else if (!use_lld) { - // TODO zig ld LTO support - // See https://github.com/ziglang/zig/issues/8680 + // zig ld LTO support is tracked by + // https://github.com/ziglang/zig/issues/8680 break :blk false; } else if (options.c_source_files.len == 0) { break :blk false; |
