| author | |
| committer | |
| log | 2b3df5c81d8455856c2b355694ce818385218f36 |
| tree | f743e1eda1d8b497836fbeac75545d3d119c9844 |
| parent | 1a84c23d69c7e26ba1916c1f9f0e6002ff40d116 |
5 files changed, 15 insertions(+), 21 deletions(-)
src/link/Coff.zig+3-5| ... | ... | @@ -134,16 +134,14 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 134 | 134 | return createEmpty(allocator, options); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | const self = try createEmpty(allocator, options); | |
| 138 | errdefer self.base.destroy(); | |
| 139 | ||
| 137 | 140 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ |
| 138 | 141 | .truncate = false, |
| 139 | 142 | .read = true, |
| 140 | 143 | .mode = link.determineMode(options), |
| 141 | 144 | }); |
| 142 | errdefer file.close(); | |
| 143 | ||
| 144 | const self = try createEmpty(allocator, options); | |
| 145 | errdefer self.base.destroy(); | |
| 146 | ||
| 147 | 145 | self.base.file = file; |
| 148 | 146 | |
| 149 | 147 | // TODO Write object specific relocations, COFF symbol table, then enable object file output. |
src/link/Elf.zig+3-4| ... | ... | @@ -299,15 +299,14 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 299 | 299 | return createEmpty(allocator, options); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | const self = try createEmpty(allocator, options); | |
| 303 | errdefer self.base.destroy(); | |
| 304 | ||
| 302 | 305 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ |
| 303 | 306 | .truncate = false, |
| 304 | 307 | .read = true, |
| 305 | 308 | .mode = link.determineMode(options), |
| 306 | 309 | }); |
| 307 | errdefer file.close(); | |
| 308 | ||
| 309 | const self = try createEmpty(allocator, options); | |
| 310 | errdefer self.base.destroy(); | |
| 311 | 310 | |
| 312 | 311 | self.base.file = file; |
| 313 | 312 | self.shdr_table_dirty = true; |
src/link/Plan9.zig+5-4| ... | ... | @@ -643,14 +643,16 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 643 | 643 | if (options.use_llvm) |
| 644 | 644 | return error.LLVMBackendDoesNotSupportPlan9; |
| 645 | 645 | assert(options.object_format == .plan9); |
| 646 | ||
| 647 | const self = try createEmpty(allocator, options); | |
| 648 | errdefer self.base.destroy(); | |
| 649 | ||
| 646 | 650 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ |
| 647 | 651 | .read = true, |
| 648 | 652 | .mode = link.determineMode(options), |
| 649 | 653 | }); |
| 650 | 654 | errdefer file.close(); |
| 651 | ||
| 652 | const self = try createEmpty(allocator, options); | |
| 653 | errdefer self.base.destroy(); | |
| 655 | self.base.file = file; | |
| 654 | 656 | |
| 655 | 657 | self.bases = defaultBaseAddrs(options.target.cpu.arch); |
| 656 | 658 | |
| ... | ... | @@ -673,7 +675,6 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 673 | 675 | }, |
| 674 | 676 | }); |
| 675 | 677 | |
| 676 | self.base.file = file; | |
| 677 | 678 | return self; |
| 678 | 679 | } |
| 679 | 680 |
src/link/SpirV.zig+2-4| ... | ... | @@ -104,13 +104,11 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 104 | 104 | if (options.use_llvm) return error.LLVM_BackendIsTODO_ForSpirV; // TODO: LLVM Doesn't support SpirV at all. |
| 105 | 105 | if (options.use_lld) return error.LLD_LinkingIsTODO_ForSpirV; // TODO: LLD Doesn't support SpirV at all. |
| 106 | 106 | |
| 107 | // TODO: read the file and keep valid parts instead of truncating | |
| 108 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); | |
| 109 | errdefer file.close(); | |
| 110 | ||
| 111 | 107 | const spirv = try createEmpty(allocator, options); |
| 112 | 108 | errdefer spirv.base.destroy(); |
| 113 | 109 | |
| 110 | // TODO: read the file and keep valid parts instead of truncating | |
| 111 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); | |
| 114 | 112 | spirv.base.file = file; |
| 115 | 113 | return spirv; |
| 116 | 114 | } |
src/link/Wasm.zig+2-4| ... | ... | @@ -105,13 +105,11 @@ pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Option |
| 105 | 105 | return createEmpty(allocator, options); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | // TODO: read the file and keep valid parts instead of truncating | |
| 109 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); | |
| 110 | errdefer file.close(); | |
| 111 | ||
| 112 | 108 | const wasm_bin = try createEmpty(allocator, options); |
| 113 | 109 | errdefer wasm_bin.base.destroy(); |
| 114 | 110 | |
| 111 | // TODO: read the file and keep valid parts instead of truncating | |
| 112 | const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true }); | |
| 115 | 113 | wasm_bin.base.file = file; |
| 116 | 114 | |
| 117 | 115 | try file.writeAll(&(wasm.magic ++ wasm.version)); |