| ... | @@ -849,36 +849,7 @@ fn buildOutputType( | ... | @@ -849,36 +849,7 @@ fn buildOutputType( |
| 849 | const next_arg = args_iter.next() orelse { | 849 | const next_arg = args_iter.next() orelse { |
| 850 | fatal("expected parameter after {s}", .{arg}); | 850 | fatal("expected parameter after {s}", .{arg}); |
| 851 | }; | 851 | }; |
| 852 | if (mem.eql(u8, next_arg, "console")) { | 852 | subsystem = try parseSubSystem(next_arg); |
| 853 | subsystem = .Console; | | |
| 854 | } else if (mem.eql(u8, next_arg, "windows")) { | | |
| 855 | subsystem = .Windows; | | |
| 856 | } else if (mem.eql(u8, next_arg, "posix")) { | | |
| 857 | subsystem = .Posix; | | |
| 858 | } else if (mem.eql(u8, next_arg, "native")) { | | |
| 859 | subsystem = .Native; | | |
| 860 | } else if (mem.eql(u8, next_arg, "efi_application")) { | | |
| 861 | subsystem = .EfiApplication; | | |
| 862 | } else if (mem.eql(u8, next_arg, "efi_boot_service_driver")) { | | |
| 863 | subsystem = .EfiBootServiceDriver; | | |
| 864 | } else if (mem.eql(u8, next_arg, "efi_rom")) { | | |
| 865 | subsystem = .EfiRom; | | |
| 866 | } else if (mem.eql(u8, next_arg, "efi_runtime_driver")) { | | |
| 867 | subsystem = .EfiRuntimeDriver; | | |
| 868 | } else { | | |
| 869 | fatal("invalid: --subsystem: '{s}'. Options are:\n{s}", .{ | | |
| 870 | next_arg, | | |
| 871 | \\ console | | |
| 872 | \\ windows | | |
| 873 | \\ posix | | |
| 874 | \\ native | | |
| 875 | \\ efi_application | | |
| 876 | \\ efi_boot_service_driver | | |
| 877 | \\ efi_rom | | |
| 878 | \\ efi_runtime_driver | | |
| 879 | \\ | | |
| 880 | }); | | |
| 881 | } | | |
| 882 | } else if (mem.eql(u8, arg, "-O")) { | 853 | } else if (mem.eql(u8, arg, "-O")) { |
| 883 | optimize_mode_string = args_iter.next() orelse { | 854 | optimize_mode_string = args_iter.next() orelse { |
| 884 | fatal("expected parameter after {s}", .{arg}); | 855 | fatal("expected parameter after {s}", .{arg}); |
| ... | @@ -1467,6 +1438,11 @@ fn buildOutputType( | ... | @@ -1467,6 +1438,11 @@ fn buildOutputType( |
| 1467 | mem.eql(u8, linker_arg, "-static")) | 1438 | mem.eql(u8, linker_arg, "-static")) |
| 1468 | { | 1439 | { |
| 1469 | force_static_libs = true; | 1440 | force_static_libs = true; |
| | 1441 | } else if (mem.eql(u8, linker_arg, "--subsystem")) { |
| | 1442 | const next_arg = split_it.next() orelse { |
| | 1443 | fatal("expected parameter after {s}", .{linker_arg}); |
| | 1444 | }; |
| | 1445 | subsystem = try parseSubSystem(next_arg); |
| 1470 | } else { | 1446 | } else { |
| 1471 | try linker_args.append(linker_arg); | 1447 | try linker_args.append(linker_arg); |
| 1472 | } | 1448 | } |
| ... | @@ -5132,3 +5108,36 @@ fn warnAboutForeignBinaries( | ... | @@ -5132,3 +5108,36 @@ fn warnAboutForeignBinaries( |
| 5132 | }, | 5108 | }, |
| 5133 | } | 5109 | } |
| 5134 | } | 5110 | } |
| | 5111 | |
| | 5112 | fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem { |
| | 5113 | if (mem.eql(u8, next_arg, "console")) { |
| | 5114 | return .Console; |
| | 5115 | } else if (mem.eql(u8, next_arg, "windows")) { |
| | 5116 | return .Windows; |
| | 5117 | } else if (mem.eql(u8, next_arg, "posix")) { |
| | 5118 | return .Posix; |
| | 5119 | } else if (mem.eql(u8, next_arg, "native")) { |
| | 5120 | return .Native; |
| | 5121 | } else if (mem.eql(u8, next_arg, "efi_application")) { |
| | 5122 | return .EfiApplication; |
| | 5123 | } else if (mem.eql(u8, next_arg, "efi_boot_service_driver")) { |
| | 5124 | return .EfiBootServiceDriver; |
| | 5125 | } else if (mem.eql(u8, next_arg, "efi_rom")) { |
| | 5126 | return .EfiRom; |
| | 5127 | } else if (mem.eql(u8, next_arg, "efi_runtime_driver")) { |
| | 5128 | return .EfiRuntimeDriver; |
| | 5129 | } else { |
| | 5130 | fatal("invalid: --subsystem: '{s}'. Options are:\n{s}", .{ |
| | 5131 | next_arg, |
| | 5132 | \\ console |
| | 5133 | \\ windows |
| | 5134 | \\ posix |
| | 5135 | \\ native |
| | 5136 | \\ efi_application |
| | 5137 | \\ efi_boot_service_driver |
| | 5138 | \\ efi_rom |
| | 5139 | \\ efi_runtime_driver |
| | 5140 | \\ |
| | 5141 | }); |
| | 5142 | } |
| | 5143 | } |