authorgravatar for hubert.jasudowicz@gmail.comHubert Jasudowicz <hubert.jasudowicz@gmail.com> 2021-02-22 20:37:10+01:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-02-25 22:25:42+02:00
log3c0238e731d3ec0514dc4a563817d6a27fed272e
tree737f22956442edb48f82a291da4eb1baaff411f9
parent4f11a88b9f21a365cf2281e840ed12b0d4e687a6

std/build: Add support for LTO configuration


1 files changed, 10 insertions(+), 0 deletions(-)

lib/std/build.zig+10
...@@ -1421,6 +1421,8 @@ pub const LibExeObjStep = struct {...@@ -1421,6 +1421,8 @@ pub const LibExeObjStep = struct {
1421 /// Overrides the default stack size1421 /// Overrides the default stack size
1422 stack_size: ?u64 = null,1422 stack_size: ?u64 = null,
14231423
1424 want_lto: ?bool = null,
1425
1424 const LinkObject = union(enum) {1426 const LinkObject = union(enum) {
1425 StaticPath: []const u8,1427 StaticPath: []const u8,
1426 OtherStep: *LibExeObjStep,1428 OtherStep: *LibExeObjStep,
...@@ -2589,6 +2591,14 @@ pub const LibExeObjStep = struct {...@@ -2589,6 +2591,14 @@ pub const LibExeObjStep = struct {
2589 }2591 }
2590 }2592 }
25912593
2594 if (self.want_lto) |lto| {
2595 if (lto) {
2596 try zig_args.append("-flto");
2597 } else {
2598 try zig_args.append("-fno-lto");
2599 }
2600 }
2601
2592 if (self.subsystem) |subsystem| {2602 if (self.subsystem) |subsystem| {
2593 try zig_args.append("--subsystem");2603 try zig_args.append("--subsystem");
2594 try zig_args.append(switch (subsystem) {2604 try zig_args.append(switch (subsystem) {