mirror of
https://github.com/ziglang/zig.git
synced 2026-01-10 09:25:11 +00:00
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.
This commit is contained in:
parent
f9a3413112
commit
ec21da0d51
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user