DoxigAlpha

default

Function parameters

Parameters

#
arch:Cpu.Arch
os_tag:Os.Tag

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
requiresLibC
Does this target require linking libc? This may be the case if the target has an unstable
cCharSignedness
Default signedness of `char` for the native C compiler for this target

Source

Implementation

#
pub fn default(arch: Cpu.Arch, os_tag: Os.Tag) Abi {
    return switch (os_tag) {
        .freestanding, .other => 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,
        .haiku => switch (arch) {
            .arm,
            .powerpc,
            => .eabihf,
            else => .none,
        },
        .hurd => .gnu,
        .linux => switch (arch) {
            .arm,
            .armeb,
            .thumb,
            .thumbeb,
            .powerpc,
            .powerpcle,
            => .musleabihf,
            // Soft float tends to be more common for CSKY and MIPS.
            .csky,
            => .gnueabi, // No musl support.
            .mips,
            .mipsel,
            => .musleabi,
            .mips64,
            .mips64el,
            => .muslabi64,
            else => .musl,
        },
        .rtems => switch (arch) {
            .arm,
            .armeb,
            .thumb,
            .thumbeb,
            .mips,
            .mipsel,
            => .eabi,
            .powerpc,
            => .eabihf,
            else => .none,
        },
        .freebsd => switch (arch) {
            .arm,
            .powerpc,
            => .eabihf,
            else => .none,
        },
        .netbsd => switch (arch) {
            .arm,
            .armeb,
            .powerpc,
            => .eabihf,
            // Soft float tends to be more common for MIPS.
            .mips,
            .mipsel,
            => .eabi,
            else => .none,
        },
        .openbsd => switch (arch) {
            .arm,
            => .eabi,
            .powerpc,
            => .eabihf,
            else => .none,
        },
        .ios => if (arch == .x86_64) .macabi else .none,
        .tvos, .visionos, .watchos => if (arch == .x86_64) .simulator else .none,
        .windows => .gnu,
        .uefi => .msvc,
        .wasi, .emscripten => .musl,

        .contiki,
        .fuchsia,
        .hermit,
        .plan9,
        .serenity,
        .zos,
        .dragonfly,
        .driverkit,
        .macos,
        .illumos,
        .solaris,
        .ps3,
        .ps4,
        .ps5,
        .amdhsa,
        .amdpal,
        .cuda,
        .mesa3d,
        .nvcl,
        .opencl,
        .opengl,
        .vulkan,
        => .none,
    };
}