authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-24 15:37:09-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-08-26 20:54:49-07:00
log03cc522fc0e3cd2434510eec7c39aa09282f4433
tree3e125cac1cc4eebc38e206bedd04cbec2aae9c5b
parent66014c3de19a49d0c1001dfbbef5a85c375f4e32

spork8: object format is .bin extension (raw machine code)


9 files changed, 15 insertions(+), 18 deletions(-)

lib/std/Build/Configuration.zig-1
......@@ -2443,7 +2443,6 @@ pub const TargetQuery = struct {
24432443 elf,
24442444 hex,
24452445 macho,
2446 spork8,
24472446 plan9,
24482447 raw,
24492448 spirv,
lib/std/Target.zig+2-4
......@@ -104,7 +104,7 @@ pub const Os = struct {
104104 .plan9 => arch.plan9Ext(),
105105 else => switch (arch) {
106106 .wasm32, .wasm64 => ".wasm",
107 .spork8 => ".spork8",
107 .spork8 => ".bin",
108108 else => "",
109109 },
110110 };
......@@ -1065,7 +1065,6 @@ pub const ObjectFormat = enum {
10651065 hex,
10661066 /// The Mach object format used by macOS and other Apple platforms.
10671067 macho,
1068 spork8,
10691068 /// The a.out format used by Plan 9 from Bell Labs.
10701069 plan9,
10711070 /// Machine code with no metadata.
......@@ -1081,7 +1080,6 @@ pub const ObjectFormat = enum {
10811080 .coff => ".obj",
10821081 .elf, .macho, .wasm => ".o",
10831082 .hex => ".ihex",
1084 .spork8 => ".spork8",
10851083 .plan9 => arch.plan9Ext(),
10861084 .raw => ".bin",
10871085 .spirv => ".spv",
......@@ -1096,7 +1094,7 @@ pub const ObjectFormat = enum {
10961094 else => switch (arch) {
10971095 .spirv32, .spirv64 => .spirv,
10981096 .wasm32, .wasm64 => .wasm,
1099 .spork8 => .spork8,
1097 .spork8 => .raw,
11001098 else => .elf,
11011099 },
11021100 };
lib/std/debug.zig+2-2
......@@ -75,8 +75,8 @@ pub fn TargetInfo(os: std.Target.Os.Tag, arch: std.Target.Cpu.Arch) type {
7575 else => @import("debug/SelfInfo/Elf.zig"),
7676 },
7777 .macho => @import("debug/SelfInfo/MachO.zig"),
78 .plan9, .spirv, .wasm, .spork8 => void,
79 .c, .hex, .raw => unreachable,
78 .plan9, .spirv, .wasm, .raw, .hex => void,
79 .c => unreachable,
8080 };
8181}
8282
lib/std/zig.zig-1
......@@ -259,7 +259,6 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
259259 .spirv => return std.fmt.allocPrint(allocator, "{s}.spv", .{root_name}),
260260 .hex => return std.fmt.allocPrint(allocator, "{s}.ihex", .{root_name}),
261261 .raw => return std.fmt.allocPrint(allocator, "{s}.bin", .{root_name}),
262 .spork8 => return std.fmt.allocPrint(allocator, "{s}.spork8", .{root_name}),
263262 .plan9 => switch (options.output_mode) {
264263 .Exe => return allocator.dupe(u8, root_name),
265264 .Obj => return std.fmt.allocPrint(allocator, "{s}{s}", .{
src/Compilation/Config.zig+1-1
......@@ -502,7 +502,7 @@ pub fn resolve(options: Options) ResolveError!Config {
502502 .windows, .uefi => .code_view,
503503 else => .{ .dwarf = .@"32" },
504504 },
505 .spirv, .hex, .raw, .plan9, .spork8 => .strip,
505 .spirv, .hex, .raw, .plan9 => .strip,
506506 };
507507 };
508508
src/codegen.zig+4-4
......@@ -80,7 +80,7 @@ pub fn legalizeFeatures(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) ?*co
8080 .stage2_x86,
8181 .stage2_riscv64,
8282 .stage2_sparc64,
83 .stage2_spork8,
83 .zsf_spork8,
8484 .stage2_spirv,
8585 => |backend| {
8686 dev.check(devFeatureForBackend(backend));
......@@ -122,7 +122,7 @@ pub const AnyMir = union {
122122 .stage2_wasm => "wasm",
123123 .stage2_c => "c",
124124 .stage2_spirv => "spirv",
125 .stage2_spork8 => "spork8",
125 .zsf_spork8 => "spork8",
126126 else => unreachable,
127127 };
128128 }
......@@ -140,7 +140,7 @@ pub const AnyMir = union {
140140 .stage2_wasm,
141141 .stage2_c,
142142 .stage2_spirv,
143 .stage2_spork8,
143 .zsf_spork8,
144144 => |backend_ct| @field(mir, tag(backend_ct)).deinit(gpa),
145145 }
146146 }
......@@ -170,7 +170,7 @@ pub fn generateFunction(
170170 .stage2_x86_64,
171171 .stage2_wasm,
172172 .stage2_c,
173 .stage2_spork8,
173 .zsf_spork8,
174174 .stage2_spirv,
175175 => |backend| {
176176 dev.check(devFeatureForBackend(backend));
src/link.zig+4-2
......@@ -1300,9 +1300,11 @@ pub const File = struct {
13001300 .plan9 => .plan9,
13011301 .c => .c,
13021302 .spirv => .spirv,
1303 .spork8 => .spork8,
13041303 .hex => @panic("TODO implement hex object format"),
1305 .raw => @panic("TODO implement raw object format"),
1304 // This may seem surprising at first, but with a little massaging, the spork8 linker
1305 // could and probably should be generalized into a "raw linker" which is used to output
1306 // bare machine code for any architecture for which a corresponding backend exists.
1307 .raw => .spork8,
13061308 };
13071309 }
13081310
src/link/Spork8.zig+2-2
......@@ -47,7 +47,7 @@ pub fn createEmpty(
4747 options: link.File.OpenOptions,
4848) !*Spork8 {
4949 const target = comp.root_mod.resolved_target.result;
50 assert(target.ofmt == .spork8);
50 assert(target.ofmt == .raw);
5151 assert(comp.config.output_mode == .Exe);
5252 const io = comp.io;
5353
......@@ -90,7 +90,7 @@ pub fn updateFunc(
9090 any_mir: *const codegen.AnyMir,
9191) !void {
9292 dev.check(.spork8_backend);
93 // This linker implementation only works with codegen backend `.stage2_spork8`.
93 // This linker implementation only works with `std.lang.CompilerBackend.zsf_spork8`.
9494 const mir = &any_mir.spork8;
9595 const zcu = pt.zcu;
9696 const gpa = zcu.gpa;
src/target.zig-1
......@@ -189,7 +189,6 @@ pub fn hasLlvmSupport(target: *const std.Target, ofmt: std.Target.ObjectFormat)
189189 // LLVM does not support these object formats:
190190 .c,
191191 .plan9,
192 .spork8,
193192 => return false,
194193
195194 .coff,