Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

Elf32

elf.Elf32
pub const Elf32 = struct

File

lib/std/elf.zig:1045

Code

pub const Elf32 = struct {
    pub const Addr = u32;
    pub const Off = u32;
    pub const Ehdr = extern struct {
        ident: Ident,
        type: ET,
        machine: EM,
        version: Word,
        entry: Elf32.Addr,
        phoff: Elf32.Off,
        shoff: Elf32.Off,
        flags: EhdrFlags,
        ehsize: Half,
        phentsize: Half,
        phnum: Half,
        shentsize: Half,
        shnum: Half,
        shstrndx: Half,
    };
    pub const Phdr = extern struct {
        type: PT,
        offset: Elf32.Off,
        vaddr: Elf32.Addr,
        paddr: Elf32.Addr,
        filesz: Word,
        memsz: Word,
        flags: PF,
        @"align": Word,
    };
    pub const Shdr = extern struct {
        name: Word,
        type: SHT,
        flags: packed struct(Word) { shf: SHF },
        addr: Elf32.Addr,
        offset: Elf32.Off,
        size: Word,
        link: Word,
        info: Word,
        addralign: Word,
        entsize: Word,
    };
    pub const Chdr = extern struct {
        type: COMPRESS,
        size: Word,
        addralign: Word,
    };
    pub const Sym = extern struct {
        name: Word,
        value: Elf32.Addr,
        size: Word,
        info: Info,
        other: Other,
        shndx: Section,

        pub const Info = packed struct(u8) {
            type: STT,
            bind: STB,
        };

        pub const Other = packed struct(u8) {
            visibility: STV,
            unused: u5 = 0,
        };
    };
    pub const Rel = extern struct {
        offset: Elf32.Addr,
        info: Info,
        addend: u0 = 0,

        pub const Info = packed struct(u32) {
            type: u8,
            sym: u24,
        };
    };
    pub const Rela = extern struct {
        offset: Elf32.Addr,
        info: Info,
        addend: i32,

        pub const Info = Elf32.Rel.Info;
    };
    comptime {
        assert(@sizeOf(Elf32.Ehdr) == 52);
        assert(@sizeOf(Elf32.Phdr) == 32);
        assert(@sizeOf(Elf32.Shdr) == 40);
        assert(@sizeOf(Elf32.Sym) == 16);
        assert(@sizeOf(Elf32.Rel) == 8);
        assert(@sizeOf(Elf32.Rela) == 12);
    }
}