| ... | @@ -363,18 +363,30 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio | ... | @@ -363,18 +363,30 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio |
| 363 | self.base.file = file; | 363 | self.base.file = file; |
| 364 | | 364 | |
| 365 | // Create dSYM bundle. | 365 | // Create dSYM bundle. |
| 366 | const d_sym_path = try fmt.allocPrint(allocator, "{s}.dSYM/Contents/Resources/DWARF/", .{sub_path}); | 366 | if (options.module) |mod| { |
| 367 | defer allocator.free(d_sym_path); | 367 | const dir = mod.zig_cache_artifact_directory; |
| 368 | var d_sym_bundle = try options.emit.?.directory.handle.makeOpenPath(d_sym_path, .{}); | 368 | log.debug("creating {s}.dSYM bundle in {s}", .{ sub_path, dir.path }); |
| 369 | defer d_sym_bundle.close(); | 369 | |
| 370 | const d_sym_file = try d_sym_bundle.createFile(sub_path, .{ | 370 | const d_sym_path = try fmt.allocPrint( |
| 371 | .truncate = false, | 371 | allocator, |
| 372 | .read = true, | 372 | "{s}.dSYM" ++ fs.path.sep_str ++ "Contents" ++ fs.path.sep_str ++ "Resources" ++ fs.path.sep_str ++ "DWARF", |
| 373 | }); | 373 | .{sub_path}, |
| 374 | self.d_sym = .{ | 374 | ); |
| 375 | .base = self, | 375 | defer allocator.free(d_sym_path); |
| 376 | .file = d_sym_file, | 376 | |
| 377 | }; | 377 | var d_sym_bundle = try dir.handle.makeOpenPath(d_sym_path, .{}); |
| | 378 | defer d_sym_bundle.close(); |
| | 379 | |
| | 380 | const d_sym_file = try d_sym_bundle.createFile(sub_path, .{ |
| | 381 | .truncate = false, |
| | 382 | .read = true, |
| | 383 | }); |
| | 384 | |
| | 385 | self.d_sym = .{ |
| | 386 | .base = self, |
| | 387 | .file = d_sym_file, |
| | 388 | }; |
| | 389 | } |
| 378 | | 390 | |
| 379 | // Index 0 is always a null symbol. | 391 | // Index 0 is always a null symbol. |
| 380 | try self.locals.append(allocator, .{ | 392 | try self.locals.append(allocator, .{ |
| ... | @@ -387,7 +399,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio | ... | @@ -387,7 +399,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio |
| 387 | | 399 | |
| 388 | switch (options.output_mode) { | 400 | switch (options.output_mode) { |
| 389 | .Exe => {}, | 401 | .Exe => {}, |
| 390 | .Obj => {}, | 402 | .Obj => return error.TODOImplementWritingObjFiles, |
| 391 | .Lib => return error.TODOImplementWritingLibFiles, | 403 | .Lib => return error.TODOImplementWritingLibFiles, |
| 392 | } | 404 | } |
| 393 | | 405 | |