authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-15 01:25:37-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-05-15 01:25:37-04:00
log1e5e664555e381f89ea337167bd8f07081872735
tree7da8e3820681525c8823c8a4508dcf76ab6d0109
parent2dcec42b74cc0ae2bac5e5ef8a65955a55dca587
parente93254412b2bc516c3add5b46843b94b3a0f9239
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #8773 from ziglang/macho-dsym-path

macho: put dSYM bundle in zig-cache

1 files changed, 24 insertions(+), 12 deletions(-)

src/link/MachO.zig+24-12
...@@ -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;
364364
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.strip and options.module != null) {
367 defer allocator.free(d_sym_path);367 const dir = options.module.?.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 }
378390
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, .{