tiny.tldr.formats.elf.addressing
Defined in formats.elf.
API (27)
Actions
Public operations.
Cache.deinitCache.initCache.slotCache.syntheticBoundaryAddressboundaryForSymbolboundarySectionNameMatchescontributionloadrelocationAddressrelocationTargetstoresymbolAddresssymbolIsTlssymbolIsUnresolvedWeaksymbolSizetlsOffset
Types and contracts
Public types and contracts.
Namespaces
Public namespaces.
Values and defaults
Public values and defaults.
Source
Source: lib/tldr/src/formats/elf/address/cache.zig:87
zig
pub const Access = enum { serial, concurrent,};Source: lib/tldr/src/formats/elf/address/cache.zig:30
zig
pub const Cache = struct { pub const missing = std.math.maxInt(u64); entries: []u64, object_offsets: []usize, synthetic_boundaries: BoundaryMap, pub fn init( allocator: Allocator, objects: []const ObjectFile, layouts: []const ObjectLayout, output_sections: []const OutputSection, ) model.Error!Cache { const object_offsets = try allocator.alloc(usize, objects.len + 1); errdefer allocator.free(object_offsets); var total_symbol_count: usize = 0; for (objects, 0..) |object, object_index| { object_offsets[object_index] = total_symbol_count; if (object.symbols.len > std.math.maxInt(usize) - total_symbol_count) { return error.InvalidObject; } total_symbol_count += object.symbols.len; } object_offsets[objects.len] = total_symbol_count; const entries = try allocator.alloc(u64, total_symbol_count); errdefer allocator.free(entries); @memset(entries, missing); var synthetic_boundaries: BoundaryMap = .{}; errdefer synthetic_boundaries.deinit(allocator); try collectSyntheticBoundaryAddresses(allocator, objects, layouts, output_sections, &synthetic_boundaries); return .{ .entries = entries, .object_offsets = object_offsets, .synthetic_boundaries = synthetic_boundaries, }; } pub fn deinit(self: *Cache, allocator: Allocator) void { allocator.free(self.entries); allocator.free(self.object_offsets); self.synthetic_boundaries.deinit(allocator); self.* = undefined; } pub fn slot(self: *Cache, object_index: usize, symbol_index: usize) *u64 { return &self.entries[self.object_offsets[object_index] + symbol_index]; } pub fn syntheticBoundaryAddress(self: *const Cache, search_boundary: Boundary) ?u64 { return self.synthetic_boundaries.get(search_boundary); }};Source: lib/tldr/src/formats/elf/address/cache.zig:92
zig
pub fn load(access: Access, slot: *const u64) u64 { return switch (access) { .serial => slot.*, .concurrent => @atomicLoad(u64, slot, .monotonic), };}Source: lib/tldr/src/formats/elf/address/cache.zig:99
zig
pub fn store(access: Access, slot: *u64, address: u64) model.Error!u64 { if (address == Cache.missing) return error.InvalidRange; switch (access) { .serial => slot.* = address, .concurrent => @atomicStore(u64, slot, address, .monotonic), } return address;}Source: lib/tldr/src/formats/elf/address/root.zig
zig
pub const boundary = @import("boundary.zig");pub const contribution_module = @import("contribution.zig");pub const size = @import("size.zig");pub const symbol = @import("symbol.zig");pub const target = @import("target.zig");pub const tls = @import("tls.zig");const cache_module = @import("cache.zig");pub const Access = cache_module.Access;pub const Boundary = boundary.Boundary;pub const Cache = cache_module.Cache;pub const Target = target.Target;pub const boundaryForSymbol = boundary.forSymbol;pub const boundarySectionNameMatches = boundary.sectionNameMatches;pub const contribution = contribution_module.symbol;pub const relocationAddress = symbol.relocation;pub const relocationTarget = target.relocation;pub const symbolAddress = symbol.address;pub const symbolIsTls = tls.isSymbol;pub const symbolIsUnresolvedWeak = symbol.isUnresolvedWeak;pub const symbolSize = size.symbol;pub const tlsOffset = tls.offset;pub const load = cache_module.load;pub const store = cache_module.store;Source: lib/tldr/src/formats/elf/root.zig:4
zig
pub const addressing = @import("address/root.zig");Audit
| Definitions | 10 |
|---|---|
| Public names | 10 |
| Members | 5 |
| Version | 26.7.0 |
| Revision | daab053ee433 |