authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-06 13:28:30+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-06 23:28:21+02:00
log221bd829bcb4318be941a93029b9c12d8317845d
tree7cbaf14ab13890579293e2dff1e1c18ab0b31155
parentb6b86cb878a4f941ba4229d8f8aad3fb3dfa2a16
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: Rewrite Abi.default() to have better defaults across the board.


1 files changed, 95 insertions(+), 34 deletions(-)

lib/std/Target.zig+95-34
...@@ -701,50 +701,111 @@ pub const Abi = enum {...@@ -701,50 +701,111 @@ pub const Abi = enum {
701 pub fn default(arch: Cpu.Arch, os: Os) Abi {701 pub fn default(arch: Cpu.Arch, os: Os) Abi {
702 return if (arch.isWasm()) .musl else switch (os.tag) {702 return if (arch.isWasm()) .musl else switch (os.tag) {
703 .freestanding,703 .freestanding,
704 .dragonfly,
705 .ps3,
706 .zos,
707 .rtems,
708 .aix,
709 .cuda,
710 .nvcl,
711 .amdhsa,
712 .ps4,
713 .ps5,
714 .elfiamcu,
715 .mesa3d,
716 .contiki,
717 .amdpal,
718 .hermit,
719 .other,704 .other,
720 => .eabi,705 => switch (arch) {
721 .openbsd,706 // Soft float is usually a sane default for freestanding.
722 .freebsd,707 .arm,
723 .fuchsia,708 .armeb,
724 .netbsd,709 .thumb,
725 .hurd,710 .thumbeb,
726 .haiku,711 .csky,
727 .windows,712 .mips,
728 => .gnu,713 .mipsel,
729 .uefi => .msvc,714 .powerpc,
715 .powerpcle,
716 => .eabi,
717 else => .none,
718 },
719 .aix,
720 => if (arch == .powerpc) .eabihf else .none,
730 .linux,721 .linux,
731 .wasi,722 .wasi,
732 .emscripten,723 .emscripten,
733 => .musl,724 => .musl,
734 .bridgeos,725 .rtems,
735 .opencl,726 => switch (arch) {
736 .opengl,727 .arm,
737 .vulkan,728 .armeb,
738 .plan9, // TODO specify abi729 .thumb,
739 .macos,730 .thumbeb,
731 .mips,
732 .mipsel,
733 => .eabi,
734 .powerpc,
735 => .eabihf,
736 else => .none,
737 },
738 .hurd,
739 .windows,
740 => .gnu,
741 .freebsd,
742 => switch (arch) {
743 .arm,
744 .armeb,
745 .thumb,
746 .thumbeb,
747 .powerpc,
748 => .eabihf,
749 .mips,
750 .mipsel,
751 => .eabi,
752 else => .none,
753 },
754 .netbsd,
755 => switch (arch) {
756 .arm,
757 .armeb,
758 .thumb,
759 .thumbeb,
760 .powerpc,
761 => .eabihf,
762 .mips,
763 .mipsel,
764 => .eabi,
765 else => .none,
766 },
767 .openbsd,
768 => switch (arch) {
769 .arm,
770 .thumb,
771 => .eabi,
772 .powerpc,
773 => .eabihf,
774 else => .none,
775 },
740 .ios,776 .ios,
777 => if (arch == .x86_64) .macabi else .none,
741 .tvos,778 .tvos,
742 .watchos,
743 .visionos,779 .visionos,
780 => if (arch == .x86_64) .simulator else .none,
781 .uefi,
782 => .msvc,
783 .contiki,
784 .elfiamcu,
785 .fuchsia,
786 .hermit,
787 .haiku,
788 .plan9,
789 .serenity,
790 .zos,
791 .dragonfly,
792 .bridgeos,
744 .driverkit,793 .driverkit,
745 .solaris,794 .macos,
795 .watchos,
746 .illumos,796 .illumos,
747 .serenity,797 .solaris,
798 .ps3,
799 .ps4,
800 .ps5,
801 .amdhsa,
802 .amdpal,
803 .cuda,
804 .mesa3d,
805 .nvcl,
806 .opencl,
807 .opengl,
808 .vulkan,
748 => .none,809 => .none,
749 };810 };
750 }811 }