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 {...@@ -2443,7 +2443,6 @@ pub const TargetQuery = struct {
2443 elf,2443 elf,
2444 hex,2444 hex,
2445 macho,2445 macho,
2446 spork8,
2447 plan9,2446 plan9,
2448 raw,2447 raw,
2449 spirv,2448 spirv,
lib/std/Target.zig+2-4
...@@ -104,7 +104,7 @@ pub const Os = struct {...@@ -104,7 +104,7 @@ pub const Os = struct {
104 .plan9 => arch.plan9Ext(),104 .plan9 => arch.plan9Ext(),
105 else => switch (arch) {105 else => switch (arch) {
106 .wasm32, .wasm64 => ".wasm",106 .wasm32, .wasm64 => ".wasm",
107 .spork8 => ".spork8",107 .spork8 => ".bin",
108 else => "",108 else => "",
109 },109 },
110 };110 };
...@@ -1065,7 +1065,6 @@ pub const ObjectFormat = enum {...@@ -1065,7 +1065,6 @@ pub const ObjectFormat = enum {
1065 hex,1065 hex,
1066 /// The Mach object format used by macOS and other Apple platforms.1066 /// The Mach object format used by macOS and other Apple platforms.
1067 macho,1067 macho,
1068 spork8,
1069 /// The a.out format used by Plan 9 from Bell Labs.1068 /// The a.out format used by Plan 9 from Bell Labs.
1070 plan9,1069 plan9,
1071 /// Machine code with no metadata.1070 /// Machine code with no metadata.
...@@ -1081,7 +1080,6 @@ pub const ObjectFormat = enum {...@@ -1081,7 +1080,6 @@ pub const ObjectFormat = enum {
1081 .coff => ".obj",1080 .coff => ".obj",
1082 .elf, .macho, .wasm => ".o",1081 .elf, .macho, .wasm => ".o",
1083 .hex => ".ihex",1082 .hex => ".ihex",
1084 .spork8 => ".spork8",
1085 .plan9 => arch.plan9Ext(),1083 .plan9 => arch.plan9Ext(),
1086 .raw => ".bin",1084 .raw => ".bin",
1087 .spirv => ".spv",1085 .spirv => ".spv",
...@@ -1096,7 +1094,7 @@ pub const ObjectFormat = enum {...@@ -1096,7 +1094,7 @@ pub const ObjectFormat = enum {
1096 else => switch (arch) {1094 else => switch (arch) {
1097 .spirv32, .spirv64 => .spirv,1095 .spirv32, .spirv64 => .spirv,
1098 .wasm32, .wasm64 => .wasm,1096 .wasm32, .wasm64 => .wasm,
1099 .spork8 => .spork8,1097 .spork8 => .raw,
1100 else => .elf,1098 else => .elf,
1101 },1099 },
1102 };1100 };
lib/std/debug.zig+2-2
...@@ -75,8 +75,8 @@ pub fn TargetInfo(os: std.Target.Os.Tag, arch: std.Target.Cpu.Arch) type {...@@ -75,8 +75,8 @@ pub fn TargetInfo(os: std.Target.Os.Tag, arch: std.Target.Cpu.Arch) type {
75 else => @import("debug/SelfInfo/Elf.zig"),75 else => @import("debug/SelfInfo/Elf.zig"),
76 },76 },
77 .macho => @import("debug/SelfInfo/MachO.zig"),77 .macho => @import("debug/SelfInfo/MachO.zig"),
78 .plan9, .spirv, .wasm, .spork8 => void,78 .plan9, .spirv, .wasm, .raw, .hex => void,
79 .c, .hex, .raw => unreachable,79 .c => unreachable,
80 };80 };
81}81}
8282
lib/std/zig.zig-1
...@@ -259,7 +259,6 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe...@@ -259,7 +259,6 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
259 .spirv => return std.fmt.allocPrint(allocator, "{s}.spv", .{root_name}),259 .spirv => return std.fmt.allocPrint(allocator, "{s}.spv", .{root_name}),
260 .hex => return std.fmt.allocPrint(allocator, "{s}.ihex", .{root_name}),260 .hex => return std.fmt.allocPrint(allocator, "{s}.ihex", .{root_name}),
261 .raw => return std.fmt.allocPrint(allocator, "{s}.bin", .{root_name}),261 .raw => return std.fmt.allocPrint(allocator, "{s}.bin", .{root_name}),
262 .spork8 => return std.fmt.allocPrint(allocator, "{s}.spork8", .{root_name}),
263 .plan9 => switch (options.output_mode) {262 .plan9 => switch (options.output_mode) {
264 .Exe => return allocator.dupe(u8, root_name),263 .Exe => return allocator.dupe(u8, root_name),
265 .Obj => return std.fmt.allocPrint(allocator, "{s}{s}", .{264 .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 {...@@ -502,7 +502,7 @@ pub fn resolve(options: Options) ResolveError!Config {
502 .windows, .uefi => .code_view,502 .windows, .uefi => .code_view,
503 else => .{ .dwarf = .@"32" },503 else => .{ .dwarf = .@"32" },
504 },504 },
505 .spirv, .hex, .raw, .plan9, .spork8 => .strip,505 .spirv, .hex, .raw, .plan9 => .strip,
506 };506 };
507 };507 };
508508
src/codegen.zig+4-4
...@@ -80,7 +80,7 @@ pub fn legalizeFeatures(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) ?*co...@@ -80,7 +80,7 @@ pub fn legalizeFeatures(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) ?*co
80 .stage2_x86,80 .stage2_x86,
81 .stage2_riscv64,81 .stage2_riscv64,
82 .stage2_sparc64,82 .stage2_sparc64,
83 .stage2_spork8,83 .zsf_spork8,
84 .stage2_spirv,84 .stage2_spirv,
85 => |backend| {85 => |backend| {
86 dev.check(devFeatureForBackend(backend));86 dev.check(devFeatureForBackend(backend));
...@@ -122,7 +122,7 @@ pub const AnyMir = union {...@@ -122,7 +122,7 @@ pub const AnyMir = union {
122 .stage2_wasm => "wasm",122 .stage2_wasm => "wasm",
123 .stage2_c => "c",123 .stage2_c => "c",
124 .stage2_spirv => "spirv",124 .stage2_spirv => "spirv",
125 .stage2_spork8 => "spork8",125 .zsf_spork8 => "spork8",
126 else => unreachable,126 else => unreachable,
127 };127 };
128 }128 }
...@@ -140,7 +140,7 @@ pub const AnyMir = union {...@@ -140,7 +140,7 @@ pub const AnyMir = union {
140 .stage2_wasm,140 .stage2_wasm,
141 .stage2_c,141 .stage2_c,
142 .stage2_spirv,142 .stage2_spirv,
143 .stage2_spork8,143 .zsf_spork8,
144 => |backend_ct| @field(mir, tag(backend_ct)).deinit(gpa),144 => |backend_ct| @field(mir, tag(backend_ct)).deinit(gpa),
145 }145 }
146 }146 }
...@@ -170,7 +170,7 @@ pub fn generateFunction(...@@ -170,7 +170,7 @@ pub fn generateFunction(
170 .stage2_x86_64,170 .stage2_x86_64,
171 .stage2_wasm,171 .stage2_wasm,
172 .stage2_c,172 .stage2_c,
173 .stage2_spork8,173 .zsf_spork8,
174 .stage2_spirv,174 .stage2_spirv,
175 => |backend| {175 => |backend| {
176 dev.check(devFeatureForBackend(backend));176 dev.check(devFeatureForBackend(backend));
src/link.zig+4-2
...@@ -1300,9 +1300,11 @@ pub const File = struct {...@@ -1300,9 +1300,11 @@ pub const File = struct {
1300 .plan9 => .plan9,1300 .plan9 => .plan9,
1301 .c => .c,1301 .c => .c,
1302 .spirv => .spirv,1302 .spirv => .spirv,
1303 .spork8 => .spork8,
1304 .hex => @panic("TODO implement hex object format"),1303 .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,
1306 };1308 };
1307 }1309 }
13081310
src/link/Spork8.zig+2-2
...@@ -47,7 +47,7 @@ pub fn createEmpty(...@@ -47,7 +47,7 @@ pub fn createEmpty(
47 options: link.File.OpenOptions,47 options: link.File.OpenOptions,
48) !*Spork8 {48) !*Spork8 {
49 const target = comp.root_mod.resolved_target.result;49 const target = comp.root_mod.resolved_target.result;
50 assert(target.ofmt == .spork8);50 assert(target.ofmt == .raw);
51 assert(comp.config.output_mode == .Exe);51 assert(comp.config.output_mode == .Exe);
52 const io = comp.io;52 const io = comp.io;
5353
...@@ -90,7 +90,7 @@ pub fn updateFunc(...@@ -90,7 +90,7 @@ pub fn updateFunc(
90 any_mir: *const codegen.AnyMir,90 any_mir: *const codegen.AnyMir,
91) !void {91) !void {
92 dev.check(.spork8_backend);92 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`.
94 const mir = &any_mir.spork8;94 const mir = &any_mir.spork8;
95 const zcu = pt.zcu;95 const zcu = pt.zcu;
96 const gpa = zcu.gpa;96 const gpa = zcu.gpa;
src/target.zig-1
...@@ -189,7 +189,6 @@ pub fn hasLlvmSupport(target: *const std.Target, ofmt: std.Target.ObjectFormat)...@@ -189,7 +189,6 @@ pub fn hasLlvmSupport(target: *const std.Target, ofmt: std.Target.ObjectFormat)
189 // LLVM does not support these object formats:189 // LLVM does not support these object formats:
190 .c,190 .c,
191 .plan9,191 .plan9,
192 .spork8,
193 => return false,192 => return false,
194193
195 .coff,194 .coff,