From 82e7f23c49be10ce74cb1a951aa7cb77799c2798 Mon Sep 17 00:00:00 2001 From: Travis Lange Date: Fri, 3 Jan 2025 11:04:40 -0500 Subject: Added support for thin lto --- src/Compilation.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index fc2e25febf..be501646a3 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -5399,8 +5399,10 @@ pub fn addCCArgs( }, } - if (comp.config.lto) { - try argv.append("-flto"); + switch (comp.config.lto) { + .none => try argv.append("-fno-lto"), + .full => try argv.append("-flto=full"), + .thin => try argv.append("-flto=thin"), } // This only works for preprocessed files. Guarded by `FileExt.clangSupportsDepFile`. @@ -6450,7 +6452,7 @@ pub fn build_crt_file( .link_libc = false, .lto = switch (output_mode) { .Lib => comp.config.lto, - .Obj, .Exe => false, + .Obj, .Exe => .none, }, }); const root_mod = try Package.Module.create(arena, .{ -- cgit v1.2.3