| ... | ... | @@ -500,33 +500,42 @@ pub fn llvmMachineAbi(target: std.Target) ?[:0]const u8 { |
| 500 | 500 | // Once our self-hosted linker can handle both ABIs, this hack should go away. |
| 501 | 501 | if (target.cpu.arch == .powerpc64) return "elfv2"; |
| 502 | 502 | |
| 503 | | switch (target.cpu.arch) { |
| 504 | | .riscv64 => { |
| 503 | return switch (target.cpu.arch) { |
| 504 | // TODO: `muslsf` and `muslf32` in LLVM 20. |
| 505 | .loongarch64 => switch (target.abi) { |
| 506 | .gnusf => "lp64s", |
| 507 | .gnuf32 => "lp64f", |
| 508 | else => "lp64d", |
| 509 | }, |
| 510 | .loongarch32 => switch (target.abi) { |
| 511 | .gnusf => "ilp32s", |
| 512 | .gnuf32 => "ilp32f", |
| 513 | else => "ilp32d", |
| 514 | }, |
| 515 | .riscv64 => b: { |
| 505 | 516 | const featureSetHas = std.Target.riscv.featureSetHas; |
| 506 | | if (featureSetHas(target.cpu.features, .e)) { |
| 507 | | return "lp64e"; |
| 508 | | } else if (featureSetHas(target.cpu.features, .d)) { |
| 509 | | return "lp64d"; |
| 510 | | } else if (featureSetHas(target.cpu.features, .f)) { |
| 511 | | return "lp64f"; |
| 512 | | } else { |
| 513 | | return "lp64"; |
| 514 | | } |
| 517 | break :b if (featureSetHas(target.cpu.features, .e)) |
| 518 | "lp64e" |
| 519 | else if (featureSetHas(target.cpu.features, .d)) |
| 520 | "lp64d" |
| 521 | else if (featureSetHas(target.cpu.features, .f)) |
| 522 | "lp64f" |
| 523 | else |
| 524 | "lp64"; |
| 515 | 525 | }, |
| 516 | | .riscv32 => { |
| 526 | .riscv32 => b: { |
| 517 | 527 | const featureSetHas = std.Target.riscv.featureSetHas; |
| 518 | | if (featureSetHas(target.cpu.features, .e)) { |
| 519 | | return "ilp32e"; |
| 520 | | } else if (featureSetHas(target.cpu.features, .d)) { |
| 521 | | return "ilp32d"; |
| 522 | | } else if (featureSetHas(target.cpu.features, .f)) { |
| 523 | | return "ilp32f"; |
| 524 | | } else { |
| 525 | | return "ilp32"; |
| 526 | | } |
| 528 | break :b if (featureSetHas(target.cpu.features, .e)) |
| 529 | "ilp32e" |
| 530 | else if (featureSetHas(target.cpu.features, .d)) |
| 531 | "ilp32d" |
| 532 | else if (featureSetHas(target.cpu.features, .f)) |
| 533 | "ilp32f" |
| 534 | else |
| 535 | "ilp32"; |
| 527 | 536 | }, |
| 528 | | else => return null, |
| 529 | | } |
| 537 | else => null, |
| 538 | }; |
| 530 | 539 | } |
| 531 | 540 | |
| 532 | 541 | /// This function returns 1 if function alignment is not observable or settable. Note that this |