ignore -lm on darwin because it's handled by libSystem

This commit is contained in:
Andrew Kelley 2019-03-13 23:44:13 -04:00
parent 927efe5f42
commit 862ac42a6e
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 8 additions and 8 deletions

View File

@ -1526,15 +1526,15 @@ static void construct_linker_job_macho(LinkJob *lj) {
if (g->zig_target->is_native) {
for (size_t lib_i = 0; lib_i < g->link_libs_list.length; lib_i += 1) {
LinkLib *link_lib = g->link_libs_list.at(lib_i);
if (buf_eql_str(link_lib->name, "c")) {
if (target_is_libc_lib_name(g->zig_target, buf_ptr(link_lib->name))) {
// handled by libSystem
continue;
}
if (strchr(buf_ptr(link_lib->name), '/') == nullptr) {
Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib->name));
lj->args.append(buf_ptr(arg));
} else {
if (strchr(buf_ptr(link_lib->name), '/') == nullptr) {
Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib->name));
lj->args.append(buf_ptr(arg));
} else {
lj->args.append(buf_ptr(link_lib->name));
}
lj->args.append(buf_ptr(link_lib->name));
}
}
// on Darwin, libSystem has libc in it, but also you have to use it

View File

@ -1477,7 +1477,7 @@ bool target_is_libc_lib_name(const ZigTarget *target, const char *name) {
if (strcmp(name, "c") == 0)
return true;
if (target_abi_is_gnu(target->abi) || target_abi_is_musl(target->abi)) {
if (target_abi_is_gnu(target->abi) || target_abi_is_musl(target->abi) || target_os_is_darwin(target->os)) {
if (strcmp(name, "m") == 0)
return true;
if (strcmp(name, "rt") == 0)