| ... | @@ -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}); |
| ... | @@ -1610,6 +1581,12 @@ fn buildOutputType( | ... | @@ -1610,6 +1581,12 @@ fn buildOutputType( |
| 1610 | fatal("expected linker arg after '{s}'", .{arg}); | 1581 | fatal("expected linker arg after '{s}'", .{arg}); |
| 1611 | } | 1582 | } |
| 1612 | try rpath_list.append(linker_args.items[i]); | 1583 | try rpath_list.append(linker_args.items[i]); |
| | 1584 | } else if (mem.eql(u8, arg, "--subsystem")) { |
| | 1585 | i += 1; |
| | 1586 | if (i >= linker_args.items.len) { |
| | 1587 | fatal("expected linker arg after '{s}'", .{arg}); |
| | 1588 | } |
| | 1589 | subsystem = try parseSubSystem(linker_args.items[i]); |
| 1613 | } else if (mem.eql(u8, arg, "-I") or | 1590 | } else if (mem.eql(u8, arg, "-I") or |
| 1614 | mem.eql(u8, arg, "--dynamic-linker") or | 1591 | mem.eql(u8, arg, "--dynamic-linker") or |
| 1615 | mem.eql(u8, arg, "-dynamic-linker")) | 1592 | mem.eql(u8, arg, "-dynamic-linker")) |
| ... | @@ -5132,3 +5109,36 @@ fn warnAboutForeignBinaries( | ... | @@ -5132,3 +5109,36 @@ fn warnAboutForeignBinaries( |
| 5132 | }, | 5109 | }, |
| 5133 | } | 5110 | } |
| 5134 | } | 5111 | } |
| | 5112 | |
| | 5113 | fn parseSubSystem(next_arg: []const u8) !std.Target.SubSystem { |
| | 5114 | if (mem.eql(u8, next_arg, "console")) { |
| | 5115 | return .Console; |
| | 5116 | } else if (mem.eql(u8, next_arg, "windows")) { |
| | 5117 | return .Windows; |
| | 5118 | } else if (mem.eql(u8, next_arg, "posix")) { |
| | 5119 | return .Posix; |
| | 5120 | } else if (mem.eql(u8, next_arg, "native")) { |
| | 5121 | return .Native; |
| | 5122 | } else if (mem.eql(u8, next_arg, "efi_application")) { |
| | 5123 | return .EfiApplication; |
| | 5124 | } else if (mem.eql(u8, next_arg, "efi_boot_service_driver")) { |
| | 5125 | return .EfiBootServiceDriver; |
| | 5126 | } else if (mem.eql(u8, next_arg, "efi_rom")) { |
| | 5127 | return .EfiRom; |
| | 5128 | } else if (mem.eql(u8, next_arg, "efi_runtime_driver")) { |
| | 5129 | return .EfiRuntimeDriver; |
| | 5130 | } else { |
| | 5131 | fatal("invalid: --subsystem: '{s}'. Options are:\n{s}", .{ |
| | 5132 | next_arg, |
| | 5133 | \\ console |
| | 5134 | \\ windows |
| | 5135 | \\ posix |
| | 5136 | \\ native |
| | 5137 | \\ efi_application |
| | 5138 | \\ efi_boot_service_driver |
| | 5139 | \\ efi_rom |
| | 5140 | \\ efi_runtime_driver |
| | 5141 | \\ |
| | 5142 | }); |
| | 5143 | } |
| | 5144 | } |