ElfSegment
Description
Decoded program-header (segment) entry. Needed to convert a runtime address to a file/virtual address: p_vaddr and p_offset differ when the link page size exceeds the file alignment (e.g. AArch64’s 64 KiB max-page-size), so a /proc/self/maps mapping’s file offset is NOT its virtual address.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Elf.h:173:
u64 memsz; // p_memsz: bytes occupied in memory (>= filesz for BSS)
u64 align; // p_align
} ElfSegment;
typedef Vec(ElfSection) ElfSections;- In
Elf.h:177:
typedef Vec(ElfSection) ElfSections;
typedef Vec(ElfSymbol) ElfSymbols;
typedef Vec(ElfSegment) ElfSegments;
///
- In
Elf.c:282:
(void)paddr; // physical address is meaningless for a hosted process
ElfSegment seg;
seg.type = type;
seg.flags = flags;- In
Elf.c:398:
ok = VecLen(&elf.segments) == 2;
if (ok) {
const ElfSegment *s0 = VecPtrAt(&elf.segments, 0);
const ElfSegment *s1 = VecPtrAt(&elf.segments, 1);
ok = s0->type == ELF_PT_LOAD && s0->flags == SEG0_FLAGS && s0->offset == SEG0_OFF &&- In
Elf.c:399:
if (ok) {
const ElfSegment *s0 = VecPtrAt(&elf.segments, 0);
const ElfSegment *s1 = VecPtrAt(&elf.segments, 1);
ok = s0->type == ELF_PT_LOAD && s0->flags == SEG0_FLAGS && s0->offset == SEG0_OFF &&
s0->vaddr == SEG0_VADDR && s0->filesz == SEG0_FILESZ && s0->memsz == SEG0_MEMSZ &&
Last updated on