| ... | ... | @@ -276,22 +276,14 @@ pub fn openPath(allocator: Allocator, options: link.Options) !*MachO { |
| 276 | 276 | if (use_stage1 or options.emit == null) { |
| 277 | 277 | return createEmpty(allocator, options); |
| 278 | 278 | } |
| 279 | | const emit = options.emit.?; |
| 280 | | const file = try emit.directory.handle.createFile(emit.sub_path, .{ |
| 281 | | .truncate = false, |
| 282 | | .read = true, |
| 283 | | .mode = link.determineMode(options), |
| 284 | | }); |
| 285 | | errdefer file.close(); |
| 286 | 279 | |
| 280 | const emit = options.emit.?; |
| 287 | 281 | const self = try createEmpty(allocator, options); |
| 288 | 282 | errdefer { |
| 289 | 283 | self.base.file = null; |
| 290 | 284 | self.base.destroy(); |
| 291 | 285 | } |
| 292 | 286 | |
| 293 | | self.base.file = file; |
| 294 | | |
| 295 | 287 | if (build_options.have_llvm and options.use_llvm and options.module != null) { |
| 296 | 288 | // TODO this intermediary_basename isn't enough; in the case of `zig build-exe`, |
| 297 | 289 | // we also want to put the intermediary object file in the cache while the |
| ... | ... | @@ -307,6 +299,14 @@ pub fn openPath(allocator: Allocator, options: link.Options) !*MachO { |
| 307 | 299 | return self; |
| 308 | 300 | } |
| 309 | 301 | |
| 302 | const file = try emit.directory.handle.createFile(emit.sub_path, .{ |
| 303 | .truncate = false, |
| 304 | .read = true, |
| 305 | .mode = link.determineMode(options), |
| 306 | }); |
| 307 | errdefer file.close(); |
| 308 | self.base.file = file; |
| 309 | |
| 310 | 310 | if (!options.strip and options.module != null) blk: { |
| 311 | 311 | // TODO once I add support for converting (and relocating) DWARF info from relocatable |
| 312 | 312 | // object files, this check becomes unnecessary. |