| ... | ... | @@ -83,6 +83,24 @@ static const char *get_exe_file_extension(CodeGen *g) { |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | static const char *get_darwin_arch_string(const ZigTarget *t) { |
| 87 | switch (t->arch.arch) { |
| 88 | case ZigLLVM_aarch64: |
| 89 | return "arm64"; |
| 90 | case ZigLLVM_thumb: |
| 91 | case ZigLLVM_arm: |
| 92 | return "arm"; |
| 93 | case ZigLLVM_ppc: |
| 94 | return "ppc"; |
| 95 | case ZigLLVM_ppc64: |
| 96 | return "ppc64"; |
| 97 | case ZigLLVM_ppc64le: |
| 98 | return "ppc64le"; |
| 99 | default: |
| 100 | return ZigLLVMGetArchTypeName(t->arch.arch); |
| 101 | } |
| 102 | } |
| 103 | |
| 86 | 104 | static const char *getLDMOption(const ZigTarget *t) { |
| 87 | 105 | switch (t->arch.arch) { |
| 88 | 106 | case ZigLLVM_x86: |
| ... | ... | @@ -532,6 +550,9 @@ static void construct_linker_job_darwin(LinkJob *lj) { |
| 532 | 550 | zig_panic("TODO linker args on darwin for making a library"); |
| 533 | 551 | } |
| 534 | 552 | |
| 553 | lj->args.append("-arch"); |
| 554 | lj->args.append(get_darwin_arch_string(&g->zig_target)); |
| 555 | |
| 535 | 556 | DarwinPlatform platform; |
| 536 | 557 | get_darwin_platform(lj, &platform); |
| 537 | 558 | switch (platform.kind) { |
| ... | ... | @@ -599,6 +620,11 @@ static void construct_linker_job_darwin(LinkJob *lj) { |
| 599 | 620 | |
| 600 | 621 | lj->args.append((const char *)buf_ptr(&lj->out_file_o)); |
| 601 | 622 | |
| 623 | if (!g->link_libc && (g->out_type == OutTypeExe || g->out_type == OutTypeLib)) { |
| 624 | Buf *builtin_o_path = build_o(g, "builtin"); |
| 625 | lj->args.append(buf_ptr(builtin_o_path)); |
| 626 | } |
| 627 | |
| 602 | 628 | for (int i = 0; i < g->link_libs.length; i += 1) { |
| 603 | 629 | Buf *link_lib = g->link_libs.at(i); |
| 604 | 630 | Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib)); |