zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit bf959666e8013518660b188a365cbd383d516af3 (tree)
parent b3c6a3b047cb248afb0d61ae723ae41aeab9289b
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 27 May 2026 17:08:28 -0700

compiler: don't depend on skip_non_native option

The dev environment system solves this use case better

Diffstat:
Mbuild.zig | 1-
Msrc/link/Elf.zig | 12------------
Msrc/link/MachO.zig | 9---------
Msrc/link/Wasm.zig | 11-----------
4 files changed, 0 insertions(+), 33 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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;