diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 4d7a79d363..efe8ad4809 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -701,50 +701,111 @@ pub const Abi = enum { pub fn default(arch: Cpu.Arch, os: Os) Abi { return if (arch.isWasm()) .musl else switch (os.tag) { .freestanding, - .dragonfly, - .ps3, - .zos, - .rtems, - .aix, - .cuda, - .nvcl, - .amdhsa, - .ps4, - .ps5, - .elfiamcu, - .mesa3d, - .contiki, - .amdpal, - .hermit, .other, - => .eabi, - .openbsd, - .freebsd, - .fuchsia, - .netbsd, - .hurd, - .haiku, - .windows, - => .gnu, - .uefi => .msvc, + => switch (arch) { + // Soft float is usually a sane default for freestanding. + .arm, + .armeb, + .thumb, + .thumbeb, + .csky, + .mips, + .mipsel, + .powerpc, + .powerpcle, + => .eabi, + else => .none, + }, + .aix, + => if (arch == .powerpc) .eabihf else .none, .linux, .wasi, .emscripten, => .musl, + .rtems, + => switch (arch) { + .arm, + .armeb, + .thumb, + .thumbeb, + .mips, + .mipsel, + => .eabi, + .powerpc, + => .eabihf, + else => .none, + }, + .hurd, + .windows, + => .gnu, + .freebsd, + => switch (arch) { + .arm, + .armeb, + .thumb, + .thumbeb, + .powerpc, + => .eabihf, + .mips, + .mipsel, + => .eabi, + else => .none, + }, + .netbsd, + => switch (arch) { + .arm, + .armeb, + .thumb, + .thumbeb, + .powerpc, + => .eabihf, + .mips, + .mipsel, + => .eabi, + else => .none, + }, + .openbsd, + => switch (arch) { + .arm, + .thumb, + => .eabi, + .powerpc, + => .eabihf, + else => .none, + }, + .ios, + => if (arch == .x86_64) .macabi else .none, + .tvos, + .visionos, + => if (arch == .x86_64) .simulator else .none, + .uefi, + => .msvc, + .contiki, + .elfiamcu, + .fuchsia, + .hermit, + .haiku, + .plan9, + .serenity, + .zos, + .dragonfly, .bridgeos, + .driverkit, + .macos, + .watchos, + .illumos, + .solaris, + .ps3, + .ps4, + .ps5, + .amdhsa, + .amdpal, + .cuda, + .mesa3d, + .nvcl, .opencl, .opengl, .vulkan, - .plan9, // TODO specify abi - .macos, - .ios, - .tvos, - .watchos, - .visionos, - .driverkit, - .solaris, - .illumos, - .serenity, => .none, }; } diff --git a/test/llvm_targets.zig b/test/llvm_targets.zig index 06aabeaeb8..687903d278 100644 --- a/test/llvm_targets.zig +++ b/test/llvm_targets.zig @@ -185,7 +185,7 @@ const targets = [_]std.Target.Query{ .{ .cpu_arch = .nvptx64, .os_tag = .cuda, .abi = .none }, .{ .cpu_arch = .nvptx64, .os_tag = .nvcl, .abi = .none }, - .{ .cpu_arch = .powerpc, .os_tag = .aix, .abi = .eabi }, + .{ .cpu_arch = .powerpc, .os_tag = .aix, .abi = .eabihf }, .{ .cpu_arch = .powerpc, .os_tag = .freebsd, .abi = .eabi }, .{ .cpu_arch = .powerpc, .os_tag = .freebsd, .abi = .eabihf }, .{ .cpu_arch = .powerpc, .os_tag = .freestanding, .abi = .eabi },