aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-09-26 12:42:07 -0700
committerAndrew Kelley <andrew@ziglang.org>2020-09-26 12:42:07 -0700
commit26f2f9bf1c774caf246317b3fc032449e982a150 (patch)
tree43bc4d4b19cea9a245d87f105841d075ab75f5ab /src/link
parent9b83112a1f6af758a1a995ea8838a2319d2fbc1e (diff)
downloadzig-26f2f9bf1c774caf246317b3fc032449e982a150.tar.gz
zig-26f2f9bf1c774caf246317b3fc032449e982a150.zip
stage2: implement -fno-emit-bin
we are now passing the cli tests
Diffstat (limited to 'src/link')
-rw-r--r--src/link/C.zig2
-rw-r--r--src/link/Coff.zig2
-rw-r--r--src/link/Elf.zig6
-rw-r--r--src/link/MachO.zig2
-rw-r--r--src/link/Wasm.zig2
5 files changed, 7 insertions, 7 deletions
diff --git a/src/link/C.zig b/src/link/C.zig
index d5d1249244..467e10998e 100644
--- a/src/link/C.zig
+++ b/src/link/C.zig
@@ -30,7 +30,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
if (options.use_llvm) return error.LLVMHasNoCBackend;
if (options.use_lld) return error.LLDHasNoCBackend;
- const file = try options.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true, .mode = link.determineMode(options) });
+ const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true, .mode = link.determineMode(options) });
errdefer file.close();
var c_file = try allocator.create(C);
diff --git a/src/link/Coff.zig b/src/link/Coff.zig
index 31726a5712..c396732bc1 100644
--- a/src/link/Coff.zig
+++ b/src/link/Coff.zig
@@ -120,7 +120,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
if (options.use_llvm) return error.LLVM_BackendIsTODO_ForCoff; // TODO
if (options.use_lld) return error.LLD_LinkingIsTODO_ForCoff; // TODO
- const file = try options.directory.handle.createFile(sub_path, .{
+ const file = try options.emit.?.directory.handle.createFile(sub_path, .{
.truncate = false,
.read = true,
.mode = link.determineMode(options),
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index 903cb57d03..c8067058d9 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -229,7 +229,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
if (options.use_llvm) return error.LLVMBackendUnimplementedForELF; // TODO
- const file = try options.directory.handle.createFile(sub_path, .{
+ const file = try options.emit.?.directory.handle.createFile(sub_path, .{
.truncate = false,
.read = true,
.mode = link.determineMode(options),
@@ -1218,7 +1218,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
defer arena_allocator.deinit();
const arena = &arena_allocator.allocator;
- const directory = self.base.options.directory; // Just an alias to make it shorter to type.
+ const directory = self.base.options.emit.?.directory; // Just an alias to make it shorter to type.
// If there is no Zig code to compile, then we should skip flushing the output file because it
// will not be part of the linker line anyway.
@@ -1401,7 +1401,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
try argv.append("-pie");
}
- const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.sub_path});
+ const full_out_path = try directory.join(arena, &[_][]const u8{self.base.options.emit.?.sub_path});
try argv.append("-o");
try argv.append(full_out_path);
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index 3b70a0d710..c38c6b34ff 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -142,7 +142,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
if (options.use_llvm) return error.LLVM_BackendIsTODO_ForMachO; // TODO
if (options.use_lld) return error.LLD_LinkingIsTODO_ForMachO; // TODO
- const file = try options.directory.handle.createFile(sub_path, .{
+ const file = try options.emit.?.directory.handle.createFile(sub_path, .{
.truncate = false,
.read = true,
.mode = link.determineMode(options),
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index 1160e471fe..4cff09ef69 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -59,7 +59,7 @@ pub fn openPath(allocator: *Allocator, sub_path: []const u8, options: link.Optio
if (options.use_lld) return error.LLD_LinkingIsTODO_ForWasm; // TODO
// TODO: read the file and keep vaild parts instead of truncating
- const file = try options.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true });
+ const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .truncate = true, .read = true });
errdefer file.close();
const wasm = try createEmpty(allocator, options);