| ... | ... | @@ -482,16 +482,6 @@ pub fn arePointersLogical(target: std.Target, as: AddressSpace) bool { |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 { |
| 485 | | // This special-casing should be removed with LLVM 20. |
| 486 | | switch (target.cpu.arch) { |
| 487 | | .mips, .mipsel => return "o32", |
| 488 | | .mips64, .mips64el => return switch (target.abi) { |
| 489 | | .gnuabin32, .muslabin32 => "n32", |
| 490 | | else => "n64", |
| 491 | | }, |
| 492 | | else => {}, |
| 493 | | } |
| 494 | | |
| 495 | 485 | // LLD does not support ELFv1. Rather than having LLVM produce ELFv1 code and then linking it |
| 496 | 486 | // into a broken ELFv2 binary, just force LLVM to use ELFv2 as well. This will break when glibc |
| 497 | 487 | // is linked as glibc only supports ELFv2 for little endian, but there's nothing we can do about |
| ... | ... | @@ -501,6 +491,7 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 { |
| 501 | 491 | if (target.cpu.arch == .powerpc64) return "elfv2"; |
| 502 | 492 | |
| 503 | 493 | return switch (target.cpu.arch) { |
| 494 | .arm, .armeb, .thumb, .thumbeb => "aapcs", |
| 504 | 495 | // TODO: `muslsf` and `muslf32` in LLVM 20. |
| 505 | 496 | .loongarch64 => switch (target.abi) { |
| 506 | 497 | .gnusf => "lp64s", |
| ... | ... | @@ -512,6 +503,20 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 { |
| 512 | 503 | .gnuf32 => "ilp32f", |
| 513 | 504 | else => "ilp32d", |
| 514 | 505 | }, |
| 506 | .mips, .mipsel => "o32", |
| 507 | .mips64, .mips64el => switch (target.abi) { |
| 508 | .gnuabin32, .muslabin32 => "n32", |
| 509 | else => "n64", |
| 510 | }, |
| 511 | .powerpc64 => switch (target.os.tag) { |
| 512 | .freebsd => if (target.os.version_range.semver.isAtLeast(.{ .major = 13, .minor = 0, .patch = 0 }) orelse false) |
| 513 | "elfv2" |
| 514 | else |
| 515 | "elfv1", |
| 516 | .openbsd => "elfv2", |
| 517 | else => if (target.abi.isMusl()) "elfv2" else "elfv1", |
| 518 | }, |
| 519 | .powerpc64le => "elfv2", |
| 515 | 520 | .riscv64 => b: { |
| 516 | 521 | const featureSetHas = std.Target.riscv.featureSetHas; |
| 517 | 522 | break :b if (featureSetHas(target.cpu.features, .e)) |