authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-29 13:17:21-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-29 13:17:21-04:00
log5aa281250723c159aa0429941c16b046bba6d316
treef49a62ee31e6ec0118d88bbcd46cdcc71aa9bde3
parentc70471fae617fb91ca0a323f079574a3caaa7775
signaturelock-open Commit is signed but in an unrecognized format.

linking is now aware -lm is provided by mingw-w64


2 files changed, 16 insertions(+), 2 deletions(-)

src/link.cpp+7-2
...@@ -1903,7 +1903,7 @@ static void construct_linker_job_elf(LinkJob *lj) {...@@ -1903,7 +1903,7 @@ static void construct_linker_job_elf(LinkJob *lj) {
1903 // libc is linked specially1903 // libc is linked specially
1904 continue;1904 continue;
1905 }1905 }
1906 if (buf_eql_str(link_lib->name, "c++") || buf_eql_str(link_lib->name, "c++abi")) {1906 if (target_is_libcpp_lib_name(g->zig_target, buf_ptr(link_lib->name))) {
1907 // libc++ is linked specially1907 // libc++ is linked specially
1908 continue;1908 continue;
1909 }1909 }
...@@ -2470,7 +2470,12 @@ static void construct_linker_job_coff(LinkJob *lj) {...@@ -2470,7 +2470,12 @@ static void construct_linker_job_coff(LinkJob *lj) {
2470 if (buf_eql_str(link_lib->name, "c")) {2470 if (buf_eql_str(link_lib->name, "c")) {
2471 continue;2471 continue;
2472 }2472 }
2473 if (buf_eql_str(link_lib->name, "c++") || buf_eql_str(link_lib->name, "c++abi")) {2473 if (target_is_libcpp_lib_name(g->zig_target, buf_ptr(link_lib->name))) {
2474 // libc++ is linked specially
2475 continue;
2476 }
2477 if (g->libc == nullptr && target_is_libc_lib_name(g->zig_target, buf_ptr(link_lib->name))) {
2478 // these libraries are always linked below when targeting glibc
2474 continue;2479 continue;
2475 }2480 }
2476 bool is_sys_lib = is_mingw_link_lib(link_lib->name);2481 bool is_sys_lib = is_mingw_link_lib(link_lib->name);
src/target.cpp+9
...@@ -1207,6 +1207,15 @@ bool target_is_libc_lib_name(const ZigTarget *target, const char *name) {...@@ -1207,6 +1207,15 @@ bool target_is_libc_lib_name(const ZigTarget *target, const char *name) {
1207 if (strcmp(name, "c") == 0)1207 if (strcmp(name, "c") == 0)
1208 return true;1208 return true;
12091209
1210 if (target_abi_is_gnu(target->abi) && target->os == OsWindows) {
1211 // mingw-w64
1212
1213 if (strcmp(name, "m") == 0)
1214 return true;
1215
1216 return false;
1217 }
1218
1210 if (target_abi_is_gnu(target->abi) || target_abi_is_musl(target->abi) || target_os_is_darwin(target->os)) {1219 if (target_abi_is_gnu(target->abi) || target_abi_is_musl(target->abi) || target_os_is_darwin(target->os)) {
1211 if (strcmp(name, "m") == 0)1220 if (strcmp(name, "m") == 0)
1212 return true;1221 return true;