Skip to content

Commit cd430b5

Browse files
committed
windows: revert changes made to lld.zig to support the way CMake calls zig cc on Windows-Clang
1 parent b42442f commit cd430b5

1 file changed

Lines changed: 1 addition & 26 deletions

File tree

src/link/Coff/lld.zig

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -439,32 +439,7 @@ pub fn linkWithLLD(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod
439439
try argv.append("-ENTRY:wWinMainCRTStartup");
440440
}
441441
} else {
442-
// If the crt isn't being linked, it won't provide the CRT startup methods that
443-
// call through to the user-provided entrypoint. Instead, choose the entry point
444-
// that the CRT methods would have called. Note that this differs from the behaviour
445-
// of link.exe (which still tries to use the CRT methods in this case), but this
446-
// fixes CMake compiler checks when using zig cc on Windows, as Windows-Clang.cmake
447-
// does not specify /entry:main
448-
449-
// TODO: I think the correct thing to do in this case would be to inspect the object
450-
// being linked (like link.exe / lld-link does) and detect which symbols are available.
451-
// This would allow detection of the w variants, as well as the crt methods.
452-
if (resolved_subsystem) |subsystem| {
453-
switch (subsystem) {
454-
.Console => {
455-
// The default is to call mainCRTStartup/wmainCRTStartup, which calls main/wmain
456-
try argv.append("-ENTRY:main");
457-
},
458-
.Windows => {
459-
// The default is to call WinMainCRTStartup/wWinMainCRTStartup, which calls WinMain/wWinMain
460-
try argv.append("-ENTRY:WinMain");
461-
},
462-
else => {}
463-
}
464-
}
465-
466-
// when no /entry is specified, lld-link will infer it based on which functions
467-
// are present in the object being linked - see lld/COFF/Driver.cpp#LinkerDriver::findDefaultEntry
442+
try argv.append("-ENTRY:wWinMainCRTStartup");
468443
}
469444
}
470445
}

0 commit comments

Comments
 (0)