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) {
19031903 // libc is linked specially
19041904 continue;
19051905 }
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))) {
19071907 // libc++ is linked specially
19081908 continue;
19091909 }
......@@ -2470,7 +2470,12 @@ static void construct_linker_job_coff(LinkJob *lj) {
24702470 if (buf_eql_str(link_lib->name, "c")) {
24712471 continue;
24722472 }
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
24742479 continue;
24752480 }
24762481 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) {
12071207 if (strcmp(name, "c") == 0)
12081208 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
12101219 if (target_abi_is_gnu(target->abi) || target_abi_is_musl(target->abi) || target_os_is_darwin(target->os)) {
12111220 if (strcmp(name, "m") == 0)
12121221 return true;