Module: ElfUtils::Types Private

Extended by:
CTypes::Helpers, Types
Included in:
Types
Defined in:
lib/elf_utils/types.rb,
ext/elf_utils/elf_utils.c

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

The various types & structures needed to parse the ELF & DWARF formats.

Defined Under Namespace

Modules: Dwarf, Dwarf32, Dwarf64, SLEB128, ULEB128, UnitLength

Constant Summary collapse

Elf_Ident =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({
  ei_magic: string(4),
  ei_class: uint8,
  ei_data: enum(uint8, {none: 0, lsb: 1, msb: 2}),
  ei_version: uint8,
  ei_osabi: uint8,
  ei_abiversion: uint8,
  ei_pad: array(uint8, 7)
})
ELFMAGIC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"\x7fELF"
ELFCLASS32 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

1
ELFCLASS64 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

2
Elf_Et =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Elf file types

enum(uint16, %(none rel exec dyn core)).permissive
Elf_Pt =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Elf Program Header Types

enum(uint32, {
  null: 0, # program header table entry unused
  load: 1, # loadable program segment
  dynamic: 2, # dynamic linking information
  interp: 3, # program interpreter
  note: 4, # auxiliary information
  shlib: 5, # reserved
  phdr: 6, # entry for header table itself
  tls: 7, # thread-local storage segment
  num: 8, # number of defined types
  loos: 0x60000000, # start of os-specific
  gnu_eh_frame: 0x6474e550, # gcc .eh_frame_hdr segment
  gnu_stack: 0x6474e551, # indicates stack executability
  gnu_relro: 0x6474e552, # read-only after relocation
  gnu_property: 0x6474e553, # gnu property
  sunwbss: 0x6ffffffa, # sun specific segment
  sunwstack: 0x6ffffffb # stack segment
}).permissive
Elf_Pf =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Elf file types

enum(uint32, %i[exec write read]).permissive
SHN_UNDEF =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

special section header numbers

0
SHN_LORESERVE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Undefined section

0xff00
SHN_LOPROC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Start of reserved indices

0xff00
SHN_BEFORE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Start of processor-specific

0xff00
SHN_AFTER =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Order section before all others (Solaris).

0xff01
SHN_HIPROC =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Order section after all others (Solaris).

0xff1f
SHN_LOOS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

End of processor-specific

0xff20
SHN_HIOS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Start of OS-specific

0xff3f
SHN_ABS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

End of OS-specific

0xfff1
SHN_COMMON =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Associated symbol is absolute

0xfff2
SHN_XINDEX =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Associated symbol is common

0xffff
SHN_HIRESERVE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Index is in extra table.

0xffff
Elf_Sht =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Elf Section Header Types

enum(uint32, {
  null: 0, # section header table entry unused
  progbits: 1, # program data
  symtab: 2, # symbol table
  strtab: 3, # string table
  rela: 4, # relocation entries with addends
  hash: 5, # symbol hash table
  dynamic: 6, # dynamic linking information
  note: 7, # notes
  nobits: 8, # program space with no data (bss)
  rel: 9, # relocation entries, no addends
  shlib: 10, # reserved
  dynsym: 11, # dynamic linker symbol table
  init_array: 14, # array of constructors
  fini_array: 15, # array of destructors
  preinit_array: 16, # array of pre-constructors
  group: 17, # section group
  symtab_shndx: 18, # extended section indices
  num: 19, # number of defined types.
  gnu_attributes: 0x6ffffff5, # object attributes.
  gnu_hash: 0x6ffffff6, # gnu-style hash table.
  gnu_liblist: 0x6ffffff7, # prelink library list
  checksum: 0x6ffffff8, # checksum for dso content.
  sunw_move: 0x6ffffffa,
  sunw_comdat: 0x6ffffffb,
  sunw_syminfo: 0x6ffffffc,
  gnu_verdef: 0x6ffffffd, # version definition section.
  gnu_verneed: 0x6ffffffe, # version needs section.
  gnu_versym: 0x6fffffff # version symbol table.
}).permissive
Elf_Shf =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

ELF section header flag bits

enum(uint8, {
  write: 0, # writable
  alloc: 1, # occupies memory during execution
  execinstr: 2, # executable
  merge: 4, # might be merged
  strings: 5, # contains nul-terminated strings
  info_link: 6, # `sh_info' contains sht index
  link_order: 7, # preserve order after combining
  os_nonconforming: 8, # non-standard os specific handling required
  group: 9, # section is member of a group.
  tls: 10, # section hold thread-local data.
  compressed: 11, # section with compressed data.
  gnu_retain: 21,  # not to be gced by linker.
  ordered: 30, # special ordering requirement (solaris).
  exclude: 31 # section is excluded unless referenced or allocated (solaris).
}).permissive
Elf_Stt =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Elf Symbol Types

[ # standard:disable Naming/ConstantName
  :notype,
  :object,
  :func,
  :section,
  :file,
  :common,
  :tls,
  :unused_7,
  :unused_8,
  :unused_9,
  :os_10,
  :os_11,
  :os_12,
  :proc_13,
  :proc_14,
  :proc_15
]
Elf32_Addr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint32
Elf32_Chdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({ch_type: uint32, ch_size: uint32, ch_addralign: uint32})
Elf32_Conflict =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint32
Elf32_Dyn =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({d_tag: int32, d_un: union({d_val: uint32, d_ptr: uint32})})
Elf32_Ehdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({e_ident: Elf_Ident,
e_type: Elf_Et,
e_machine: uint16,
e_version: uint32,
e_entry: uint32,
e_phoff: uint32,
e_shoff: uint32,
e_flags: uint32,
e_ehsize: uint16,
e_phentsize: uint16,
e_phnum: uint16,
e_shentsize: uint16,
e_shnum: uint16,
e_shstrndx: uint16})
Elf32_Half =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint16
Elf32_Lib =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({l_name: uint32,
l_time_stamp: uint32,
l_checksum: uint32,
l_version: uint32,
l_flags: uint32})
Elf32_Move =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({m_value: uint64,
m_info: uint32,
m_poffset: uint32,
m_repeat: uint16,
m_stride: uint16})
Elf32_Nhdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({n_namesz: uint32, n_descsz: uint32, n_type: uint32})
Elf32_Off =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint32
Elf32_Phdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({p_type: Elf_Pt,
p_offset: uint32,
p_vaddr: uint32,
p_paddr: uint32,
p_filesz: uint32,
p_memsz: uint32,
p_flags: bitmap(uint32, Elf_Pf),
p_align: uint32})
Elf32_RegInfo =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({ri_gprmask: uint32,
ri_cprmask: array(uint32, 4),
ri_gp_value: int32})
Elf32_Rel =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({r_offset: uint32, r_info: uint32})
Elf32_Rela =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({r_offset: uint32, r_info: uint32, r_addend: int32})
Elf32_Section =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint16
Elf32_Shdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({sh_name: uint32,
sh_type: Elf_Sht,
sh_flags: bitmap(uint32, Elf_Shf),
sh_addr: uint32,
sh_offset: uint32,
sh_size: uint32,
sh_link: uint32,
sh_info: uint32,
sh_addralign: uint32,
sh_entsize: uint32})
Elf32_Sword =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

int32
Elf32_Sxword =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

int64
Elf32_Sym =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({st_name: uint32,
st_value: uint32,
st_size: uint32,
st_info: uint8,
st_other: uint8,
st_shndx: uint16})
Elf32_Syminfo =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({si_boundto: uint16, si_flags: uint16})
Elf32_Verdaux =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({vda_name: uint32, vda_next: uint32})
Elf32_Verdef =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({vd_version: uint16,
vd_flags: uint16,
vd_ndx: uint16,
vd_cnt: uint16,
vd_hash: uint32,
vd_aux: uint32,
vd_next: uint32})
Elf32_Vernaux =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({vna_hash: uint32,
vna_flags: uint16,
vna_other: uint16,
vna_name: uint32,
vna_next: uint32})
Elf32_Verneed =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({vn_version: uint16,
vn_cnt: uint16,
vn_file: uint32,
vn_aux: uint32,
vn_next: uint32})
Elf32_Versym =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint16
Elf32_Word =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint32
Elf32_Xword =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint64
Elf32_auxv_t =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({a_type: uint32, a_un: union({a_val: uint32})})
Elf32_gptab =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

union({gt_thing: struct({gt_g_value: uint32, gt_bytes: uint32}),
gt_header: struct({gt_current_g_value: uint32, gt_unused: uint32}),
gt_entry: struct({gt_g_value: uint32, gt_bytes: uint32})})
Elf64_Addr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint64
Elf64_Chdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({ch_type: uint32,
ch_reserved: uint32,
ch_size: uint64,
ch_addralign: uint64})
Elf64_Dyn =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({d_tag: int64, d_un: union({d_val: uint64, d_ptr: uint64})})
Elf64_Ehdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({e_ident: Elf_Ident,
e_type: Elf_Et,
e_machine: uint16,
e_version: uint32,
e_entry: uint64,
e_phoff: uint64,
e_shoff: uint64,
e_flags: uint32,
e_ehsize: uint16,
e_phentsize: uint16,
e_phnum: uint16,
e_shentsize: uint16,
e_shnum: uint16,
e_shstrndx: uint16})
Elf64_Half =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint16
Elf64_Lib =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({l_name: uint32,
l_time_stamp: uint32,
l_checksum: uint32,
l_version: uint32,
l_flags: uint32})
Elf64_Move =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({m_value: uint64,
m_info: uint64,
m_poffset: uint64,
m_repeat: uint16,
m_stride: uint16})
Elf64_Nhdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({n_namesz: uint32, n_descsz: uint32, n_type: uint32})
Elf64_Off =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint64
Elf64_Phdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({p_type: Elf_Pt,
p_flags: bitmap(uint32, Elf_Pf),
p_offset: uint64,
p_vaddr: uint64,
p_paddr: uint64,
p_filesz: uint64,
p_memsz: uint64,
p_align: uint64})
Elf64_Rel =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({r_offset: uint64, r_info: uint64})
Elf64_Rela =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({r_offset: uint64, r_info: uint64, r_addend: int64})
Elf64_Section =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint16
Elf64_Shdr =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({sh_name: uint32,
sh_type: Elf_Sht,
sh_flags: bitmap(uint64, Elf_Shf),
sh_addr: uint64,
sh_offset: uint64,
sh_size: uint64,
sh_link: uint32,
sh_info: uint32,
sh_addralign: uint64,
sh_entsize: uint64})
Elf64_Sword =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

int32
Elf64_Sxword =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

int64
Elf64_Sym =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({st_name: uint32,
st_info: uint8,
st_other: uint8,
st_shndx: uint16,
st_value: uint64,
st_size: uint64})
Elf64_Syminfo =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({si_boundto: uint16, si_flags: uint16})
Elf64_Verdaux =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({vda_name: uint32, vda_next: uint32})
Elf64_Verdef =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({vd_version: uint16,
vd_flags: uint16,
vd_ndx: uint16,
vd_cnt: uint16,
vd_hash: uint32,
vd_aux: uint32,
vd_next: uint32})
Elf64_Vernaux =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({vna_hash: uint32,
vna_flags: uint16,
vna_other: uint16,
vna_name: uint32,
vna_next: uint32})
Elf64_Verneed =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({vn_version: uint16,
vn_cnt: uint16,
vn_file: uint32,
vn_aux: uint32,
vn_next: uint32})
Elf64_Versym =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint16
Elf64_Word =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint32
Elf64_Xword =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

uint64
Elf64_auxv_t =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({a_type: uint64, a_un: union({a_val: uint64})})
Elf_MIPS_ABIFlags_v0 =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({version: uint16,
isa_level: uint8,
isa_rev: uint8,
gpr_size: uint8,
cpr1_size: uint8,
cpr2_size: uint8,
fp_abi: uint8,
isa_ext: uint32,
ases: uint32,
flags1: uint32,
flags2: uint32})
Elf_Options =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({kind: uint8, size: uint8, section: uint16, info: uint32})
Elf_Options_Hw =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

struct({hwp_flags1: uint32, hwp_flags2: uint32})