mirror of
https://github.com/ziglang/zig.git
synced 2024-11-17 01:23:54 +00:00
stage2,macho: swap out inodes before checking for intermediary basename
This way we avoid the infamous SIGKILL on arm64 macos.
This commit is contained in:
parent
4c83b11f71
commit
88d87d6506
11
src/link.zig
11
src/link.zig
@ -352,11 +352,6 @@ pub const File = struct {
|
||||
}
|
||||
switch (base.tag) {
|
||||
.macho => if (base.file) |f| {
|
||||
if (base.intermediary_basename != null) {
|
||||
// The file we have open is not the final file that we want to
|
||||
// make executable, so we don't have to close it.
|
||||
return;
|
||||
}
|
||||
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.
|
||||
@ -371,8 +366,10 @@ pub const File = struct {
|
||||
try emit.directory.handle.copyFile(emit.sub_path, emit.directory.handle, emit.sub_path, .{});
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
base.file = null;
|
||||
if (base.intermediary_basename == null) {
|
||||
f.close();
|
||||
base.file = null;
|
||||
}
|
||||
},
|
||||
.coff, .elf, .plan9 => if (base.file) |f| {
|
||||
if (base.intermediary_basename != null) {
|
||||
|
@ -423,7 +423,7 @@ pub fn flush(self: *MachO, comp: *Compilation) !void {
|
||||
if (self.base.options.emit == null) {
|
||||
if (build_options.have_llvm) {
|
||||
if (self.llvm_object) |llvm_object| {
|
||||
return try llvm_object.flushModule(comp);
|
||||
try llvm_object.flushModule(comp);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -1116,7 +1116,8 @@ pub fn flushObject(self: *MachO, comp: *Compilation) !void {
|
||||
defer tracy.end();
|
||||
|
||||
if (build_options.have_llvm)
|
||||
if (self.llvm_object) |llvm_object| return llvm_object.flushModule(comp);
|
||||
if (self.llvm_object) |llvm_object|
|
||||
return llvm_object.flushModule(comp);
|
||||
|
||||
return error.TODOImplementWritingObjFiles;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user