diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-08-18 18:58:28 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-08-18 18:58:28 -0700 |
| commit | b975f7a56fec9e0e7aca9832282bc772c743d731 (patch) | |
| tree | b19f37881f1fe8918dc9aa156b3210c4b7b343fc /src/link.zig | |
| parent | 517eb73b23ee77672abe6b20b79b6648cd3ff879 (diff) | |
| download | zig-b975f7a56fec9e0e7aca9832282bc772c743d731.tar.gz zig-b975f7a56fec9e0e7aca9832282bc772c743d731.zip | |
std.Target gains ObjectFormat field
Diffstat (limited to 'src/link.zig')
| -rw-r--r-- | src/link.zig | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/link.zig b/src/link.zig index a6dafce20e..31b54f705a 100644 --- a/src/link.zig +++ b/src/link.zig @@ -72,7 +72,6 @@ pub const Options = struct { target: std.Target, output_mode: std.builtin.OutputMode, link_mode: std.builtin.LinkMode, - object_format: std.Target.ObjectFormat, optimize_mode: std.builtin.Mode, machine_code_model: std.builtin.CodeModel, root_name: [:0]const u8, @@ -273,13 +272,13 @@ pub const File = struct { /// rewriting it. A malicious file is detected as incremental link failure /// and does not cause Illegal Behavior. This operation is not atomic. pub fn openPath(allocator: Allocator, options: Options) !*File { - if (options.object_format == .macho) { + if (options.target.ofmt == .macho) { return &(try MachO.openPath(allocator, options)).base; } const use_stage1 = build_options.is_stage1 and options.use_stage1; if (use_stage1 or options.emit == null) { - return switch (options.object_format) { + return switch (options.target.ofmt) { .coff => &(try Coff.createEmpty(allocator, options)).base, .elf => &(try Elf.createEmpty(allocator, options)).base, .macho => unreachable, @@ -298,7 +297,7 @@ pub const File = struct { if (options.module == null) { // No point in opening a file, we would not write anything to it. // Initialize with empty. - return switch (options.object_format) { + return switch (options.target.ofmt) { .coff => &(try Coff.createEmpty(allocator, options)).base, .elf => &(try Elf.createEmpty(allocator, options)).base, .macho => unreachable, @@ -314,12 +313,12 @@ pub const File = struct { // Open a temporary object file, not the final output file because we // want to link with LLD. break :blk try std.fmt.allocPrint(allocator, "{s}{s}", .{ - emit.sub_path, options.object_format.fileExt(options.target.cpu.arch), + emit.sub_path, options.target.ofmt.fileExt(options.target.cpu.arch), }); } else emit.sub_path; errdefer if (use_lld) allocator.free(sub_path); - const file: *File = switch (options.object_format) { + const file: *File = switch (options.target.ofmt) { .coff => &(try Coff.openPath(allocator, sub_path, options)).base, .elf => &(try Elf.openPath(allocator, sub_path, options)).base, .macho => unreachable, |
