authorgravatar for clara@bnuuycoded.ukbnuuydev <clara@bnuuycoded.uk> 2025-10-15 03:23:57+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-16 13:59:02+02:00
log173f497e29daf377a6b843e6ed8cdddc12ceb712
treea741433d6976b62b73536670cae348836c62876e
parent48f8133beaef31121caea82e39190291bdfdc633

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.

1 files changed, 5 insertions(+), 5 deletions(-)

src/codegen/llvm.zig+5-5
......@@ -332,13 +332,13 @@ pub fn dataLayout(target: *const std.Target) []const u8 {
332332 .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",
333333 .lanai => "E-m:e-p:32:32-i64:64-a:0:32-n32-S64",
334334 .aarch64 => if (target.ofmt == .macho)
335 if (target.os.tag == .windows)
335 if (target.os.tag == .windows or target.os.tag == .uefi)
336336 "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
337337 else if (target.abi == .ilp32)
338338 "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
339339 else
340340 "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
341 else if (target.os.tag == .windows)
341 else if (target.os.tag == .windows or target.os.tag == .uefi)
342342 "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"
343343 else
344344 "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 {
353353 "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
354354 .thumb => if (target.ofmt == .macho)
355355 "e-m:o-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
356 else if (target.os.tag == .windows)
356 else if (target.os.tag == .windows or target.os.tag == .uefi)
357357 "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
358358 else
359359 "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 {
419419 "E-m:l-p1:32:32-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
420420 else
421421 "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64",
422 .x86 => if (target.os.tag == .windows) switch (target.abi) {
422 .x86 => if (target.os.tag == .windows or target.os.tag == .uefi) switch (target.abi) {
423423 .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",
424424 .gnu => if (target.ofmt == .coff)
425425 "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 {
449449 "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
450450 else switch (target.abi) {
451451 .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",
452 else => if (target.os.tag == .windows and target.ofmt == .coff)
452 else => if ((target.os.tag == .windows or target.os.tag == .uefi) and target.ofmt == .coff)
453453 "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
454454 else
455455 "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",