From 173f497e29daf377a6b843e6ed8cdddc12ceb712 Mon Sep 17 00:00:00 2001 From: bnuuydev Date: Wed, 15 Oct 2025 03:23:57 +0100 Subject: [PATCH] llvm-backend: fix uefi data layout the old logic caused the uefi case to fall through which caused an assertion assertion in llvm to fail, as the data layout was wrong. --- src/codegen/llvm.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 20e5696c15..5d0b87baee 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -332,13 +332,13 @@ pub fn dataLayout(target: *const std.Target) []const u8 { .hexagon => "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048", .lanai => "E-m:e-p:32:32-i64:64-a:0:32-n32-S64", .aarch64 => if (target.ofmt == .macho) - if (target.os.tag == .windows) + if (target.os.tag == .windows or target.os.tag == .uefi) "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" else if (target.abi == .ilp32) "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" else "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - else if (target.os.tag == .windows) + else if (target.os.tag == .windows or target.os.tag == .uefi) "e-m:w-p270:32:32-p271:32:32-p272:64:64-p:64:64-i32:32-i64:64-i128:128-n32:64-S128-Fn32" else "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32", @@ -353,7 +353,7 @@ pub fn dataLayout(target: *const std.Target) []const u8 { "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", .thumb => if (target.ofmt == .macho) "e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" - else if (target.os.tag == .windows) + else if (target.os.tag == .windows or target.os.tag == .uefi) "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64" else "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64", @@ -419,7 +419,7 @@ pub fn dataLayout(target: *const std.Target) []const u8 { "E-m:l-p1:32:32-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64" else "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64", - .x86 => if (target.os.tag == .windows) switch (target.abi) { + .x86 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) { .cygnus => "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32", .gnu => if (target.ofmt == .coff) "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:32-n8:16:32-a:0:32-S32" @@ -449,7 +449,7 @@ pub fn dataLayout(target: *const std.Target) []const u8 { "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" else switch (target.abi) { .gnux32, .muslx32 => "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", - else => if (target.os.tag == .windows and target.ofmt == .coff) + else => if ((target.os.tag == .windows or target.os.tag == .uefi) and target.ofmt == .coff) "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" else "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",