diff options
| author | imreallybadatnames™️ <68000899+imreallybadatnames@users.noreply.github.com> | 2025-04-09 16:16:36 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-09 05:16:36 +0000 |
| commit | 7733b5dbe603033a1ed9e8d0146ef7432d5ffd5b (patch) | |
| tree | c8f2ff9bdd944039b012e05ec30ffd7126e75c88 /lib/std/Build | |
| parent | 227788e6d5025933d6d70086fb939dcf487fee0a (diff) | |
| download | zig-7733b5dbe603033a1ed9e8d0146ef7432d5ffd5b.tar.gz zig-7733b5dbe603033a1ed9e8d0146ef7432d5ffd5b.zip | |
Merge pull request #23501 from imreallybadatnames/master
Step.Compile: use LtoMode enum for lto option
Diffstat (limited to 'lib/std/Build')
| -rw-r--r-- | lib/std/Build/Step/Compile.zig | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/std/Build/Step/Compile.zig b/lib/std/Build/Step/Compile.zig index cbcb71304f..2515893384 100644 --- a/lib/std/Build/Step/Compile.zig +++ b/lib/std/Build/Step/Compile.zig @@ -167,6 +167,9 @@ discard_local_symbols: bool = false, /// Position Independent Executable pie: ?bool = null, +/// Link Time Optimization mode +lto: ?std.zig.LtoMode = null, + dll_export_fns: ?bool = null, subsystem: ?std.Target.SubSystem = null, @@ -185,7 +188,9 @@ force_undefined_symbols: std.StringHashMap(void), /// Overrides the default stack size stack_size: ?u64 = null, +/// Deprecated; prefer using `lto`. want_lto: ?bool = null, + use_llvm: ?bool, use_lld: ?bool, @@ -1711,7 +1716,15 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 { } try addFlag(&zig_args, "PIE", compile.pie); - try addFlag(&zig_args, "lto", compile.want_lto); + + if (compile.lto) |lto| { + try zig_args.append(switch (lto) { + .full => "-flto=full", + .thin => "-flto=thin", + .none => "-fno-lto", + }); + } else try addFlag(&zig_args, "lto", compile.want_lto); + try addFlag(&zig_args, "sanitize-coverage-trace-pc-guard", compile.sanitize_coverage_trace_pc_guard); if (compile.subsystem) |subsystem| { |
