| ... | @@ -456,9 +456,10 @@ pub const File = struct { | ... | @@ -456,9 +456,10 @@ pub const File = struct { |
| 456 | .Exe => {}, | 456 | .Exe => {}, |
| 457 | } | 457 | } |
| 458 | switch (base.tag) { | 458 | switch (base.tag) { |
| 459 | .coff, .elf, .macho, .plan9, .wasm => if (base.file) |f| { | 459 | .elf => if (base.file) |f| { |
| 460 | if (build_options.only_c) unreachable; | 460 | if (build_options.only_c) unreachable; |
| 461 | if (base.intermediary_basename != null) { | 461 | const use_lld = build_options.have_llvm and base.options.use_lld; |
| | 462 | if (base.intermediary_basename != null and use_lld) { |
| 462 | // The file we have open is not the final file that we want to | 463 | // The file we have open is not the final file that we want to |
| 463 | // make executable, so we don't have to close it. | 464 | // make executable, so we don't have to close it. |
| 464 | return; | 465 | return; |
| ... | @@ -471,6 +472,22 @@ pub const File = struct { | ... | @@ -471,6 +472,22 @@ pub const File = struct { |
| 471 | .linux => std.os.ptrace(std.os.linux.PTRACE.DETACH, pid, 0, 0) catch |err| { | 472 | .linux => std.os.ptrace(std.os.linux.PTRACE.DETACH, pid, 0, 0) catch |err| { |
| 472 | log.warn("ptrace failure: {s}", .{@errorName(err)}); | 473 | log.warn("ptrace failure: {s}", .{@errorName(err)}); |
| 473 | }, | 474 | }, |
| | 475 | else => return error.HotSwapUnavailableOnHostOperatingSystem, |
| | 476 | } |
| | 477 | } |
| | 478 | }, |
| | 479 | .coff, .macho, .plan9, .wasm => if (base.file) |f| { |
| | 480 | if (build_options.only_c) unreachable; |
| | 481 | if (base.intermediary_basename != null) { |
| | 482 | // The file we have open is not the final file that we want to |
| | 483 | // make executable, so we don't have to close it. |
| | 484 | return; |
| | 485 | } |
| | 486 | f.close(); |
| | 487 | base.file = null; |
| | 488 | |
| | 489 | if (base.child_pid) |pid| { |
| | 490 | switch (builtin.os.tag) { |
| 474 | .macos => base.cast(MachO).?.ptraceDetach(pid) catch |err| { | 491 | .macos => base.cast(MachO).?.ptraceDetach(pid) catch |err| { |
| 475 | log.warn("detaching failed with error: {s}", .{@errorName(err)}); | 492 | log.warn("detaching failed with error: {s}", .{@errorName(err)}); |
| 476 | }, | 493 | }, |