| ... | @@ -325,10 +325,13 @@ static void construct_linker_job_elf(LinkJob *lj) { | ... | @@ -325,10 +325,13 @@ static void construct_linker_job_elf(LinkJob *lj) { |
| 325 | lj->args.append((const char *)buf_ptr(g->link_objects.at(i))); | 325 | lj->args.append((const char *)buf_ptr(g->link_objects.at(i))); |
| 326 | } | 326 | } |
| 327 | | 327 | |
| 328 | if (g->libc_link_lib == nullptr && (g->out_type == OutTypeExe || g->out_type == OutTypeLib)) { | 328 | if (g->out_type == OutTypeExe || g->out_type == OutTypeLib) { |
| 329 | Buf *builtin_o_path = build_o(g, "builtin"); | 329 | if (g->libc_link_lib == nullptr) { |
| 330 | lj->args.append(buf_ptr(builtin_o_path)); | 330 | Buf *builtin_o_path = build_o(g, "builtin"); |
| | 331 | lj->args.append(buf_ptr(builtin_o_path)); |
| | 332 | } |
| 331 | | 333 | |
| | 334 | // sometimes libgcc is missing stuff, so we still build compiler_rt and rely on weak linkage |
| 332 | Buf *compiler_rt_o_path = build_compiler_rt(g); | 335 | Buf *compiler_rt_o_path = build_compiler_rt(g); |
| 333 | lj->args.append(buf_ptr(compiler_rt_o_path)); | 336 | lj->args.append(buf_ptr(compiler_rt_o_path)); |
| 334 | } | 337 | } |
| ... | @@ -554,7 +557,7 @@ static void construct_linker_job_coff(LinkJob *lj) { | ... | @@ -554,7 +557,7 @@ static void construct_linker_job_coff(LinkJob *lj) { |
| 554 | lj->args.append(buf_ptr(builtin_o_path)); | 557 | lj->args.append(buf_ptr(builtin_o_path)); |
| 555 | } | 558 | } |
| 556 | | 559 | |
| 557 | // msvc compiler_rt is missing some stuff, so we still build it and rely on LinkOnce | 560 | // msvc compiler_rt is missing some stuff, so we still build it and rely on weak linkage |
| 558 | Buf *compiler_rt_o_path = build_compiler_rt(g); | 561 | Buf *compiler_rt_o_path = build_compiler_rt(g); |
| 559 | lj->args.append(buf_ptr(compiler_rt_o_path)); | 562 | lj->args.append(buf_ptr(compiler_rt_o_path)); |
| 560 | } | 563 | } |