Skip to documentation
SLOP

tiny.tldr.formats.elf.group

Reference tiny.tldr formats elf group

Defined in formats.elf.

API (9)

Actions

Public operations.

Types and contracts

Public types and contracts.

Namespaces

Public namespaces.

No direct callersNo direct callsformats.elfgroup
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/tldr/src/formats/elf/group/membership.zig:78

zig
pub const Index = struct {    objects: []Memberships = &.{},    pub fn init(allocator: Allocator, objects: []const ObjectFile) model.Error!Index {        const object_memberships = try allocator.alloc(Memberships, objects.len);        var initialized_count: usize = 0;        errdefer {            for (object_memberships[0..initialized_count]) |*memberships| memberships.deinit(allocator);            allocator.free(object_memberships);        }        for (objects, 0..) |object, object_index| {            object_memberships[object_index] = try Memberships.init(allocator, object);            initialized_count += 1;        }        return .{ .objects = object_memberships };    }    pub fn deinit(self: *Index, allocator: Allocator) void {        for (self.objects) |*memberships| memberships.deinit(allocator);        if (self.objects.len != 0) allocator.free(self.objects);    }    pub fn groupsForSection(self: Index, section_ref: SectionRef) []const usize {        if (section_ref.object_index >= self.objects.len) return &.{};        return self.objects[section_ref.object_index].groupsForSection(section_ref.section_index);    }};

Source: lib/tldr/src/formats/elf/group/discard.zig:14

zig
pub fn duplicates(    allocator: Allocator,    objects: []ObjectFile,) model.Error!void {    var retained: std.StringHashMapUnmanaged(SymbolRef) = .{};    defer retained.deinit(allocator);    for (objects, 0..) |*object, object_index| {        if (!object.has_group_sections) continue;        for (object.sections) |section| {            if (section.section_type != std.elf.SHT_GROUP) continue;            if (section.info >= object.symbols.len) return error.InvalidObject;            const group_bytes = try record.bytes(object.*, section);            if (group_bytes.len == 0) return error.InvalidObject;            if ((record.word(group_bytes, 0) & std.elf.GRP_COMDAT) == 0) continue;            const signature = object.symbols[section.info];            const name = try signatureName(object.*, signature);            const gop = try retained.getOrPut(allocator, name);            if (gop.found_existing) {                try discardMembers(allocator, object, group_bytes);            } else {                gop.value_ptr.* = .{                    .object_index = object_index,                    .symbol_index = section.info,                };            }        }    }}
Called byCallsNo direct callersprivate sourcelib.tldr.src.formats.elf.group.discarddiscardMembersprivate sourcelib.tldr.src.formats.elf.group.discardsignatureNameformats.elf.group.recordbytesformats.elf.group.recordwordformats.elf.groupdiscardDuplicates
Static calls · unresolved targets: 2 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.tldr.src.formats.elf.group.membership.Mem...initformats.elf.group.Indexinit
Static calls · unresolved targets: 0 · external targets: 3.

Source: lib/tldr/src/formats/elf/group/root.zig

zig
const discard = @import("discard.zig");const membership = @import("membership.zig");pub const record = @import("record.zig");pub const Index = membership.Index;pub const bytes = record.bytes;pub const discardDuplicates = discard.duplicates;pub const members = record.members;pub const word = record.word;

Source: lib/tldr/src/formats/elf/root.zig:10

zig
pub const group = @import("group/root.zig");

Audit

Definitions6
Public names6
Members1
Version26.7.0
Revisiondaab053ee433