Skip to content

Commit 91c98d7

Browse files
committed
fix ziglang#3237: resolve undefined symbol _DllMainCRTStartup
1 parent 53c63bd commit 91c98d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/link/Coff.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {
811811
const is_lib = self.base.options.output_mode == .Lib;
812812
const is_dyn_lib = self.base.options.link_mode == .Dynamic and is_lib;
813813
const is_exe_or_dyn_lib = is_dyn_lib or self.base.options.output_mode == .Exe;
814-
const link_in_crt = self.base.options.link_libc and self.base.options.output_mode == .Exe;
814+
const link_in_crt = self.base.options.link_libc and is_exe_or_dyn_lib;
815815
const target = self.base.options.target;
816816

817817
// See link/Elf.zig for comments on how this mechanism works.
@@ -1054,6 +1054,7 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {
10541054

10551055
if (is_dyn_lib) {
10561056
try argv.append(try comp.get_libc_crt_file(arena, "dllcrt2.o"));
1057+
try argv.append("-ALTERNATENAME:_DllMainCRTStartup=DllMainCRTStartup");
10571058
} else {
10581059
try argv.append(try comp.get_libc_crt_file(arena, "crt2.o"));
10591060
}

0 commit comments

Comments
 (0)