std/build: Add support for LTO configuration

This commit is contained in:
Hubert Jasudowicz
2021-02-22 20:37:10 +01:00
committed by Veikka Tuominen
parent 4f11a88b9f
commit 3c0238e731

View File

@@ -1421,6 +1421,8 @@ pub const LibExeObjStep = struct {
/// Overrides the default stack size
stack_size: ?u64 = null,
want_lto: ?bool = null,
const LinkObject = union(enum) {
StaticPath: []const u8,
OtherStep: *LibExeObjStep,
@@ -2589,6 +2591,14 @@ pub const LibExeObjStep = struct {
}
}
if (self.want_lto) |lto| {
if (lto) {
try zig_args.append("-flto");
} else {
try zig_args.append("-fno-lto");
}
}
if (self.subsystem) |subsystem| {
try zig_args.append("--subsystem");
try zig_args.append(switch (subsystem) {