| ... | ... | @@ -12,6 +12,20 @@ pub fn flush(macho_file: *MachO, comp: *Compilation, module_obj_path: ?[]const u |
| 12 | 12 | |
| 13 | 13 | if (module_obj_path) |path| try positionals.append(.{ .path = path }); |
| 14 | 14 | |
| 15 | if (positionals.items.len == 1) { |
| 16 | // Instead of invoking a full-blown `-r` mode on the input which sadly will strip all |
| 17 | // debug info segments/sections (this is apparently by design by Apple), we copy |
| 18 | // the *only* input file over. |
| 19 | // TODO: in the future, when we implement `dsymutil` alternative directly in the Zig |
| 20 | // compiler, investigate if we can get rid of this `if` prong here. |
| 21 | const path = positionals.items[0].path; |
| 22 | const in_file = try std.fs.cwd().openFile(path, .{}); |
| 23 | const stat = try in_file.stat(); |
| 24 | const amt = try in_file.copyRangeAll(0, macho_file.base.file.?, 0, stat.size); |
| 25 | if (amt != stat.size) return error.InputOutput; // TODO: report an actual user error |
| 26 | return; |
| 27 | } |
| 28 | |
| 15 | 29 | for (positionals.items) |obj| { |
| 16 | 30 | macho_file.parsePositional(obj.path, obj.must_link) catch |err| switch (err) { |
| 17 | 31 | error.MalformedObject, |