| ... | @@ -83,6 +83,24 @@ static const char *get_exe_file_extension(CodeGen *g) { | ... | @@ -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 | static const char *getLDMOption(const ZigTarget *t) { | 104 | static const char *getLDMOption(const ZigTarget *t) { |
| 87 | switch (t->arch.arch) { | 105 | switch (t->arch.arch) { |
| 88 | case ZigLLVM_x86: | 106 | case ZigLLVM_x86: |
| ... | @@ -532,6 +550,9 @@ static void construct_linker_job_darwin(LinkJob *lj) { | ... | @@ -532,6 +550,9 @@ static void construct_linker_job_darwin(LinkJob *lj) { |
| 532 | zig_panic("TODO linker args on darwin for making a library"); | 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 | DarwinPlatform platform; | 556 | DarwinPlatform platform; |
| 536 | get_darwin_platform(lj, &platform); | 557 | get_darwin_platform(lj, &platform); |
| 537 | switch (platform.kind) { | 558 | switch (platform.kind) { |
| ... | @@ -599,6 +620,11 @@ static void construct_linker_job_darwin(LinkJob *lj) { | ... | @@ -599,6 +620,11 @@ static void construct_linker_job_darwin(LinkJob *lj) { |
| 599 | | 620 | |
| 600 | lj->args.append((const char *)buf_ptr(&lj->out_file_o)); | 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 | for (int i = 0; i < g->link_libs.length; i += 1) { | 628 | for (int i = 0; i < g->link_libs.length; i += 1) { |
| 603 | Buf *link_lib = g->link_libs.at(i); | 629 | Buf *link_lib = g->link_libs.at(i); |
| 604 | Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib)); | 630 | Buf *arg = buf_sprintf("-l%s", buf_ptr(link_lib)); |