enumstd.Target.ObjectFormat[src]

Fields

c

C source code.

coff

The Common Object File Format used by Windows and UEFI.

elf

The Executable and Linkable Format used by many Unixes.

goff

The Generalized Object File Format used by z/OS.

hex

The Intel HEX format for storing binary code in ASCII text.

macho

The Mach object format used by macOS and other Apple platforms.

nvptx

Nvidia's PTX (Parallel Thread Execution) assembly language.

plan9

The a.out format used by Plan 9 from Bell Labs.

raw

Machine code with no metadata.

spirv

The Khronos Group's Standard Portable Intermediate Representation V.

wasm

The WebAssembly binary format.

xcoff

The eXtended Common Object File Format used by AIX.

Functions

FunctionfileExt[src]

pub fn fileExt(of: ObjectFormat, arch: Cpu.Arch) [:0]const u8

Parameters

Source Code

Source code
pub fn fileExt(of: ObjectFormat, arch: Cpu.Arch) [:0]const u8 {
    return switch (of) {
        .c => ".c",
        .coff => ".obj",
        .elf, .goff, .macho, .wasm, .xcoff => ".o",
        .hex => ".ihex",
        .nvptx => ".ptx",
        .plan9 => arch.plan9Ext(),
        .raw => ".bin",
        .spirv => ".spv",
    };
}

Functiondefault[src]

pub fn default(os_tag: Os.Tag, arch: Cpu.Arch) ObjectFormat

Parameters

os_tag: Os.Tag
arch: Cpu.Arch

Source Code

Source code
pub fn default(os_tag: Os.Tag, arch: Cpu.Arch) ObjectFormat {
    return switch (os_tag) {
        .aix => .xcoff,
        .driverkit, .ios, .macos, .tvos, .visionos, .watchos => .macho,
        .plan9 => .plan9,
        .uefi, .windows => .coff,
        .zos => .goff,
        else => switch (arch) {
            .nvptx, .nvptx64 => .nvptx,
            .spirv, .spirv32, .spirv64 => .spirv,
            .wasm32, .wasm64 => .wasm,
            else => .elf,
        },
    };
}

Source Code

Source code
pub const ObjectFormat = enum {
    /// C source code.
    c,
    /// The Common Object File Format used by Windows and UEFI.
    coff,
    /// The Executable and Linkable Format used by many Unixes.
    elf,
    /// The Generalized Object File Format used by z/OS.
    goff,
    /// The Intel HEX format for storing binary code in ASCII text.
    hex,
    /// The Mach object format used by macOS and other Apple platforms.
    macho,
    /// Nvidia's PTX (Parallel Thread Execution) assembly language.
    nvptx,
    /// The a.out format used by Plan 9 from Bell Labs.
    plan9,
    /// Machine code with no metadata.
    raw,
    /// The Khronos Group's Standard Portable Intermediate Representation V.
    spirv,
    /// The WebAssembly binary format.
    wasm,
    /// The eXtended Common Object File Format used by AIX.
    xcoff,

    // LLVM tags deliberately omitted:
    // - dxcontainer

    pub fn fileExt(of: ObjectFormat, arch: Cpu.Arch) [:0]const u8 {
        return switch (of) {
            .c => ".c",
            .coff => ".obj",
            .elf, .goff, .macho, .wasm, .xcoff => ".o",
            .hex => ".ihex",
            .nvptx => ".ptx",
            .plan9 => arch.plan9Ext(),
            .raw => ".bin",
            .spirv => ".spv",
        };
    }

    pub fn default(os_tag: Os.Tag, arch: Cpu.Arch) ObjectFormat {
        return switch (os_tag) {
            .aix => .xcoff,
            .driverkit, .ios, .macos, .tvos, .visionos, .watchos => .macho,
            .plan9 => .plan9,
            .uefi, .windows => .coff,
            .zos => .goff,
            else => switch (arch) {
                .nvptx, .nvptx64 => .nvptx,
                .spirv, .spirv32, .spirv64 => .spirv,
                .wasm32, .wasm64 => .wasm,
                else => .elf,
            },
        };
    }
}