@@ -748,6 +748,7 @@ fn buildOutputType(
748748 var linker_nxcompat = false ;
749749 var linker_dynamicbase = false ;
750750 var linker_optimization : ? u8 = null ;
751+ var linker_module_definition_file : ? []const u8 = null ;
751752 var test_evented_io = false ;
752753 var test_no_exec = false ;
753754 var entry : ? []const u8 = null ;
@@ -787,6 +788,7 @@ fn buildOutputType(
787788 var headerpad_max_install_names : bool = false ;
788789 var dead_strip_dylibs : bool = false ;
789790 var reference_trace : ? u32 = null ;
791+ var pdb_out_path : ? []const u8 = null ;
790792
791793 // e.g. -m3dnow or -mno-outline-atomics. They correspond to std.Target llvm cpu feature names.
792794 // This array is populated by zig cc frontend and then has to be converted to zig-style
@@ -1410,7 +1412,7 @@ fn buildOutputType(
14101412 root_src_file = arg ;
14111413 }
14121414 },
1413- .unknown = > {
1415+ .def , . unknown = > {
14141416 fatal ("unrecognized file extension of parameter '{s}'" , .{arg });
14151417 },
14161418 }
@@ -1484,6 +1486,9 @@ fn buildOutputType(
14841486 .must_link = must_link ,
14851487 });
14861488 },
1489+ .def = > {
1490+ linker_module_definition_file = it .only_arg ;
1491+ },
14871492 .zig = > {
14881493 if (root_src_file ) | other | {
14891494 fatal ("found another zig file '{s}' after root source file '{s}'" , .{ it .only_arg , other });
@@ -1543,7 +1548,10 @@ fn buildOutputType(
15431548 .no_stack_protector = > want_stack_protector = 0 ,
15441549 .unwind_tables = > want_unwind_tables = true ,
15451550 .no_unwind_tables = > want_unwind_tables = false ,
1546- .nostdlib = > ensure_libc_on_non_freestanding = false ,
1551+ .nostdlib = > {
1552+ ensure_libc_on_non_freestanding = false ;
1553+ ensure_libcpp_on_non_freestanding = false ;
1554+ },
15471555 .nostdlib_cpp = > ensure_libcpp_on_non_freestanding = false ,
15481556 .shared = > {
15491557 link_mode = .Dynamic ;
@@ -2122,6 +2130,24 @@ fn buildOutputType(
21222130 next_arg ,
21232131 });
21242132 };
2133+ } else if (mem .startsWith (u8 , arg , "/subsystem:" )) {
2134+ var split_it = mem .splitBackwards (u8 , arg , ":" );
2135+ subsystem = try parseSubSystem (split_it .first ());
2136+ } else if (mem .startsWith (u8 , arg , "/implib:" )) {
2137+ var split_it = mem .splitBackwards (u8 , arg , ":" );
2138+ emit_implib = .{ .yes = split_it .first () };
2139+ emit_implib_arg_provided = true ;
2140+ } else if (mem .startsWith (u8 , arg , "/pdb:" )) {
2141+ var split_it = mem .splitBackwards (u8 , arg , ":" );
2142+ pdb_out_path = split_it .first ();
2143+ } else if (mem .startsWith (u8 , arg , "/version:" )) {
2144+ var split_it = mem .splitBackwards (u8 , arg , ":" );
2145+ const version_arg = split_it .first ();
2146+ version = std .builtin .Version .parse (version_arg ) catch | err | {
2147+ fatal ("unable to parse /version '{s}': {s}" , .{ arg , @errorName (err ) });
2148+ };
2149+
2150+ have_version = true ;
21252151 } else {
21262152 warn ("unsupported linker arg: {s}" , .{arg });
21272153 }
@@ -3021,6 +3047,7 @@ fn buildOutputType(
30213047 .linker_dynamicbase = linker_dynamicbase ,
30223048 .linker_optimization = linker_optimization ,
30233049 .linker_compress_debug_sections = linker_compress_debug_sections ,
3050+ .linker_module_definition_file = linker_module_definition_file ,
30243051 .major_subsystem_version = major_subsystem_version ,
30253052 .minor_subsystem_version = minor_subsystem_version ,
30263053 .link_eh_frame_hdr = link_eh_frame_hdr ,
@@ -3070,6 +3097,7 @@ fn buildOutputType(
30703097 .headerpad_max_install_names = headerpad_max_install_names ,
30713098 .dead_strip_dylibs = dead_strip_dylibs ,
30723099 .reference_trace = reference_trace ,
3100+ .pdb_out_path = pdb_out_path ,
30733101 }) catch | err | switch (err ) {
30743102 error .LibCUnavailable = > {
30753103 const target = target_info .target ;
0 commit comments