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