authorgravatar for ryan.saunderson88@gmail.comdimenus <ryan.saunderson88@gmail.com> 2019-07-10 11:40:20-05:00
committergravatar for ryan.saunderson88@gmail.comdimenus <ryan.saunderson88@gmail.com> 2019-07-10 11:40:20-05:00
loge9331dc5cf90fe0fff5258debc424ad0514507a2
tree78a63063d24450b2f5616cf7109162d801366328
parentae2345b742053a84e1f64f92b76202702ac872d9

resolved #2064 & fixed hello_world libc build


1 files changed, 8 insertions(+), 4 deletions(-)

src/link.cpp+8-4
...@@ -1139,8 +1139,7 @@ static void add_uefi_link_args(LinkJob *lj) {...@@ -1139,8 +1139,7 @@ static void add_uefi_link_args(LinkJob *lj) {
1139static void add_msvc_link_args(LinkJob *lj, bool is_library) {1139static void add_msvc_link_args(LinkJob *lj, bool is_library) {
1140 CodeGen *g = lj->codegen;1140 CodeGen *g = lj->codegen;
11411141
1142 // TODO: https://github.com/ziglang/zig/issues/20641142 bool is_dynamic = g->is_dynamic;
1143 bool is_dynamic = true; // g->is_dynamic;
1144 const char *lib_str = is_dynamic ? "" : "lib";1143 const char *lib_str = is_dynamic ? "" : "lib";
1145 const char *d_str = (g->build_mode == BuildModeDebug) ? "d" : "";1144 const char *d_str = (g->build_mode == BuildModeDebug) ? "d" : "";
11461145
...@@ -1360,9 +1359,15 @@ static void construct_linker_job_coff(LinkJob *lj) {...@@ -1360,9 +1359,15 @@ static void construct_linker_job_coff(LinkJob *lj) {
1360 Buf *lib_name = buf_sprintf("lib%s.a", buf_ptr(link_lib->name));1359 Buf *lib_name = buf_sprintf("lib%s.a", buf_ptr(link_lib->name));
1361 lj->args.append(buf_ptr(lib_name));1360 lj->args.append(buf_ptr(lib_name));
1362 } else {1361 } 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));
1364 }1364 }
1365 } else {1365 } 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
1366 buf_resize(def_contents, 0);1371 buf_resize(def_contents, 0);
1367 buf_appendf(def_contents, "LIBRARY %s\nEXPORTS\n", buf_ptr(link_lib->name));1372 buf_appendf(def_contents, "LIBRARY %s\nEXPORTS\n", buf_ptr(link_lib->name));
1368 for (size_t exp_i = 0; exp_i < link_lib->symbols.length; exp_i += 1) {1373 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) {...@@ -1395,7 +1400,6 @@ static void construct_linker_job_coff(LinkJob *lj) {
1395 lj->args.append(buf_ptr(generated_lib_path));1400 lj->args.append(buf_ptr(generated_lib_path));
1396 }1401 }
1397 }1402 }
1398
1399}1403}
14001404
14011405