diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2023-03-18 21:45:21 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-18 21:45:21 +0100 |
| commit | 2ac8d90df05fdbb59a0ee9ff6609a058185f66ff (patch) | |
| tree | 9e7e470a1fcc3e9b70dad781321948be194588e6 /src/link.zig | |
| parent | 49d37e2d179948f526f500043c6ea9ae324e9476 (diff) | |
| parent | 46171bf6c89dc2c2b8f155c8511b62e5cd52e3bc (diff) | |
| download | zig-2ac8d90df05fdbb59a0ee9ff6609a058185f66ff.tar.gz zig-2ac8d90df05fdbb59a0ee9ff6609a058185f66ff.zip | |
Merge pull request #14935 from ziglang/fix-macos-build2
link: move macOS kernel inode cache invalidation to MachO linker
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/src/link.zig b/src/link.zig index e68f9c97d0..a919ffa999 100644 --- a/src/link.zig +++ b/src/link.zig @@ -418,26 +418,7 @@ pub const File = struct { .Exe => {}, } switch (base.tag) { - .macho => if (base.file) |f| { - if (build_options.only_c) unreachable; - if (comptime builtin.target.isDarwin() and builtin.target.cpu.arch == .aarch64) { - if (base.options.target.cpu.arch == .aarch64) { - // XNU starting with Big Sur running on arm64 is caching inodes of running binaries. - // Any change to the binary will effectively invalidate the kernel's cache - // resulting in a SIGKILL on each subsequent run. Since when doing incremental - // linking we're modifying a binary in-place, this will end up with the kernel - // killing it on every subsequent run. To circumvent it, we will copy the file - // into a new inode, remove the original file, and rename the copy to match - // the original file. This is super messy, but there doesn't seem any other - // way to please the XNU. - const emit = base.options.emit orelse return; - try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, emit.sub_path, .{}); - } - } - f.close(); - base.file = null; - }, - .coff, .elf, .plan9, .wasm => if (base.file) |f| { + .coff, .elf, .macho, .plan9, .wasm => if (base.file) |f| { if (build_options.only_c) unreachable; if (base.intermediary_basename != null) { // The file we have open is not the final file that we want to |
