From 513b395f7f553e5caa3087d17c04f46b8bb407ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Fri, 19 Jun 2026 11:48:14 +0200 Subject: [PATCH 1/2] llvm: fix C ABI lowering for x32 closes https://codeberg.org/ziglang/zig/issues/35838 --- src/codegen/llvm/FuncGen.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/codegen/llvm/FuncGen.zig b/src/codegen/llvm/FuncGen.zig index dd4e5113f96d733f4e265000c05d749643a33200..787ab1a7f0ab9b8fd96a9607a2e19eadb8bba997 100644 --- a/src/codegen/llvm/FuncGen.zig +++ b/src/codegen/llvm/FuncGen.zig @@ -6663,7 +6663,7 @@ const ParamTypeIterator = struct { .async => { @panic("TODO implement async function lowering in the LLVM backend"); }, - .x86_64_sysv => return it.nextSystemV(ty), + .x86_64_sysv, .x86_64_x32 => return it.nextSystemV(ty), .x86_64_win => return it.nextWin64(ty), .x86_stdcall => { it.zig_index += 1; @@ -6940,7 +6940,7 @@ pub fn firstParamSRet(fn_info: InternPool.Key.FuncType, zcu: *Zcu, target: *cons return switch (fn_info.cc) { .auto => returnTypeByRef(zcu, target, return_type), - .x86_64_sysv => firstParamSRetSystemV(return_type, zcu, target), + .x86_64_sysv, .x86_64_x32 => firstParamSRetSystemV(return_type, zcu, target), .x86_64_win => x86_64_abi.classifyWindows(return_type, zcu, target, .ret) == .memory, .x86_sysv, .x86_win => isByRef(return_type, zcu), .x86_stdcall => !isScalar(zcu, return_type), @@ -6999,7 +6999,7 @@ pub fn lowerFnRetTy(o: *Object, fn_info: InternPool.Key.FuncType) Allocator.Erro switch (fn_info.cc) { .@"inline" => unreachable, .auto => return if (returnTypeByRef(zcu, target, return_type)) .void else o.lowerType(return_type), - .x86_64_sysv => return lowerSystemVFnRetTy(o, fn_info), + .x86_64_sysv, .x86_64_x32 => return lowerSystemVFnRetTy(o, fn_info), .x86_64_win => return lowerWin64FnRetTy(o, fn_info), .x86_stdcall => return if (isScalar(zcu, return_type)) o.lowerType(return_type) else .void, .x86_fastcall => return lowerX86FastcallFnRetTy(o, zcu, return_type), -- 2.54.0 From e6d26bf962b75b4f0dc200d56fa5776e39f5a18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Fri, 19 Jun 2026 11:49:34 +0200 Subject: [PATCH 2/2] test: re-enable C ABI tests for x86_64-linux-muslx32 --- test/tests.zig | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/tests.zig b/test/tests.zig index a3883223728b7141c6a7f90a76a57e5914a75af5..afe2f09560955a1a87282ffd411dd9e0fbca32c2 100644 --- a/test/tests.zig +++ b/test/tests.zig @@ -1997,13 +1997,13 @@ const c_abi_targets = blk: { }, .use_llvm = true, }, - // .{ - // .target = .{ - // .cpu_arch = .x86_64, - // .os_tag = .linux, - // .abi = .muslx32, - // }, - // }, + .{ + .target = .{ + .cpu_arch = .x86_64, + .os_tag = .linux, + .abi = .muslx32, + }, + }, // WASI Targets -- 2.54.0