| ... | @@ -29,7 +29,6 @@ pub fn main() !void { | ... | @@ -29,7 +29,6 @@ pub fn main() !void { |
| 29 | } | 29 | } |
| 30 | | 30 | |
| 31 | fn cmdObjCopy(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | 31 | fn cmdObjCopy(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 32 | _ = gpa; | | |
| 33 | var i: usize = 0; | 32 | var i: usize = 0; |
| 34 | var opt_out_fmt: ?std.Target.ObjectFormat = null; | 33 | var opt_out_fmt: ?std.Target.ObjectFormat = null; |
| 35 | var opt_input: ?[]const u8 = null; | 34 | var opt_input: ?[]const u8 = null; |
| ... | @@ -148,12 +147,16 @@ fn cmdObjCopy(gpa: Allocator, arena: Allocator, args: []const []const u8) !void | ... | @@ -148,12 +147,16 @@ fn cmdObjCopy(gpa: Allocator, arena: Allocator, args: []const []const u8) !void |
| 148 | const input = opt_input orelse fatal("expected input parameter", .{}); | 147 | const input = opt_input orelse fatal("expected input parameter", .{}); |
| 149 | const output = opt_output orelse fatal("expected output parameter", .{}); | 148 | const output = opt_output orelse fatal("expected output parameter", .{}); |
| 150 | | 149 | |
| | 150 | var threaded: std.Io.Threaded = .init(gpa); |
| | 151 | defer threaded.deinit(); |
| | 152 | const io = threaded.io(); |
| | 153 | |
| 151 | const input_file = fs.cwd().openFile(input, .{}) catch |err| fatal("failed to open {s}: {t}", .{ input, err }); | 154 | const input_file = fs.cwd().openFile(input, .{}) catch |err| fatal("failed to open {s}: {t}", .{ input, err }); |
| 152 | defer input_file.close(); | 155 | defer input_file.close(); |
| 153 | | 156 | |
| 154 | const stat = input_file.stat() catch |err| fatal("failed to stat {s}: {t}", .{ input, err }); | 157 | const stat = input_file.stat() catch |err| fatal("failed to stat {s}: {t}", .{ input, err }); |
| 155 | | 158 | |
| 156 | var in: File.Reader = .initSize(input_file, &input_buffer, stat.size); | 159 | var in: File.Reader = .initSize(input_file, io, &input_buffer, stat.size); |
| 157 | | 160 | |
| 158 | const elf_hdr = std.elf.Header.read(&in.interface) catch |err| switch (err) { | 161 | const elf_hdr = std.elf.Header.read(&in.interface) catch |err| switch (err) { |
| 159 | error.ReadFailed => fatal("unable to read {s}: {t}", .{ input, in.err.? }), | 162 | error.ReadFailed => fatal("unable to read {s}: {t}", .{ input, in.err.? }), |