From bf959666e8013518660b188a365cbd383d516af3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 27 May 2026 17:08:28 -0700 Subject: [PATCH] compiler: don't depend on skip_non_native option The dev environment system solves this use case better --- build.zig | 1 - src/link/Elf.zig | 12 ------------ src/link/MachO.zig | 9 --------- src/link/Wasm.zig | 11 ----------- 4 files changed, 33 deletions(-) diff --git a/build.zig b/build.zig index b4172e5893c1502422705f1687b7f2e03b934458..c914d0f161f818a493d933c77dba7884258a4921 100644 --- a/build.zig +++ b/build.zig @@ -233,7 +233,6 @@ pub fn build(b: *std.Build) !void { exe.root_module.addOptions("build_options", exe_options); exe_options.addOption(u32, "mem_leak_frames", mem_leak_frames); - exe_options.addOption(bool, "skip_non_native", skip_non_native); exe_options.addOption(bool, "have_llvm", enable_llvm); exe_options.addOption(bool, "llvm_has_m68k", llvm_has_m68k); exe_options.addOption(bool, "llvm_has_csky", llvm_has_csky); diff --git a/src/link/Elf.zig b/src/link/Elf.zig index f59e4d859752182b347033592ec26bc9118a46e7..3b582bf8228e2c4a8fcb11799bab254ea9c398b4 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1691,9 +1691,6 @@ pub fn updateFunc( func_index: InternPool.Index, mir: *const codegen.AnyMir, ) link.File.UpdateNavError!void { - if (build_options.skip_non_native and builtin.object_format != .elf) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } return self.zigObjectPtr().?.updateFunc(self, pt, func_index, mir); } @@ -1702,9 +1699,6 @@ pub fn updateNav( pt: Zcu.PerThread, nav: InternPool.Nav.Index, ) link.File.UpdateNavError!void { - if (build_options.skip_non_native and builtin.object_format != .elf) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } return self.zigObjectPtr().?.updateNav(self, pt, nav); } @@ -1714,9 +1708,6 @@ pub fn updateContainerType( ty: InternPool.Index, success: bool, ) link.File.UpdateContainerTypeError!void { - if (build_options.skip_non_native and builtin.object_format != .elf) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } return self.zigObjectPtr().?.updateContainerType(pt, ty, success) catch |err| switch (err) { error.OutOfMemory => |e| return e, }; @@ -1728,9 +1719,6 @@ pub fn updateExports( exported: Zcu.Exported, export_indices: []const Zcu.Export.Index, ) link.File.UpdateExportsError!void { - if (build_options.skip_non_native and builtin.object_format != .elf) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } return self.zigObjectPtr().?.updateExports(self, pt, exported, export_indices); } diff --git a/src/link/MachO.zig b/src/link/MachO.zig index ec22c9e07036ae7cc9396be27e09e2ec67f31393..02f599e591cf36a6ac2a24630b2f794635495797 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -3075,16 +3075,10 @@ pub fn updateFunc( func_index: InternPool.Index, mir: *const codegen.AnyMir, ) link.File.UpdateNavError!void { - if (build_options.skip_non_native and builtin.object_format != .macho) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } return self.getZigObject().?.updateFunc(self, pt, func_index, mir); } pub fn updateNav(self: *MachO, pt: Zcu.PerThread, nav: InternPool.Nav.Index) link.File.UpdateNavError!void { - if (build_options.skip_non_native and builtin.object_format != .macho) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } return self.getZigObject().?.updateNav(self, pt, nav); } @@ -3098,9 +3092,6 @@ pub fn updateExports( exported: Zcu.Exported, export_indices: []const Zcu.Export.Index, ) link.File.UpdateExportsError!void { - if (build_options.skip_non_native and builtin.object_format != .macho) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } return self.getZigObject().?.updateExports(self, pt, exported, export_indices); } diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig index 2a22e88efe7d10b3cfa4ecd0748890bf8b707d61..72119160c459bc77eeb80a0ffefbc966e29caf08 100644 --- a/src/link/Wasm.zig +++ b/src/link/Wasm.zig @@ -3192,10 +3192,6 @@ pub fn updateFunc( func_index: InternPool.Index, any_mir: *const codegen.AnyMir, ) !void { - if (build_options.skip_non_native and builtin.object_format != .wasm) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } - dev.check(.wasm_backend); // This linker implementation only works with codegen backend `.stage2_wasm`. @@ -3279,9 +3275,6 @@ pub fn updateFunc( // Generate code for the "Nav", storing it in memory to be later written to // the file on flush(). pub fn updateNav(wasm: *Wasm, pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) !void { - if (build_options.skip_non_native and builtin.object_format != .wasm) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } const zcu = pt.zcu; const ip = &zcu.intern_pool; const nav = ip.getNav(nav_index); @@ -3378,10 +3371,6 @@ pub fn updateExports( exported: Zcu.Exported, export_indices: []const Zcu.Export.Index, ) !void { - if (build_options.skip_non_native and builtin.object_format != .wasm) { - @panic("Attempted to compile for object format that was disabled by build configuration"); - } - const zcu = pt.zcu; const gpa = zcu.gpa; const ip = &zcu.intern_pool; -- 2.54.0