| ... | ... | @@ -1359,17 +1359,25 @@ static void construct_linker_job_coff(LinkJob *lj) { |
| 1359 | 1359 | } |
| 1360 | 1360 | if (link_lib->provided_explicitly) { |
| 1361 | 1361 | if (target_abi_is_gnu(lj->codegen->zig_target->abi)) { |
| 1362 | | static const char *test_names[3] = { "lib%s.dll.a", "lib%s.a", nullptr }; |
| 1363 | | |
| 1364 | | for (size_t i = 0; test_names[i] != nullptr; i++) { |
| 1365 | | Buf *test_path = buf_sprintf(test_names[i], buf_ptr(link_lib->name)); |
| 1366 | | bool exists = false; |
| 1367 | | if (os_file_exists(test_path, &exists) != ErrorNone) { |
| 1368 | | zig_panic("link: unable to check if file exists: %s", buf_ptr(test_path)); |
| 1369 | | } else if (exists) { |
| 1370 | | lj->args.append(buf_ptr(test_path)); |
| 1362 | static const char *test_names[3] = { "%s\\lib%s.dll.a", "%s\\lib%s.a", nullptr }; |
| 1363 | bool exists = false; |
| 1364 | |
| 1365 | for (size_t i = 0; test_names[i] != nullptr && !exists; i++) { |
| 1366 | for (size_t j = 0; j < g->lib_dirs.length; j += 1) { |
| 1367 | const char *lib_dir = g->lib_dirs.at(j); |
| 1368 | Buf *test_path = buf_sprintf(test_names[i], lib_dir, buf_ptr(link_lib->name)); |
| 1369 | if (os_file_exists(test_path, &exists) != ErrorNone) { |
| 1370 | zig_panic("link: unable to check if file exists: %s", buf_ptr(test_path)); |
| 1371 | } else if (exists) { |
| 1372 | lj->args.append(buf_ptr(test_path)); |
| 1373 | break; |
| 1374 | } |
| 1371 | 1375 | } |
| 1372 | 1376 | } |
| 1377 | |
| 1378 | if (!exists) { |
| 1379 | zig_panic("link: unable to find library: %s", buf_ptr(link_lib->name)); |
| 1380 | } |
| 1373 | 1381 | } else { |
| 1374 | 1382 | lj->args.append(buf_ptr(link_lib->name)); |
| 1375 | 1383 | } |