Skip to main content

Module elf

Module elf 

Source
Expand description

Reading the section table of an ELF object, to tell instrumented ones from the rest.

StructsΒ§

SectionTable πŸ”’
Where an ELF64 little-endian object keeps its section headers.

ConstantsΒ§

COVMAP_SECTION πŸ”’
The section every instrumented object carries.
ELF_HEADER_LEN πŸ”’
ELF_IDENT πŸ”’
ELF magic, 64-bit class, little-endian data: the only objects CI builds.
E_SHENTSIZE πŸ”’
E_SHNUM πŸ”’
E_SHOFF πŸ”’
E_SHSTRNDX πŸ”’
MAX_TABLE_LEN πŸ”’
Real section and name tables are kilobytes; anything past this is corrupt.
SHN_XINDEX πŸ”’
The name-table index an object with extended numbering stores in section 0.
SH_LINK πŸ”’
SH_NAME πŸ”’
SH_OFFSET πŸ”’
SH_SIZE πŸ”’

FunctionsΒ§

elf_has_section πŸ”’
Looks the name up in the ELF section table. Matching it anywhere in the file also accepts binaries that merely contain the string β€” xtask itself among them β€” and llvm-cov refuses to export those.
fill πŸ”’
false when the file ends first: a truncated file is not an object.
le_bytes πŸ”’
read_region πŸ”’
Reads len bytes at offset; None when the region is implausibly large or runs past the end of the file.
resolve_extended πŸ”’
With 0xff00 or more sections the header’s count is 0 and its name index is SHN_XINDEX; the real values live in section 0’s sh_size and sh_link.
section_name πŸ”’