Merge pull request 'add OpenBSD libc cross-compilation support' (#30064) from alexrp/zig:openbsd into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30064
Reviewed-by: Andrew Kelley <andrewrk@noreply.codeberg.org>
This commit is contained in:
Alex Rønne Petersen
2026-01-06 16:12:54 +01:00
1781 changed files with 213985 additions and 20 deletions
+2
View File
@@ -455,6 +455,7 @@ pub const CaseTestOptions = struct {
skip_wasm: bool,
skip_freebsd: bool,
skip_netbsd: bool,
skip_openbsd: bool,
skip_windows: bool,
skip_darwin: bool,
skip_linux: bool,
@@ -487,6 +488,7 @@ pub fn lowerToBuildSteps(
if (options.skip_freebsd and case.target.query.os_tag == .freebsd) continue;
if (options.skip_netbsd and case.target.query.os_tag == .netbsd) continue;
if (options.skip_openbsd and case.target.query.os_tag == .openbsd) continue;
if (options.skip_windows and case.target.query.os_tag == .windows) continue;
if (options.skip_darwin and case.target.query.os_tag != null and case.target.query.os_tag.?.isDarwin()) continue;
if (options.skip_linux and case.target.query.os_tag == .linux) continue;
+1
View File
@@ -50,6 +50,7 @@ pub fn build(b: *std.Build) void {
"../../tools/update_glibc.zig",
"../../tools/update_mingw.zig",
"../../tools/update_netbsd_libc.zig",
"../../tools/update_openbsd_libc.zig",
}) |tool_src_path| {
if (std.mem.endsWith(u8, tool_src_path, "dump-cov.zig") and tools_target.result.os.tag == .windows) continue;
+87
View File
@@ -1366,6 +1366,89 @@ const test_targets = blk: {
.link_libc = true,
},
// OpenBSD Targets
.{
.target = .{
.cpu_arch = .aarch64,
.os_tag = .openbsd,
.abi = .none,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .arm,
.os_tag = .openbsd,
.abi = .eabi,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .mips64,
.os_tag = .openbsd,
.abi = .none,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .mips64el,
.os_tag = .openbsd,
.abi = .none,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .powerpc,
.os_tag = .openbsd,
.abi = .eabihf,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .powerpc64,
.os_tag = .openbsd,
.abi = .none,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .riscv64,
.os_tag = .openbsd,
.abi = .none,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .x86,
.os_tag = .openbsd,
.abi = .none,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .x86_64,
.os_tag = .openbsd,
.abi = .none,
},
.link_libc = true,
},
// SPIR-V Targets
// Disabled due to no active maintainer (feel free to fix the failures
@@ -2233,6 +2316,7 @@ const ModuleTestOptions = struct {
skip_wasm: bool,
skip_freebsd: bool,
skip_netbsd: bool,
skip_openbsd: bool,
skip_windows: bool,
skip_darwin: bool,
skip_linux: bool,
@@ -2271,6 +2355,7 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step {
if (options.skip_freebsd and test_target.target.os_tag == .freebsd) continue;
if (options.skip_netbsd and test_target.target.os_tag == .netbsd) continue;
if (options.skip_openbsd and test_target.target.os_tag == .openbsd) continue;
if (options.skip_windows and test_target.target.os_tag == .windows) continue;
if (options.skip_darwin and test_target.target.os_tag != null and test_target.target.os_tag.?.isDarwin()) continue;
if (options.skip_linux and test_target.target.os_tag == .linux) continue;
@@ -2513,6 +2598,7 @@ const CAbiTestOptions = struct {
skip_wasm: bool,
skip_freebsd: bool,
skip_netbsd: bool,
skip_openbsd: bool,
skip_windows: bool,
skip_darwin: bool,
skip_linux: bool,
@@ -2536,6 +2622,7 @@ pub fn addCAbiTests(b: *std.Build, options: CAbiTestOptions) *Step {
if (options.skip_freebsd and c_abi_target.target.os_tag == .freebsd) continue;
if (options.skip_netbsd and c_abi_target.target.os_tag == .netbsd) continue;
if (options.skip_openbsd and c_abi_target.target.os_tag == .openbsd) continue;
if (options.skip_windows and c_abi_target.target.os_tag == .windows) continue;
if (options.skip_darwin and c_abi_target.target.os_tag != null and c_abi_target.target.os_tag.?.isDarwin()) continue;
if (options.skip_linux and c_abi_target.target.os_tag == .linux) continue;