| ... | @@ -3665,16 +3665,17 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr | ... | @@ -3665,16 +3665,17 @@ pub fn linkWithZld(macho_file: *MachO, comp: *Compilation, prog_node: *std.Progr |
| 3665 | } else { | 3665 | } else { |
| 3666 | const page_size = macho_file.page_size; | 3666 | const page_size = macho_file.page_size; |
| 3667 | const sub_path = options.emit.?.sub_path; | 3667 | const sub_path = options.emit.?.sub_path; |
| 3668 | if (macho_file.base.file == null) { | 3668 | |
| 3669 | macho_file.base.file = try directory.handle.createFile(sub_path, .{ | 3669 | const file = try directory.handle.createFile(sub_path, .{ |
| 3670 | .truncate = true, | 3670 | .truncate = true, |
| 3671 | .read = true, | 3671 | .read = true, |
| 3672 | .mode = link.determineMode(options.*), | 3672 | .mode = link.determineMode(options.*), |
| 3673 | }); | 3673 | }); |
| 3674 | } | 3674 | defer file.close(); |
| | 3675 | |
| 3675 | var zld = Zld{ | 3676 | var zld = Zld{ |
| 3676 | .gpa = gpa, | 3677 | .gpa = gpa, |
| 3677 | .file = macho_file.base.file.?, | 3678 | .file = file, |
| 3678 | .page_size = macho_file.page_size, | 3679 | .page_size = macho_file.page_size, |
| 3679 | .options = options, | 3680 | .options = options, |
| 3680 | }; | 3681 | }; |