DoxigAlpha

requiresLibC

Does this target require linking libc? This may be the case if the target has an unstable syscall interface, for example.

Function parameters

Parameters

#
target:*const Target

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 requiresLibC(target: *const Target) bool {
    return switch (target.os.tag) {
        .aix,
        .driverkit,
        .macos,
        .ios,
        .tvos,
        .watchos,
        .visionos,
        .dragonfly,
        .openbsd,
        .haiku,
        .solaris,
        .illumos,
        .serenity,
        => true,

        // Android API levels prior to 29 did not have native TLS support. For these API levels, TLS
        // is implemented through calls to `__emutls_get_address`. We provide this function in
        // compiler-rt, but it's implemented by way of `pthread_key_create` et al, so linking libc
        // is required.
        .linux => target.abi.isAndroid() and target.os.version_range.linux.android < 29,

        .windows,
        .freebsd,
        .netbsd,
        .freestanding,
        .fuchsia,
        .ps3,
        .zos,
        .rtems,
        .cuda,
        .nvcl,
        .amdhsa,
        .ps4,
        .ps5,
        .mesa3d,
        .contiki,
        .amdpal,
        .hermit,
        .hurd,
        .wasi,
        .emscripten,
        .uefi,
        .opencl,
        .opengl,
        .vulkan,
        .plan9,
        .other,
        => false,
    };
}