Skip to content

Commit e9331dc

Browse files
resolved ziglang#2064 & fixed hello_world libc build
1 parent ae2345b commit e9331dc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/link.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,7 @@ static void add_uefi_link_args(LinkJob *lj) {
11391139
static void add_msvc_link_args(LinkJob *lj, bool is_library) {
11401140
CodeGen *g = lj->codegen;
11411141

1142-
// TODO: https://github.com/ziglang/zig/issues/2064
1143-
bool is_dynamic = true; // g->is_dynamic;
1142+
bool is_dynamic = g->is_dynamic;
11441143
const char *lib_str = is_dynamic ? "" : "lib";
11451144
const char *d_str = (g->build_mode == BuildModeDebug) ? "d" : "";
11461145

@@ -1360,9 +1359,15 @@ static void construct_linker_job_coff(LinkJob *lj) {
13601359
Buf *lib_name = buf_sprintf("lib%s.a", buf_ptr(link_lib->name));
13611360
lj->args.append(buf_ptr(lib_name));
13621361
} else {
1363-
lj->args.append(buf_ptr(link_lib->name));
1362+
Buf* lib_name = buf_sprintf("%s.lib", buf_ptr(link_lib->name));
1363+
lj->args.append(buf_ptr(lib_name));
13641364
}
13651365
} else {
1366+
//note(dimenus): If we're linking in the CRT we need to link in existing system librarys not generate def/libs
1367+
if (lj->link_in_crt) {
1368+
continue;
1369+
}
1370+
13661371
buf_resize(def_contents, 0);
13671372
buf_appendf(def_contents, "LIBRARY %s\nEXPORTS\n", buf_ptr(link_lib->name));
13681373
for (size_t exp_i = 0; exp_i < link_lib->symbols.length; exp_i += 1) {
@@ -1395,7 +1400,6 @@ static void construct_linker_job_coff(LinkJob *lj) {
13951400
lj->args.append(buf_ptr(generated_lib_path));
13961401
}
13971402
}
1398-
13991403
}
14001404

14011405

0 commit comments

Comments
 (0)