From 8774b1d9478139a8da0f43c49fc33e01c74a6a3f Mon Sep 17 00:00:00 2001 From: Nick Erdmann Date: Fri, 18 Oct 2019 19:49:02 +0200 Subject: [PATCH 1/2] std/os/windows: remove subsystem detection for uefi --- lib/std/os/windows.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 7c1761a4b8fb21a8c9aa15645cb0f68ac5ee5703..c35d9d592b62893a160cf9a19d90834e7e7114bc 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -42,7 +42,6 @@ pub const subsystem: ?builtin.SubSystem = blk: { break :blk builtin.SubSystem.Console; } }, - .uefi => break :blk builtin.SubSystem.EfiApplication, else => break :blk null, } }; -- 2.54.0 From c8dec5729cabb90fa56fad2b6d77171189e01703 Mon Sep 17 00:00:00 2001 From: Nick Erdmann Date: Fri, 18 Oct 2019 20:11:28 +0200 Subject: [PATCH 2/2] std/build: make subsystem configurable --- lib/std/build.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/std/build.zig b/lib/std/build.zig index 68d3f2a31512428f13ad59a0e757b4e7203aaa05..cb02c8f1317dc97d1f69ec4c46cb88ad9b3d36f5 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -1491,6 +1491,8 @@ pub const LibExeObjStep = struct { /// Position Independent Code force_pic: ?bool = null, + subsystem: ?builtin.SubSystem = null, + const LinkObject = union(enum) { StaticPath: []const u8, OtherStep: *LibExeObjStep, @@ -2325,6 +2327,20 @@ pub const LibExeObjStep = struct { } } + if (self.subsystem) |subsystem| { + try zig_args.append("--subsystem"); + try zig_args.append(switch (subsystem) { + .Console => "console", + .Windows => "windows", + .Posix => "posix", + .Native => "native", + .EfiApplication => "efi_application", + .EfiBootServiceDriver => "efi_boot_service_driver", + .EfiRom => "efi_rom", + .EfiRuntimeDriver => "efi_runtime_driver", + }); + } + if (self.kind == Kind.Test) { try builder.spawnChild(zig_args.toSliceConst()); } else { -- 2.54.0