| author | |
| committer | |
| log | 20e03beaef021b729279edd2063e30f9befb9f38 |
| tree | b18178c581e5f7006c65d5b058db064b14d23cc3 |
| parent | cc79cc9f55acd68d03ff7f7abf39508f3e954f3a |
| parent | 221bd829bcb4318be941a93029b9c12d8317845d |
| signature |
`std.Target`: Rewrite `Abi.default()` to have better defaults across the board.2 files changed, 96 insertions(+), 35 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 abi | 729 | .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 | } |
test/llvm_targets.zig+1-1| ... | @@ -185,7 +185,7 @@ const targets = [_]std.Target.Query{ | ... | @@ -185,7 +185,7 @@ const targets = [_]std.Target.Query{ |
| 185 | .{ .cpu_arch = .nvptx64, .os_tag = .cuda, .abi = .none }, | 185 | .{ .cpu_arch = .nvptx64, .os_tag = .cuda, .abi = .none }, |
| 186 | .{ .cpu_arch = .nvptx64, .os_tag = .nvcl, .abi = .none }, | 186 | .{ .cpu_arch = .nvptx64, .os_tag = .nvcl, .abi = .none }, |
| 187 | 187 | ||
| 188 | .{ .cpu_arch = .powerpc, .os_tag = .aix, .abi = .eabi }, | 188 | .{ .cpu_arch = .powerpc, .os_tag = .aix, .abi = .eabihf }, |
| 189 | .{ .cpu_arch = .powerpc, .os_tag = .freebsd, .abi = .eabi }, | 189 | .{ .cpu_arch = .powerpc, .os_tag = .freebsd, .abi = .eabi }, |
| 190 | .{ .cpu_arch = .powerpc, .os_tag = .freebsd, .abi = .eabihf }, | 190 | .{ .cpu_arch = .powerpc, .os_tag = .freebsd, .abi = .eabihf }, |
| 191 | .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabi }, | 191 | .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabi }, |