//! ELF definitions. //! //! These definitions are independent of read/write support, although we do implement //! some traits useful for those. //! //! This module is the equivalent of /usr/include/elf.h, and is based heavily on it.
/// The header at the start of every 32-bit ELF file. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct FileHeader32<E: Endian> { /// Magic number and other information. pub e_ident: Ident, /// Object file type. One of the `ET_*` constants. pub e_type: U16<E>, /// Architecture. One of the `EM_*` constants. pub e_machine: U16<E>, /// Object file version. Must be `EV_CURRENT`. pub e_version: U32<E>, /// Entry point virtual address. pub e_entry: U32<E>, /// Program header table file offset. pub e_phoff: U32<E>, /// Section header table file offset. pub e_shoff: U32<E>, /// Processor-specific flags. /// /// A combination of the `EF_*` constants. pub e_flags: U32<E>, /// Size in bytes of this header. pub e_ehsize: U16<E>, /// Program header table entry size. pub e_phentsize: U16<E>, /// Program header table entry count. /// /// If the count is greater than or equal to `PN_XNUM` then this field is set to /// `PN_XNUM` and the count is stored in the `sh_info` field of section 0. pub e_phnum: U16<E>, /// Section header table entry size. pub e_shentsize: U16<E>, /// Section header table entry count. /// /// If the count is greater than or equal to `SHN_LORESERVE` then this field is set to /// `0` and the count is stored in the `sh_size` field of section 0. /// first section header. pub e_shnum: U16<E>, /// Section header string table index. /// /// If the index is greater than or equal to `SHN_LORESERVE` then this field is set to /// `SHN_XINDEX` and the index is stored in the `sh_link` field of section 0. pub e_shstrndx: U16<E>,
}
/// The header at the start of every 64-bit ELF file. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct FileHeader64<E: Endian> { /// Magic number and other information. pub e_ident: Ident, /// Object file type. One of the `ET_*` constants. pub e_type: U16<E>, /// Architecture. One of the `EM_*` constants. pub e_machine: U16<E>, /// Object file version. Must be `EV_CURRENT`. pub e_version: U32<E>, /// Entry point virtual address. pub e_entry: U64<E>, /// Program header table file offset. pub e_phoff: U64<E>, /// Section header table file offset. pub e_shoff: U64<E>, /// Processor-specific flags. /// /// A combination of the `EF_*` constants. pub e_flags: U32<E>, /// Size in bytes of this header. pub e_ehsize: U16<E>, /// Program header table entry size. pub e_phentsize: U16<E>, /// Program header table entry count. /// /// If the count is greater than or equal to `PN_XNUM` then this field is set to /// `PN_XNUM` and the count is stored in the `sh_info` field of section 0. pub e_phnum: U16<E>, /// Section header table entry size. pub e_shentsize: U16<E>, /// Section header table entry count. /// /// If the count is greater than or equal to `SHN_LORESERVE` then this field is set to /// `0` and the count is stored in the `sh_size` field of section 0. /// first section header. pub e_shnum: U16<E>, /// Section header string table index. /// /// If the index is greater than or equal to `SHN_LORESERVE` then this field is set to /// `SHN_XINDEX` and the index is stored in the `sh_link` field of section 0. pub e_shstrndx: U16<E>,
}
/// Magic number and other information. /// /// Contained in the file header. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Ident { /// Magic number. Must be `ELFMAG`. pub magic: [u8; 4], /// File class. One of the `ELFCLASS*` constants. pub class: u8, /// Data encoding. One of the `ELFDATA*` constants. pub data: u8, /// ELF version. Must be `EV_CURRENT`. pub version: u8, /// OS ABI identification. One of the `ELFOSABI*` constants. pub os_abi: u8, /// ABI version. /// /// The meaning of this field depends on the `os_abi` value. pub abi_version: u8, /// Padding bytes. pub padding: [u8; 7],
}
// Values for `FileHeader*::e_version` and `Ident::version`. /// Invalid ELF version. pubconst EV_NONE: u8 = 0; /// Current ELF version. pubconst EV_CURRENT: u8 = 1;
/// Section header. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct SectionHeader32<E: Endian> { /// Section name. /// /// This is an offset into the section header string table. pub sh_name: U32<E>, /// Section type. One of the `SHT_*` constants. pub sh_type: U32<E>, /// Section flags. A combination of the `SHF_*` constants. pub sh_flags: U32<E>, /// Section virtual address at execution. pub sh_addr: U32<E>, /// Section file offset. pub sh_offset: U32<E>, /// Section size in bytes. pub sh_size: U32<E>, /// Link to another section. /// /// The section relationship depends on the `sh_type` value. pub sh_link: U32<E>, /// Additional section information. /// /// The meaning of this field depends on the `sh_type` value. pub sh_info: U32<E>, /// Section alignment. pub sh_addralign: U32<E>, /// Entry size if the section holds a table. pub sh_entsize: U32<E>,
}
/// Section header. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct SectionHeader64<E: Endian> { /// Section name. /// /// This is an offset into the section header string table. pub sh_name: U32<E>, /// Section type. One of the `SHT_*` constants. pub sh_type: U32<E>, /// Section flags. A combination of the `SHF_*` constants. pub sh_flags: U64<E>, /// Section virtual address at execution. pub sh_addr: U64<E>, /// Section file offset. pub sh_offset: U64<E>, /// Section size in bytes. pub sh_size: U64<E>, /// Link to another section. /// /// The section relationship depends on the `sh_type` value. pub sh_link: U32<E>, /// Additional section information. /// /// The meaning of this field depends on the `sh_type` value. pub sh_info: U32<E>, /// Section alignment. pub sh_addralign: U64<E>, /// Entry size if the section holds a table. pub sh_entsize: U64<E>,
}
// Special values for section indices. /// Undefined section. pubconst SHN_UNDEF: u16 = 0; /// OS-specific range start. /// Start of reserved section indices. pubconst SHN_LORESERVE: u16 = 0xff00; /// Start of processor-specific section indices. pubconst SHN_LOPROC: u16 = 0xff00; /// End of processor-specific section indices. pubconst SHN_HIPROC: u16 = 0xff1f; /// Start of OS-specific section indices. pubconst SHN_LOOS: u16 = 0xff20; /// End of OS-specific section indices. pubconst SHN_HIOS: u16 = 0xff3f; /// Associated symbol is absolute. pubconst SHN_ABS: u16 = 0xfff1; /// Associated symbol is common. pubconst SHN_COMMON: u16 = 0xfff2; /// Section index is in the `SHT_SYMTAB_SHNDX` section. pubconst SHN_XINDEX: u16 = 0xffff; /// End of reserved section indices. pubconst SHN_HIRESERVE: u16 = 0xffff;
// Values for `SectionHeader*::sh_type`. /// Section header table entry is unused. pubconst SHT_NULL: u32 = 0; /// Program data. pubconst SHT_PROGBITS: u32 = 1; /// Symbol table. pubconst SHT_SYMTAB: u32 = 2; /// String table. pubconst SHT_STRTAB: u32 = 3; /// Relocation entries with explicit addends. pubconst SHT_RELA: u32 = 4; /// Symbol hash table. pubconst SHT_HASH: u32 = 5; /// Dynamic linking information. pubconst SHT_DYNAMIC: u32 = 6; /// Notes. pubconst SHT_NOTE: u32 = 7; /// Program space with no data (bss). pubconst SHT_NOBITS: u32 = 8; /// Relocation entries without explicit addends. pubconst SHT_REL: u32 = 9; /// Reserved section type. pubconst SHT_SHLIB: u32 = 10; /// Dynamic linker symbol table. pubconst SHT_DYNSYM: u32 = 11; /// Array of constructors. pubconst SHT_INIT_ARRAY: u32 = 14; /// Array of destructors. pubconst SHT_FINI_ARRAY: u32 = 15; /// Array of pre-constructors. pubconst SHT_PREINIT_ARRAY: u32 = 16; /// Section group. pubconst SHT_GROUP: u32 = 17; /// Extended section indices for a symbol table. pubconst SHT_SYMTAB_SHNDX: u32 = 18; /// Start of OS-specific section types. pubconst SHT_LOOS: u32 = 0x6000_0000; /// Object attributes. pubconst SHT_GNU_ATTRIBUTES: u32 = 0x6fff_fff5; /// GNU-style hash table. pubconst SHT_GNU_HASH: u32 = 0x6fff_fff6; /// Prelink library list pubconst SHT_GNU_LIBLIST: u32 = 0x6fff_fff7; /// Checksum for DSO content. pubconst SHT_CHECKSUM: u32 = 0x6fff_fff8; /// Sun-specific low bound. pubconst SHT_LOSUNW: u32 = 0x6fff_fffa; #[allow(non_upper_case_globals)] pubconst SHT_SUNW_move: u32 = 0x6fff_fffa; pubconst SHT_SUNW_COMDAT: u32 = 0x6fff_fffb; #[allow(non_upper_case_globals)] pubconst SHT_SUNW_syminfo: u32 = 0x6fff_fffc; /// Version definition section. #[allow(non_upper_case_globals)] pubconst SHT_GNU_VERDEF: u32 = 0x6fff_fffd; /// Version needs section. #[allow(non_upper_case_globals)] pubconst SHT_GNU_VERNEED: u32 = 0x6fff_fffe; /// Version symbol table. #[allow(non_upper_case_globals)] pubconst SHT_GNU_VERSYM: u32 = 0x6fff_ffff; /// Sun-specific high bound. pubconst SHT_HISUNW: u32 = 0x6fff_ffff; /// End of OS-specific section types. pubconst SHT_HIOS: u32 = 0x6fff_ffff; /// Start of processor-specific section types. pubconst SHT_LOPROC: u32 = 0x7000_0000; /// End of processor-specific section types. pubconst SHT_HIPROC: u32 = 0x7fff_ffff; /// Start of application-specific section types. pubconst SHT_LOUSER: u32 = 0x8000_0000; /// End of application-specific section types. pubconst SHT_HIUSER: u32 = 0x8fff_ffff;
// Values for `SectionHeader*::sh_flags`. /// Section is writable. pubconst SHF_WRITE: u32 = 1 << 0; /// Section occupies memory during execution. pubconst SHF_ALLOC: u32 = 1 << 1; /// Section is executable. pubconst SHF_EXECINSTR: u32 = 1 << 2; /// Section may be be merged to eliminate duplication. pubconst SHF_MERGE: u32 = 1 << 4; /// Section contains nul-terminated strings. pubconst SHF_STRINGS: u32 = 1 << 5; /// The `sh_info` field contains a section header table index. pubconst SHF_INFO_LINK: u32 = 1 << 6; /// Section has special ordering requirements when combining sections. pubconst SHF_LINK_ORDER: u32 = 1 << 7; /// Section requires special OS-specific handling. pubconst SHF_OS_NONCONFORMING: u32 = 1 << 8; /// Section is a member of a group. pubconst SHF_GROUP: u32 = 1 << 9; /// Section holds thread-local storage. pubconst SHF_TLS: u32 = 1 << 10; /// Section is compressed. /// /// Compressed sections begin with one of the `CompressionHeader*` headers. pubconst SHF_COMPRESSED: u32 = 1 << 11; /// OS-specific section flags. pubconst SHF_MASKOS: u32 = 0x0ff0_0000; /// Section should not be garbage collected by the linker. pubconst SHF_GNU_RETAIN: u32 = 1 << 21; /// Mbind section. pubconst SHF_GNU_MBIND: u32 = 1 << 24; /// Processor-specific section flags. pubconst SHF_MASKPROC: u32 = 0xf000_0000; /// This section is excluded from the final executable or shared library. pubconst SHF_EXCLUDE: u32 = 0x8000_0000;
/// Section compression header. /// /// Used when `SHF_COMPRESSED` is set. /// /// Note: this type currently allows for misaligned headers, but that may be /// changed in a future version. #[derive(Debug, Default, Clone, Copy)] #[repr(C)] pubstruct CompressionHeader32<E: Endian> { /// Compression format. One of the `ELFCOMPRESS_*` values. pub ch_type: U32Bytes<E>, /// Uncompressed data size. pub ch_size: U32Bytes<E>, /// Uncompressed data alignment. pub ch_addralign: U32Bytes<E>,
}
/// Section compression header. /// /// Used when `SHF_COMPRESSED` is set. /// /// Note: this type currently allows for misaligned headers, but that may be /// changed in a future version. #[derive(Debug, Default, Clone, Copy)] #[repr(C)] pubstruct CompressionHeader64<E: Endian> { /// Compression format. One of the `ELFCOMPRESS_*` values. pub ch_type: U32Bytes<E>, /// Reserved. pub ch_reserved: U32Bytes<E>, /// Uncompressed data size. pub ch_size: U64Bytes<E>, /// Uncompressed data alignment. pub ch_addralign: U64Bytes<E>,
}
/// ZLIB/DEFLATE algorithm. pubconst ELFCOMPRESS_ZLIB: u32 = 1; /// Zstandard algorithm. pubconst ELFCOMPRESS_ZSTD: u32 = 2; /// Start of OS-specific compression types. pubconst ELFCOMPRESS_LOOS: u32 = 0x6000_0000; /// End of OS-specific compression types. pubconst ELFCOMPRESS_HIOS: u32 = 0x6fff_ffff; /// Start of processor-specific compression types. pubconst ELFCOMPRESS_LOPROC: u32 = 0x7000_0000; /// End of processor-specific compression types. pubconst ELFCOMPRESS_HIPROC: u32 = 0x7fff_ffff;
// Values for the flag entry for section groups. /// Mark group as COMDAT. pubconst GRP_COMDAT: u32 = 1;
/// Symbol table entry. #[derive(Debug, Default, Clone, Copy)] #[repr(C)] pubstruct Sym32<E: Endian> { /// Symbol name. /// /// This is an offset into the symbol string table. pub st_name: U32<E>, /// Symbol value. pub st_value: U32<E>, /// Symbol size. pub st_size: U32<E>, /// Symbol type and binding. /// /// Use the `st_type` and `st_bind` methods to access this value. pub st_info: u8, /// Symbol visibility. /// /// Use the `st_visibility` method to access this value. pub st_other: u8, /// Section index or one of the `SHN_*` values. pub st_shndx: U16<E>,
}
impl<E: Endian> Sym32<E> { /// Get the `st_bind` component of the `st_info` field. #[inline] pubfn st_bind(&self) -> u8 { self.st_info >> 4
}
/// Get the `st_type` component of the `st_info` field. #[inline] pubfn st_type(&self) -> u8 { self.st_info & 0xf
}
/// Set the `st_info` field given the `st_bind` and `st_type` components. #[inline] pubfn set_st_info(&mutself, st_bind: u8, st_type: u8) { self.st_info = (st_bind << 4) + (st_type & 0xf);
}
/// Get the `st_visibility` component of the `st_info` field. #[inline] pubfn st_visibility(&self) -> u8 { self.st_other & 0x3
}
}
/// Symbol table entry. #[derive(Debug, Default, Clone, Copy)] #[repr(C)] pubstruct Sym64<E: Endian> { /// Symbol name. /// /// This is an offset into the symbol string table. pub st_name: U32<E>, /// Symbol type and binding. /// /// Use the `st_bind` and `st_type` methods to access this value. pub st_info: u8, /// Symbol visibility. /// /// Use the `st_visibility` method to access this value. pub st_other: u8, /// Section index or one of the `SHN_*` values. pub st_shndx: U16<E>, /// Symbol value. pub st_value: U64<E>, /// Symbol size. pub st_size: U64<E>,
}
impl<E: Endian> Sym64<E> { /// Get the `st_bind` component of the `st_info` field. #[inline] pubfn st_bind(&self) -> u8 { self.st_info >> 4
}
/// Get the `st_type` component of the `st_info` field. #[inline] pubfn st_type(&self) -> u8 { self.st_info & 0xf
}
/// Set the `st_info` field given the `st_bind` and `st_type` components. #[inline] pubfn set_st_info(&mutself, st_bind: u8, st_type: u8) { self.st_info = (st_bind << 4) + (st_type & 0xf);
}
/// Get the `st_visibility` component of the `st_info` field. #[inline] pubfn st_visibility(&self) -> u8 { self.st_other & 0x3
}
}
/// Additional information about a `Sym32`. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Syminfo32<E: Endian> { /// Direct bindings, symbol bound to. pub si_boundto: U16<E>, /// Per symbol flags. pub si_flags: U16<E>,
}
/// Additional information about a `Sym64`. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Syminfo64<E: Endian> { /// Direct bindings, symbol bound to. pub si_boundto: U16<E>, /// Per symbol flags. pub si_flags: U16<E>,
}
// Values for `Syminfo*::si_boundto`. /// Symbol bound to self pubconst SYMINFO_BT_SELF: u16 = 0xffff; /// Symbol bound to parent pubconst SYMINFO_BT_PARENT: u16 = 0xfffe; /// Beginning of reserved entries pubconst SYMINFO_BT_LOWRESERVE: u16 = 0xff00;
// Values for `Syminfo*::si_flags`. /// Direct bound symbol pubconst SYMINFO_FLG_DIRECT: u16 = 0x0001; /// Pass-thru symbol for translator pubconst SYMINFO_FLG_PASSTHRU: u16 = 0x0002; /// Symbol is a copy-reloc pubconst SYMINFO_FLG_COPY: u16 = 0x0004; /// Symbol bound to object to be lazy loaded pubconst SYMINFO_FLG_LAZYLOAD: u16 = 0x0008;
// Values for bind component of `Sym*::st_info`. /// Local symbol. pubconst STB_LOCAL: u8 = 0; /// Global symbol. pubconst STB_GLOBAL: u8 = 1; /// Weak symbol. pubconst STB_WEAK: u8 = 2; /// Start of OS-specific symbol binding. pubconst STB_LOOS: u8 = 10; /// Unique symbol. pubconst STB_GNU_UNIQUE: u8 = 10; /// End of OS-specific symbol binding. pubconst STB_HIOS: u8 = 12; /// Start of processor-specific symbol binding. pubconst STB_LOPROC: u8 = 13; /// End of processor-specific symbol binding. pubconst STB_HIPROC: u8 = 15;
// Values for type component of `Sym*::st_info`. /// Symbol type is unspecified. pubconst STT_NOTYPE: u8 = 0; /// Symbol is a data object. pubconst STT_OBJECT: u8 = 1; /// Symbol is a code object. pubconst STT_FUNC: u8 = 2; /// Symbol is associated with a section. pubconst STT_SECTION: u8 = 3; /// Symbol's name is a file name. pubconst STT_FILE: u8 = 4; /// Symbol is a common data object. pubconst STT_COMMON: u8 = 5; /// Symbol is a thread-local storage object. pubconst STT_TLS: u8 = 6; /// Start of OS-specific symbol types. pubconst STT_LOOS: u8 = 10; /// Symbol is an indirect code object. pubconst STT_GNU_IFUNC: u8 = 10; /// End of OS-specific symbol types. pubconst STT_HIOS: u8 = 12; /// Start of processor-specific symbol types. pubconst STT_LOPROC: u8 = 13; /// End of processor-specific symbol types. pubconst STT_HIPROC: u8 = 15;
// Values for visibility component of `Symbol*::st_other`. /// Default symbol visibility rules. pubconst STV_DEFAULT: u8 = 0; /// Processor specific hidden class. pubconst STV_INTERNAL: u8 = 1; /// Symbol is not visible to other components. pubconst STV_HIDDEN: u8 = 2; /// Symbol is visible to other components, but is not preemptible. pubconst STV_PROTECTED: u8 = 3;
/// Relocation table entry without explicit addend. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Rel32<E: Endian> { /// Relocation address. pub r_offset: U32<E>, /// Relocation type and symbol index. pub r_info: U32<E>,
}
impl<E: Endian> Rel32<E> { /// Get the `r_sym` component of the `r_info` field. #[inline] pubfn r_sym(&self, endian: E) -> u32 { self.r_info.get(endian) >> 8
}
/// Get the `r_type` component of the `r_info` field. #[inline] pubfn r_type(&self, endian: E) -> u32 { self.r_info.get(endian) & 0xff
}
/// Calculate the `r_info` field given the `r_sym` and `r_type` components. pubfn r_info(endian: E, r_sym: u32, r_type: u8) -> U32<E> {
U32::new(endian, (r_sym << 8) | u32::from(r_type))
}
/// Set the `r_info` field given the `r_sym` and `r_type` components. pubfn set_r_info(&mutself, endian: E, r_sym: u32, r_type: u8) { self.r_info = Self::r_info(endian, r_sym, r_type)
}
}
/// Relocation table entry with explicit addend. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Rela32<E: Endian> { /// Relocation address. pub r_offset: U32<E>, /// Relocation type and symbol index. pub r_info: U32<E>, /// Explicit addend. pub r_addend: I32<E>,
}
impl<E: Endian> Rela32<E> { /// Get the `r_sym` component of the `r_info` field. #[inline] pubfn r_sym(&self, endian: E) -> u32 { self.r_info.get(endian) >> 8
}
/// Get the `r_type` component of the `r_info` field. #[inline] pubfn r_type(&self, endian: E) -> u32 { self.r_info.get(endian) & 0xff
}
/// Calculate the `r_info` field given the `r_sym` and `r_type` components. pubfn r_info(endian: E, r_sym: u32, r_type: u8) -> U32<E> {
U32::new(endian, (r_sym << 8) | u32::from(r_type))
}
/// Set the `r_info` field given the `r_sym` and `r_type` components. pubfn set_r_info(&mutself, endian: E, r_sym: u32, r_type: u8) { self.r_info = Self::r_info(endian, r_sym, r_type)
}
}
/// Relocation table entry without explicit addend. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Rel64<E: Endian> { /// Relocation address. pub r_offset: U64<E>, /// Relocation type and symbol index. pub r_info: U64<E>,
}
impl<E: Endian> Rel64<E> { /// Get the `r_sym` component of the `r_info` field. #[inline] pubfn r_sym(&self, endian: E) -> u32 {
(self.r_info.get(endian) >> 32) as u32
}
/// Get the `r_type` component of the `r_info` field. #[inline] pubfn r_type(&self, endian: E) -> u32 {
(self.r_info.get(endian) & 0xffff_ffff) as u32
}
/// Calculate the `r_info` field given the `r_sym` and `r_type` components. pubfn r_info(endian: E, r_sym: u32, r_type: u32) -> U64<E> {
U64::new(endian, (u64::from(r_sym) << 32) | u64::from(r_type))
}
/// Set the `r_info` field given the `r_sym` and `r_type` components. pubfn set_r_info(&mutself, endian: E, r_sym: u32, r_type: u32) { self.r_info = Self::r_info(endian, r_sym, r_type)
}
}
/// Get the `r_sym` component of the `r_info` field. #[inline] pubfn r_sym(&self, endian: E, is_mips64el: bool) -> u32 {
(self.get_r_info(endian, is_mips64el) >> 32) as u32
}
/// Get the `r_type` component of the `r_info` field. #[inline] pubfn r_type(&self, endian: E, is_mips64el: bool) -> u32 {
(self.get_r_info(endian, is_mips64el) & 0xffff_ffff) as u32
}
/// Calculate the `r_info` field given the `r_sym` and `r_type` components. pubfn r_info(endian: E, is_mips64el: bool, r_sym: u32, r_type: u32) -> U64<E> { letmut t = (u64::from(r_sym) << 32) | u64::from(r_type); if is_mips64el {
t = (t >> 32)
| ((t & 0xff000000) << 8)
| ((t & 0x00ff0000) << 24)
| ((t & 0x0000ff00) << 40)
| ((t & 0x000000ff) << 56);
}
U64::new(endian, t)
}
/// Set the `r_info` field given the `r_sym` and `r_type` components. pubfn set_r_info(&mutself, endian: E, is_mips64el: bool, r_sym: u32, r_type: u32) { self.r_info = Self::r_info(endian, is_mips64el, r_sym, r_type);
}
}
/// Program segment header. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct ProgramHeader32<E: Endian> { /// Segment type. One of the `PT_*` constants. pub p_type: U32<E>, /// Segment file offset. pub p_offset: U32<E>, /// Segment virtual address. pub p_vaddr: U32<E>, /// Segment physical address. pub p_paddr: U32<E>, /// Segment size in the file. pub p_filesz: U32<E>, /// Segment size in memory. pub p_memsz: U32<E>, /// Segment flags. A combination of the `PF_*` constants. pub p_flags: U32<E>, /// Segment alignment. pub p_align: U32<E>,
}
/// Program segment header. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct ProgramHeader64<E: Endian> { /// Segment type. One of the `PT_*` constants. pub p_type: U32<E>, /// Segment flags. A combination of the `PF_*` constants. pub p_flags: U32<E>, /// Segment file offset. pub p_offset: U64<E>, /// Segment virtual address. pub p_vaddr: U64<E>, /// Segment physical address. pub p_paddr: U64<E>, /// Segment size in the file. pub p_filesz: U64<E>, /// Segment size in memory. pub p_memsz: U64<E>, /// Segment alignment. pub p_align: U64<E>,
}
/// Special value for `FileHeader*::e_phnum`. /// /// This indicates that the real number of program headers is too large to fit into e_phnum. /// Instead the real value is in the field `sh_info` of section 0. pubconst PN_XNUM: u16 = 0xffff;
/// Note name for core files. pubconst ELF_NOTE_CORE: &[u8] = b"CORE"; /// Note name for linux core files. /// /// Notes in linux core files may also use `ELF_NOTE_CORE`. pubconst ELF_NOTE_LINUX: &[u8] = b"LINUX";
/// Note type for version string. /// /// This note may appear in object files. /// /// It must be handled as a special case because it has no descriptor, and instead /// uses the note name as the version string. pubconst NT_VERSION: u32 = 1;
/// Marks end of dynamic section pubconst DT_NULL: u32 = 0; /// Name of needed library pubconst DT_NEEDED: u32 = 1; /// Size in bytes of PLT relocs pubconst DT_PLTRELSZ: u32 = 2; /// Processor defined value pubconst DT_PLTGOT: u32 = 3; /// Address of symbol hash table pubconst DT_HASH: u32 = 4; /// Address of string table pubconst DT_STRTAB: u32 = 5; /// Address of symbol table pubconst DT_SYMTAB: u32 = 6; /// Address of Rela relocs pubconst DT_RELA: u32 = 7; /// Total size of Rela relocs pubconst DT_RELASZ: u32 = 8; /// Size of one Rela reloc pubconst DT_RELAENT: u32 = 9; /// Size of string table pubconst DT_STRSZ: u32 = 10; /// Size of one symbol table entry pubconst DT_SYMENT: u32 = 11; /// Address of init function pubconst DT_INIT: u32 = 12; /// Address of termination function pubconst DT_FINI: u32 = 13; /// Name of shared object pubconst DT_SONAME: u32 = 14; /// Library search path (deprecated) pubconst DT_RPATH: u32 = 15; /// Start symbol search here pubconst DT_SYMBOLIC: u32 = 16; /// Address of Rel relocs pubconst DT_REL: u32 = 17; /// Total size of Rel relocs pubconst DT_RELSZ: u32 = 18; /// Size of one Rel reloc pubconst DT_RELENT: u32 = 19; /// Type of reloc in PLT pubconst DT_PLTREL: u32 = 20; /// For debugging; unspecified pubconst DT_DEBUG: u32 = 21; /// Reloc might modify .text pubconst DT_TEXTREL: u32 = 22; /// Address of PLT relocs pubconst DT_JMPREL: u32 = 23; /// Process relocations of object pubconst DT_BIND_NOW: u32 = 24; /// Array with addresses of init fct pubconst DT_INIT_ARRAY: u32 = 25; /// Array with addresses of fini fct pubconst DT_FINI_ARRAY: u32 = 26; /// Size in bytes of DT_INIT_ARRAY pubconst DT_INIT_ARRAYSZ: u32 = 27; /// Size in bytes of DT_FINI_ARRAY pubconst DT_FINI_ARRAYSZ: u32 = 28; /// Library search path pubconst DT_RUNPATH: u32 = 29; /// Flags for the object being loaded pubconst DT_FLAGS: u32 = 30; /// Start of encoded range pubconst DT_ENCODING: u32 = 32; /// Array with addresses of preinit fct pubconst DT_PREINIT_ARRAY: u32 = 32; /// size in bytes of DT_PREINIT_ARRAY pubconst DT_PREINIT_ARRAYSZ: u32 = 33; /// Address of SYMTAB_SHNDX section pubconst DT_SYMTAB_SHNDX: u32 = 34; /// Start of OS-specific pubconst DT_LOOS: u32 = 0x6000_000d; /// End of OS-specific pubconst DT_HIOS: u32 = 0x6fff_f000; /// Start of processor-specific pubconst DT_LOPROC: u32 = 0x7000_0000; /// End of processor-specific pubconst DT_HIPROC: u32 = 0x7fff_ffff;
// `DT_*` entries between `DT_VALRNGHI` & `DT_VALRNGLO` use `d_val` as a value. pubconst DT_VALRNGLO: u32 = 0x6fff_fd00; /// Prelinking timestamp pubconst DT_GNU_PRELINKED: u32 = 0x6fff_fdf5; /// Size of conflict section pubconst DT_GNU_CONFLICTSZ: u32 = 0x6fff_fdf6; /// Size of library list pubconst DT_GNU_LIBLISTSZ: u32 = 0x6fff_fdf7; pubconst DT_CHECKSUM: u32 = 0x6fff_fdf8; pubconst DT_PLTPADSZ: u32 = 0x6fff_fdf9; pubconst DT_MOVEENT: u32 = 0x6fff_fdfa; pubconst DT_MOVESZ: u32 = 0x6fff_fdfb; /// Feature selection (DTF_*). pubconst DT_FEATURE_1: u32 = 0x6fff_fdfc; /// Flags for DT_* entries, affecting the following DT_* entry. pubconst DT_POSFLAG_1: u32 = 0x6fff_fdfd; /// Size of syminfo table (in bytes) pubconst DT_SYMINSZ: u32 = 0x6fff_fdfe; /// Entry size of syminfo pubconst DT_SYMINENT: u32 = 0x6fff_fdff; pubconst DT_VALRNGHI: u32 = 0x6fff_fdff;
// `DT_*` entries between `DT_ADDRRNGHI` & `DT_ADDRRNGLO` use `d_val` as an address. // // If any adjustment is made to the ELF object after it has been // built these entries will need to be adjusted. pubconst DT_ADDRRNGLO: u32 = 0x6fff_fe00; /// GNU-style hash table. pubconst DT_GNU_HASH: u32 = 0x6fff_fef5; pubconst DT_TLSDESC_PLT: u32 = 0x6fff_fef6; pubconst DT_TLSDESC_GOT: u32 = 0x6fff_fef7; /// Start of conflict section pubconst DT_GNU_CONFLICT: u32 = 0x6fff_fef8; /// Library list pubconst DT_GNU_LIBLIST: u32 = 0x6fff_fef9; /// Configuration information. pubconst DT_CONFIG: u32 = 0x6fff_fefa; /// Dependency auditing. pubconst DT_DEPAUDIT: u32 = 0x6fff_fefb; /// Object auditing. pubconst DT_AUDIT: u32 = 0x6fff_fefc; /// PLT padding. pubconst DT_PLTPAD: u32 = 0x6fff_fefd; /// Move table. pubconst DT_MOVETAB: u32 = 0x6fff_fefe; /// Syminfo table. pubconst DT_SYMINFO: u32 = 0x6fff_feff; pubconst DT_ADDRRNGHI: u32 = 0x6fff_feff;
// The versioning entry types. The next are defined as part of the // GNU extension. pubconst DT_VERSYM: u32 = 0x6fff_fff0; pubconst DT_RELACOUNT: u32 = 0x6fff_fff9; pubconst DT_RELCOUNT: u32 = 0x6fff_fffa; /// State flags, see DF_1_* below. pubconst DT_FLAGS_1: u32 = 0x6fff_fffb; /// Address of version definition table pubconst DT_VERDEF: u32 = 0x6fff_fffc; /// Number of version definitions pubconst DT_VERDEFNUM: u32 = 0x6fff_fffd; /// Address of table with needed versions pubconst DT_VERNEED: u32 = 0x6fff_fffe; /// Number of needed versions pubconst DT_VERNEEDNUM: u32 = 0x6fff_ffff;
// Machine-independent extensions in the "processor-specific" range. /// Shared object to load before self pubconst DT_AUXILIARY: u32 = 0x7fff_fffd; /// Shared object to get values from pubconst DT_FILTER: u32 = 0x7fff_ffff;
// Values of `Dyn*::d_val` in the `DT_FLAGS` entry. /// Object may use DF_ORIGIN pubconst DF_ORIGIN: u32 = 0x0000_0001; /// Symbol resolutions starts here pubconst DF_SYMBOLIC: u32 = 0x0000_0002; /// Object contains text relocations pubconst DF_TEXTREL: u32 = 0x0000_0004; /// No lazy binding for this object pubconst DF_BIND_NOW: u32 = 0x0000_0008; /// Module uses the static TLS model pubconst DF_STATIC_TLS: u32 = 0x0000_0010;
// Values of `Dyn*::d_val` in the `DT_FLAGS_1` entry. /// Set RTLD_NOW for this object. pubconst DF_1_NOW: u32 = 0x0000_0001; /// Set RTLD_GLOBAL for this object. pubconst DF_1_GLOBAL: u32 = 0x0000_0002; /// Set RTLD_GROUP for this object. pubconst DF_1_GROUP: u32 = 0x0000_0004; /// Set RTLD_NODELETE for this object. pubconst DF_1_NODELETE: u32 = 0x0000_0008; /// Trigger filtee loading at runtime. pubconst DF_1_LOADFLTR: u32 = 0x0000_0010; /// Set RTLD_INITFIRST for this object. pubconst DF_1_INITFIRST: u32 = 0x0000_0020; /// Set RTLD_NOOPEN for this object. pubconst DF_1_NOOPEN: u32 = 0x0000_0040; /// $ORIGIN must be handled. pubconst DF_1_ORIGIN: u32 = 0x0000_0080; /// Direct binding enabled. pubconst DF_1_DIRECT: u32 = 0x0000_0100; pubconst DF_1_TRANS: u32 = 0x0000_0200; /// Object is used to interpose. pubconst DF_1_INTERPOSE: u32 = 0x0000_0400; /// Ignore default lib search path. pubconst DF_1_NODEFLIB: u32 = 0x0000_0800; /// Object can't be dldump'ed. pubconst DF_1_NODUMP: u32 = 0x0000_1000; /// Configuration alternative created. pubconst DF_1_CONFALT: u32 = 0x0000_2000; /// Filtee terminates filters search. pubconst DF_1_ENDFILTEE: u32 = 0x0000_4000; /// Disp reloc applied at build time. pubconst DF_1_DISPRELDNE: u32 = 0x0000_8000; /// Disp reloc applied at run-time. pubconst DF_1_DISPRELPND: u32 = 0x0001_0000; /// Object has no-direct binding. pubconst DF_1_NODIRECT: u32 = 0x0002_0000; pubconst DF_1_IGNMULDEF: u32 = 0x0004_0000; pubconst DF_1_NOKSYMS: u32 = 0x0008_0000; pubconst DF_1_NOHDR: u32 = 0x0010_0000; /// Object is modified after built. pubconst DF_1_EDITED: u32 = 0x0020_0000; pubconst DF_1_NORELOC: u32 = 0x0040_0000; /// Object has individual interposers. pubconst DF_1_SYMINTPOSE: u32 = 0x0080_0000; /// Global auditing required. pubconst DF_1_GLOBAUDIT: u32 = 0x0100_0000; /// Singleton symbols are used. pubconst DF_1_SINGLETON: u32 = 0x0200_0000; pubconst DF_1_STUB: u32 = 0x0400_0000; pubconst DF_1_PIE: u32 = 0x0800_0000;
/// Version symbol information #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Versym<E: Endian>(pub U16<E>);
/// Symbol is hidden. pubconst VERSYM_HIDDEN: u16 = 0x8000; /// Symbol version index. pubconst VERSYM_VERSION: u16 = 0x7fff;
/// Version definition sections #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Verdef<E: Endian> { /// Version revision pub vd_version: U16<E>, /// Version information pub vd_flags: U16<E>, /// Version Index pub vd_ndx: U16<E>, /// Number of associated aux entries pub vd_cnt: U16<E>, /// Version name hash value pub vd_hash: U32<E>, /// Offset in bytes to verdaux array pub vd_aux: U32<E>, /// Offset in bytes to next verdef entry pub vd_next: U32<E>,
}
// Legal values for vd_version (version revision). /// No version pubconst VER_DEF_NONE: u16 = 0; /// Current version pubconst VER_DEF_CURRENT: u16 = 1;
// Legal values for vd_flags (version information flags). /// Version definition of file itself pubconst VER_FLG_BASE: u16 = 0x1; // Legal values for vd_flags and vna_flags (version information flags). /// Weak version identifier pubconst VER_FLG_WEAK: u16 = 0x2;
// Versym symbol index values. /// Symbol is local. pubconst VER_NDX_LOCAL: u16 = 0; /// Symbol is global. pubconst VER_NDX_GLOBAL: u16 = 1;
/// Auxiliary version information. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Verdaux<E: Endian> { /// Version or dependency names pub vda_name: U32<E>, /// Offset in bytes to next verdaux pub vda_next: U32<E>,
}
/// Version dependency. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Verneed<E: Endian> { /// Version of structure pub vn_version: U16<E>, /// Number of associated aux entries pub vn_cnt: U16<E>, /// Offset of filename for this dependency pub vn_file: U32<E>, /// Offset in bytes to vernaux array pub vn_aux: U32<E>, /// Offset in bytes to next verneed entry pub vn_next: U32<E>,
}
// Legal values for vn_version (version revision). /// No version pubconst VER_NEED_NONE: u16 = 0; /// Current version pubconst VER_NEED_CURRENT: u16 = 1;
/// Auxiliary needed version information. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct Vernaux<E: Endian> { /// Hash value of dependency name pub vna_hash: U32<E>, /// Dependency specific information pub vna_flags: U16<E>, /// Version Index pub vna_other: U16<E>, /// Dependency name string offset pub vna_name: U32<E>, /// Offset in bytes to next vernaux entry pub vna_next: U32<E>,
}
// TODO: Elf*_auxv_t, AT_*
/// Note section entry header. /// /// A note consists of a header followed by a variable length name and descriptor. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct NoteHeader32<E: Endian> { /// Length of the note's name. /// /// Some known names are defined by the `ELF_NOTE_*` constants. pub n_namesz: U32<E>, /// Length of the note's descriptor. /// /// The content of the descriptor depends on the note name and type. pub n_descsz: U32<E>, /// Type of the note. /// /// One of the `NT_*` constants. The note name determines which /// `NT_*` constants are valid. pub n_type: U32<E>,
}
/// Note section entry header. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct NoteHeader64<E: Endian> { /// Length of the note's name. /// /// Some known names are defined by the `ELF_NOTE_*` constants. pub n_namesz: U32<E>, /// Length of the note's descriptor. /// /// The content of the descriptor depends on the note name and type. pub n_descsz: U32<E>, /// Type of the note. /// /// One of the `NT_*` constants. The note name determines which /// `NT_*` constants are valid. pub n_type: U32<E>,
}
/// Solaris entries in the note section have this name. pubconst ELF_NOTE_SOLARIS: &[u8] = b"SUNW Solaris";
// Values for `n_type` when the name is `ELF_NOTE_SOLARIS`. /// Desired pagesize for the binary. pubconst NT_SOLARIS_PAGESIZE_HINT: u32 = 1;
/// GNU entries in the note section have this name. pubconst ELF_NOTE_GNU: &[u8] = b"GNU";
/// Go entries in the note section have this name. // See https://go-review.googlesource.com/9520 and https://go-review.googlesource.com/10704. pubconst ELF_NOTE_GO: &[u8] = b"Go";
// Note types for `ELF_NOTE_GNU`.
/// ABI information. /// /// The descriptor consists of words: /// - word 0: OS descriptor /// - word 1: major version of the ABI /// - word 2: minor version of the ABI /// - word 3: subminor version of the ABI pubconst NT_GNU_ABI_TAG: u32 = 1;
/// OS descriptor for `NT_GNU_ABI_TAG`. pubconst ELF_NOTE_OS_LINUX: u32 = 0; /// OS descriptor for `NT_GNU_ABI_TAG`. pubconst ELF_NOTE_OS_GNU: u32 = 1; /// OS descriptor for `NT_GNU_ABI_TAG`. pubconst ELF_NOTE_OS_SOLARIS2: u32 = 2; /// OS descriptor for `NT_GNU_ABI_TAG`. pubconst ELF_NOTE_OS_FREEBSD: u32 = 3;
/// Synthetic hwcap information. /// /// The descriptor begins with two words: /// - word 0: number of entries /// - word 1: bitmask of enabled entries /// /// Then follow variable-length entries, one byte followed by a /// '\0'-terminated hwcap name string. The byte gives the bit /// number to test if enabled, (1U << bit) & bitmask. */ pubconst NT_GNU_HWCAP: u32 = 2;
/// Build ID bits as generated by `ld --build-id`. /// /// The descriptor consists of any nonzero number of bytes. pubconst NT_GNU_BUILD_ID: u32 = 3;
/// Build ID bits as generated by Go's gc compiler. /// /// The descriptor consists of any nonzero number of bytes. // See https://go-review.googlesource.com/10707. pubconst NT_GO_BUILD_ID: u32 = 4;
/// Version note generated by GNU gold containing a version string. pubconst NT_GNU_GOLD_VERSION: u32 = 4;
/// Program property. pubconst NT_GNU_PROPERTY_TYPE_0: u32 = 5;
// Values used in GNU .note.gnu.property notes (NT_GNU_PROPERTY_TYPE_0).
/// Stack size. pubconst GNU_PROPERTY_STACK_SIZE: u32 = 1; /// No copy relocation on protected data symbol. pubconst GNU_PROPERTY_NO_COPY_ON_PROTECTED: u32 = 2;
// A 4-byte unsigned integer property: A bit is set if it is set in all // relocatable inputs. pubconst GNU_PROPERTY_UINT32_AND_LO: u32 = 0xb0000000; pubconst GNU_PROPERTY_UINT32_AND_HI: u32 = 0xb0007fff;
// A 4-byte unsigned integer property: A bit is set if it is set in any // relocatable inputs. pubconst GNU_PROPERTY_UINT32_OR_LO: u32 = 0xb0008000; pubconst GNU_PROPERTY_UINT32_OR_HI: u32 = 0xb000ffff;
/// The needed properties by the object file. */ pubconst GNU_PROPERTY_1_NEEDED: u32 = GNU_PROPERTY_UINT32_OR_LO;
/// Set if the object file requires canonical function pointers and /// cannot be used with copy relocation. pubconst GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS: u32 = 1 << 0;
/// Processor-specific semantics, lo pubconst GNU_PROPERTY_LOPROC: u32 = 0xc0000000; /// Processor-specific semantics, hi pubconst GNU_PROPERTY_HIPROC: u32 = 0xdfffffff; /// Application-specific semantics, lo pubconst GNU_PROPERTY_LOUSER: u32 = 0xe0000000; /// Application-specific semantics, hi pubconst GNU_PROPERTY_HIUSER: u32 = 0xffffffff;
/// AArch64 specific GNU properties. pubconst GNU_PROPERTY_AARCH64_FEATURE_1_AND: u32 = 0xc0000000; pubconst GNU_PROPERTY_AARCH64_FEATURE_PAUTH: u32 = 0xc0000001;
// A 4-byte unsigned integer property: A bit is set if it is set in all // relocatable inputs. pubconst GNU_PROPERTY_X86_UINT32_AND_LO: u32 = 0xc0000002; pubconst GNU_PROPERTY_X86_UINT32_AND_HI: u32 = 0xc0007fff;
// A 4-byte unsigned integer property: A bit is set if it is set in any // relocatable inputs. pubconst GNU_PROPERTY_X86_UINT32_OR_LO: u32 = 0xc0008000; pubconst GNU_PROPERTY_X86_UINT32_OR_HI: u32 = 0xc000ffff;
// A 4-byte unsigned integer property: A bit is set if it is set in any // relocatable inputs and the property is present in all relocatable // inputs. pubconst GNU_PROPERTY_X86_UINT32_OR_AND_LO: u32 = 0xc0010000; pubconst GNU_PROPERTY_X86_UINT32_OR_AND_HI: u32 = 0xc0017fff;
/// The x86 instruction sets indicated by the corresponding bits are /// used in program. Their support in the hardware is optional. pubconst GNU_PROPERTY_X86_ISA_1_USED: u32 = 0xc0010002; /// The x86 instruction sets indicated by the corresponding bits are /// used in program and they must be supported by the hardware. pubconst GNU_PROPERTY_X86_ISA_1_NEEDED: u32 = 0xc0008002; /// X86 processor-specific features used in program. pubconst GNU_PROPERTY_X86_FEATURE_1_AND: u32 = 0xc0000002;
/// This indicates that all executable sections are compatible with IBT. pubconst GNU_PROPERTY_X86_FEATURE_1_IBT: u32 = 1 << 0; /// This indicates that all executable sections are compatible with SHSTK. pubconst GNU_PROPERTY_X86_FEATURE_1_SHSTK: u32 = 1 << 1;
// TODO: Elf*_Move
/// Header of `SHT_HASH` section. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct HashHeader<E: Endian> { /// The number of hash buckets. pub bucket_count: U32<E>, /// The number of chain values. pub chain_count: U32<E>, // Array of hash bucket start indices. // buckets: U32<E>[bucket_count] // Array of hash chain links. An index of 0 terminates the chain. // chains: U32<E>[chain_count]
}
/// Calculate the SysV hash for a symbol name. /// /// Used for `SHT_HASH`. pubfn hash(name: &[u8]) -> u32 { letmut hash = 0u32; for byte in name {
hash = hash.wrapping_mul(16).wrapping_add(u32::from(*byte));
hash ^= (hash >> 24) & 0xf0;
}
hash & 0xfff_ffff
}
/// Header of `SHT_GNU_HASH` section. #[derive(Debug, Clone, Copy)] #[repr(C)] pubstruct GnuHashHeader<E: Endian> { /// The number of hash buckets. pub bucket_count: U32<E>, /// The symbol table index of the first symbol in the hash. pub symbol_base: U32<E>, /// The number of words in the bloom filter. /// /// Must be a non-zero power of 2. pub bloom_count: U32<E>, /// The bit shift count for the bloom filter. pub bloom_shift: U32<E>, // Array of bloom filter words. // bloom_filters: U32<E>[bloom_count] or U64<E>[bloom_count] // Array of hash bucket start indices. // buckets: U32<E>[bucket_count] // Array of hash values, one for each symbol starting at symbol_base. // values: U32<E>[symbol_count]
}
/// Calculate the GNU hash for a symbol name. /// /// Used for `SHT_GNU_HASH`. pubfn gnu_hash(name: &[u8]) -> u32 { letmut hash = 5381u32; for byte in name {
hash = hash.wrapping_mul(33).wrapping_add(u32::from(*byte));
}
hash
}
// Motorola 68k specific definitions.
// m68k values for `Rel*::r_type`.
/// No reloc pubconst R_68K_NONE: u32 = 0; /// Direct 32 bit pubconst R_68K_32: u32 = 1; /// Direct 16 bit pubconst R_68K_16: u32 = 2; /// Direct 8 bit pubconst R_68K_8: u32 = 3; /// PC relative 32 bit pubconst R_68K_PC32: u32 = 4; /// PC relative 16 bit pubconst R_68K_PC16: u32 = 5; /// PC relative 8 bit pubconst R_68K_PC8: u32 = 6; /// 32 bit PC relative GOT entry pubconst R_68K_GOT32: u32 = 7; /// 16 bit PC relative GOT entry pubconst R_68K_GOT16: u32 = 8; /// 8 bit PC relative GOT entry pubconst R_68K_GOT8: u32 = 9; /// 32 bit GOT offset pubconst R_68K_GOT32O: u32 = 10; /// 16 bit GOT offset pubconst R_68K_GOT16O: u32 = 11; /// 8 bit GOT offset pubconst R_68K_GOT8O: u32 = 12; /// 32 bit PC relative PLT address pubconst R_68K_PLT32: u32 = 13; /// 16 bit PC relative PLT address pubconst R_68K_PLT16: u32 = 14; /// 8 bit PC relative PLT address pubconst R_68K_PLT8: u32 = 15; /// 32 bit PLT offset pubconst R_68K_PLT32O: u32 = 16; /// 16 bit PLT offset pubconst R_68K_PLT16O: u32 = 17; /// 8 bit PLT offset pubconst R_68K_PLT8O: u32 = 18; /// Copy symbol at runtime pubconst R_68K_COPY: u32 = 19; /// Create GOT entry pubconst R_68K_GLOB_DAT: u32 = 20; /// Create PLT entry pubconst R_68K_JMP_SLOT: u32 = 21; /// Adjust by program base pubconst R_68K_RELATIVE: u32 = 22; /// 32 bit GOT offset for GD pubconst R_68K_TLS_GD32: u32 = 25; /// 16 bit GOT offset for GD pubconst R_68K_TLS_GD16: u32 = 26; /// 8 bit GOT offset for GD pubconst R_68K_TLS_GD8: u32 = 27; /// 32 bit GOT offset for LDM pubconst R_68K_TLS_LDM32: u32 = 28; /// 16 bit GOT offset for LDM pubconst R_68K_TLS_LDM16: u32 = 29; /// 8 bit GOT offset for LDM pubconst R_68K_TLS_LDM8: u32 = 30; /// 32 bit module-relative offset pubconst R_68K_TLS_LDO32: u32 = 31; /// 16 bit module-relative offset pubconst R_68K_TLS_LDO16: u32 = 32; /// 8 bit module-relative offset pubconst R_68K_TLS_LDO8: u32 = 33; /// 32 bit GOT offset for IE pubconst R_68K_TLS_IE32: u32 = 34; /// 16 bit GOT offset for IE pubconst R_68K_TLS_IE16: u32 = 35; /// 8 bit GOT offset for IE pubconst R_68K_TLS_IE8: u32 = 36; /// 32 bit offset relative to static TLS block pubconst R_68K_TLS_LE32: u32 = 37; /// 16 bit offset relative to static TLS block pubconst R_68K_TLS_LE16: u32 = 38; /// 8 bit offset relative to static TLS block pubconst R_68K_TLS_LE8: u32 = 39; /// 32 bit module number pubconst R_68K_TLS_DTPMOD32: u32 = 40; /// 32 bit module-relative offset pubconst R_68K_TLS_DTPREL32: u32 = 41; /// 32 bit TP-relative offset pubconst R_68K_TLS_TPREL32: u32 = 42;
// Intel 80386 specific definitions.
// i386 values for `Rel*::r_type`.
/// No reloc pubconst R_386_NONE: u32 = 0; /// Direct 32 bit pubconst R_386_32: u32 = 1; /// PC relative 32 bit pubconst R_386_PC32: u32 = 2; /// 32 bit GOT entry pubconst R_386_GOT32: u32 = 3; /// 32 bit PLT address pubconst R_386_PLT32: u32 = 4; /// Copy symbol at runtime pubconst R_386_COPY: u32 = 5; /// Create GOT entry pubconst R_386_GLOB_DAT: u32 = 6; /// Create PLT entry pubconst R_386_JMP_SLOT: u32 = 7; /// Adjust by program base pubconst R_386_RELATIVE: u32 = 8; /// 32 bit offset to GOT pubconst R_386_GOTOFF: u32 = 9; /// 32 bit PC relative offset to GOT pubconst R_386_GOTPC: u32 = 10; /// Direct 32 bit PLT address pubconst R_386_32PLT: u32 = 11; /// Offset in static TLS block pubconst R_386_TLS_TPOFF: u32 = 14; /// Address of GOT entry for static TLS block offset pubconst R_386_TLS_IE: u32 = 15; /// GOT entry for static TLS block offset pubconst R_386_TLS_GOTIE: u32 = 16; /// Offset relative to static TLS block pubconst R_386_TLS_LE: u32 = 17; /// Direct 32 bit for GNU version of general dynamic thread local data pubconst R_386_TLS_GD: u32 = 18; /// Direct 32 bit for GNU version of local dynamic thread local data in LE code pubconst R_386_TLS_LDM: u32 = 19; /// Direct 16 bit pubconst R_386_16: u32 = 20; /// PC relative 16 bit pubconst R_386_PC16: u32 = 21; /// Direct 8 bit pubconst R_386_8: u32 = 22; /// PC relative 8 bit pubconst R_386_PC8: u32 = 23; /// Direct 32 bit for general dynamic thread local data pubconst R_386_TLS_GD_32: u32 = 24; /// Tag for pushl in GD TLS code pubconst R_386_TLS_GD_PUSH: u32 = 25; /// Relocation for call to __tls_get_addr() pubconst R_386_TLS_GD_CALL: u32 = 26; /// Tag for popl in GD TLS code pubconst R_386_TLS_GD_POP: u32 = 27; /// Direct 32 bit for local dynamic thread local data in LE code pubconst R_386_TLS_LDM_32: u32 = 28; /// Tag for pushl in LDM TLS code pubconst R_386_TLS_LDM_PUSH: u32 = 29; /// Relocation for call to __tls_get_addr() in LDM code pubconst R_386_TLS_LDM_CALL: u32 = 30; /// Tag for popl in LDM TLS code pubconst R_386_TLS_LDM_POP: u32 = 31; /// Offset relative to TLS block pubconst R_386_TLS_LDO_32: u32 = 32; /// GOT entry for negated static TLS block offset pubconst R_386_TLS_IE_32: u32 = 33; /// Negated offset relative to static TLS block pubconst R_386_TLS_LE_32: u32 = 34; /// ID of module containing symbol pubconst R_386_TLS_DTPMOD32: u32 = 35; /// Offset in TLS block pubconst R_386_TLS_DTPOFF32: u32 = 36; /// Negated offset in static TLS block pubconst R_386_TLS_TPOFF32: u32 = 37; /// 32-bit symbol size pubconst R_386_SIZE32: u32 = 38; /// GOT offset for TLS descriptor. pubconst R_386_TLS_GOTDESC: u32 = 39; /// Marker of call through TLS descriptor for relaxation. pubconst R_386_TLS_DESC_CALL: u32 = 40; /// TLS descriptor containing pointer to code and to argument, returning the TLS offset for the symbol. pubconst R_386_TLS_DESC: u32 = 41; /// Adjust indirectly by program base pubconst R_386_IRELATIVE: u32 = 42; /// Load from 32 bit GOT entry, relaxable. pubconst R_386_GOT32X: u32 = 43;
// ADI SHARC specific definitions
// SHARC values for `Rel*::r_type`
/// 24-bit absolute address in bits 23:0 of a 48-bit instr /// /// Targets: /// /// * Type 25a (PC_DIRECT) pubconst R_SHARC_ADDR24_V3: u32 = 0x0b;
/// 32-bit absolute address in bits 31:0 of a 48-bit instr /// /// Targets: /// /// * Type 14a /// * Type 14d /// * Type 15a /// * Type 16a /// * Type 17a /// * Type 18a /// * Type 19a pubconst R_SHARC_ADDR32_V3: u32 = 0x0c;
/// 32-bit absolute address in bits 31:0 of a 32-bit data location /// /// Represented with `RelocationEncoding::Generic` pubconst R_SHARC_ADDR_VAR_V3: u32 = 0x0d;
/// 6-bit PC-relative address in bits 32:27 of a 48-bit instr /// /// Targets: /// /// * Type 9a /// * Type 10a pubconst R_SHARC_PCRSHORT_V3: u32 = 0x0e;
/// 24-bit PC-relative address in bits 23:0 of a 48-bit instr /// /// Targets: /// /// * Type 8a /// * Type 12a (truncated to 23 bits after relocation) /// * Type 13a (truncated to 23 bits after relocation) /// * Type 25a (PC Relative) pubconst R_SHARC_PCRLONG_V3: u32 = 0x0f;
/// 6-bit absolute address in bits 32:27 of a 48-bit instr /// /// Targets: /// /// * Type 4a /// * Type 4b /// * Type 4d pubconst R_SHARC_DATA6_V3: u32 = 0x10;
/// 16-bit absolute address in bits 39:24 of a 48-bit instr /// /// Targets: /// /// * Type 12a pubconst R_SHARC_DATA16_V3: u32 = 0x11;
/// 6-bit absolute address into bits 16:11 of a 32-bit instr /// /// Targets: /// /// * Type 4b pubconst R_SHARC_DATA6_VISA_V3: u32 = 0x12;
/// 7-bit absolute address into bits 6:0 of a 32-bit instr pubconst R_SHARC_DATA7_VISA_V3: u32 = 0x13;
/// 16-bit absolute address into bits 15:0 of a 32-bit instr pubconst R_SHARC_DATA16_VISA_V3: u32 = 0x14;
/// 6-bit PC-relative address into bits 16:11 of a Type B /// /// Targets: /// /// * Type 9b pubconst R_SHARC_PCR6_VISA_V3: u32 = 0x17;
/// 16-bit absolute address into bits 15:0 of a 16-bit location. /// /// Represented with `RelocationEncoding::Generic` pubconst R_SHARC_ADDR_VAR16_V3: u32 = 0x19;
/// Runtime linker interface version pubconst DT_MIPS_RLD_VERSION: u32 = 0x7000_0001; /// Timestamp pubconst DT_MIPS_TIME_STAMP: u32 = 0x7000_0002; /// Checksum pubconst DT_MIPS_ICHECKSUM: u32 = 0x7000_0003; /// Version string (string tbl index) pubconst DT_MIPS_IVERSION: u32 = 0x7000_0004; /// Flags pubconst DT_MIPS_FLAGS: u32 = 0x7000_0005; /// Base address pubconst DT_MIPS_BASE_ADDRESS: u32 = 0x7000_0006; pubconst DT_MIPS_MSYM: u32 = 0x7000_0007; /// Address of CONFLICT section pubconst DT_MIPS_CONFLICT: u32 = 0x7000_0008; /// Address of LIBLIST section pubconst DT_MIPS_LIBLIST: u32 = 0x7000_0009; /// Number of local GOT entries pubconst DT_MIPS_LOCAL_GOTNO: u32 = 0x7000_000a; /// Number of CONFLICT entries pubconst DT_MIPS_CONFLICTNO: u32 = 0x7000_000b; /// Number of LIBLIST entries pubconst DT_MIPS_LIBLISTNO: u32 = 0x7000_0010; /// Number of DYNSYM entries pubconst DT_MIPS_SYMTABNO: u32 = 0x7000_0011; /// First external DYNSYM pubconst DT_MIPS_UNREFEXTNO: u32 = 0x7000_0012; /// First GOT entry in DYNSYM pubconst DT_MIPS_GOTSYM: u32 = 0x7000_0013; /// Number of GOT page table entries pubconst DT_MIPS_HIPAGENO: u32 = 0x7000_0014; /// Address of run time loader map. pubconst DT_MIPS_RLD_MAP: u32 = 0x7000_0016; /// Delta C++ class definition. pubconst DT_MIPS_DELTA_CLASS: u32 = 0x7000_0017; /// Number of entries in DT_MIPS_DELTA_CLASS. pubconst DT_MIPS_DELTA_CLASS_NO: u32 = 0x7000_0018; /// Delta C++ class instances. pubconst DT_MIPS_DELTA_INSTANCE: u32 = 0x7000_0019; /// Number of entries in DT_MIPS_DELTA_INSTANCE. pubconst DT_MIPS_DELTA_INSTANCE_NO: u32 = 0x7000_001a; /// Delta relocations. pubconst DT_MIPS_DELTA_RELOC: u32 = 0x7000_001b; /// Number of entries in DT_MIPS_DELTA_RELOC. pubconst DT_MIPS_DELTA_RELOC_NO: u32 = 0x7000_001c; /// Delta symbols that Delta relocations refer to. pubconst DT_MIPS_DELTA_SYM: u32 = 0x7000_001d; /// Number of entries in DT_MIPS_DELTA_SYM. pubconst DT_MIPS_DELTA_SYM_NO: u32 = 0x7000_001e; /// Delta symbols that hold the class declaration. pubconst DT_MIPS_DELTA_CLASSSYM: u32 = 0x7000_0020; /// Number of entries in DT_MIPS_DELTA_CLASSSYM. pubconst DT_MIPS_DELTA_CLASSSYM_NO: u32 = 0x7000_0021; /// Flags indicating for C++ flavor. pubconst DT_MIPS_CXX_FLAGS: u32 = 0x7000_0022; pubconst DT_MIPS_PIXIE_INIT: u32 = 0x7000_0023; pubconst DT_MIPS_SYMBOL_LIB: u32 = 0x7000_0024; pubconst DT_MIPS_LOCALPAGE_GOTIDX: u32 = 0x7000_0025; pubconst DT_MIPS_LOCAL_GOTIDX: u32 = 0x7000_0026; pubconst DT_MIPS_HIDDEN_GOTIDX: u32 = 0x7000_0027; pubconst DT_MIPS_PROTECTED_GOTIDX: u32 = 0x7000_0028; /// Address of .options. pubconst DT_MIPS_OPTIONS: u32 = 0x7000_0029; /// Address of .interface. pubconst DT_MIPS_INTERFACE: u32 = 0x7000_002a; pubconst DT_MIPS_DYNSTR_ALIGN: u32 = 0x7000_002b; /// Size of the .interface section. pubconst DT_MIPS_INTERFACE_SIZE: u32 = 0x7000_002c; /// Address of rld_text_rsolve function stored in GOT. pubconst DT_MIPS_RLD_TEXT_RESOLVE_ADDR: u32 = 0x7000_002d; /// Default suffix of dso to be added by rld on dlopen() calls. pubconst DT_MIPS_PERF_SUFFIX: u32 = 0x7000_002e; /// (O32)Size of compact rel section. pubconst DT_MIPS_COMPACT_SIZE: u32 = 0x7000_002f; /// GP value for aux GOTs. pubconst DT_MIPS_GP_VALUE: u32 = 0x7000_0030; /// Address of aux .dynamic. pubconst DT_MIPS_AUX_DYNAMIC: u32 = 0x7000_0031; /// The address of .got.plt in an executable using the new non-PIC ABI. pubconst DT_MIPS_PLTGOT: u32 = 0x7000_0032; /// The base of the PLT in an executable using the new non-PIC ABI if that PLT is writable. For a non-writable PLT, this is omitted or has a zero value. pubconst DT_MIPS_RWPLT: u32 = 0x7000_0034; /// An alternative description of the classic MIPS RLD_MAP that is usable in a PIE as it stores a relative offset from the address of the tag rather than an absolute address. pubconst DT_MIPS_RLD_MAP_REL: u32 = 0x7000_0035;
/// Section for tentatively declared symbols in ANSI C. pubconst SHN_PARISC_ANSI_COMMON: u16 = 0xff00; /// Common blocks in huge model. pubconst SHN_PARISC_HUGE_COMMON: u16 = 0xff01;
// PA-RISC values for `SectionHeader32::sh_type`.
/// Contains product specific ext. pubconst SHT_PARISC_EXT: u32 = 0x7000_0000; /// Unwind information. pubconst SHT_PARISC_UNWIND: u32 = 0x7000_0001; /// Debug info for optimized code. pubconst SHT_PARISC_DOC: u32 = 0x7000_0002;
// PA-RISC values for `SectionHeader32::sh_flags`.
/// Section with short addressing. pubconst SHF_PARISC_SHORT: u32 = 0x2000_0000; /// Section far from gp. pubconst SHF_PARISC_HUGE: u32 = 0x4000_0000; /// Static branch prediction code. pubconst SHF_PARISC_SBP: u32 = 0x8000_0000;
// PA-RISC values for `st_type` component of `Sym32::st_info`.
/// Millicode function entry point. pubconst STT_PARISC_MILLICODE: u8 = 13;
/// All addresses must be < 2GB. pubconst EF_ALPHA_32BIT: u32 = 1; /// Relocations for relaxing exist. pubconst EF_ALPHA_CANRELAX: u32 = 2;
// Alpha values for `SectionHeader64::sh_type`.
// These two are primerily concerned with ECOFF debugging info. pubconst SHT_ALPHA_DEBUG: u32 = 0x7000_0001; pubconst SHT_ALPHA_REGINFO: u32 = 0x7000_0002;
// Alpha values for `SectionHeader64::sh_flags`.
pubconst SHF_ALPHA_GPREL: u32 = 0x1000_0000;
// Alpha values for `Sym64::st_other`. /// No PV required. pubconst STO_ALPHA_NOPV: u8 = 0x80; /// PV only used for initial ldgp. pubconst STO_ALPHA_STD_GPLOAD: u8 = 0x88;
// Alpha values for `Rel64::r_type`.
/// No reloc pubconst R_ALPHA_NONE: u32 = 0; /// Direct 32 bit pubconst R_ALPHA_REFLONG: u32 = 1; /// Direct 64 bit pubconst R_ALPHA_REFQUAD: u32 = 2; /// GP relative 32 bit pubconst R_ALPHA_GPREL32: u32 = 3; /// GP relative 16 bit w/optimization pubconst R_ALPHA_LITERAL: u32 = 4; /// Optimization hint for LITERAL pubconst R_ALPHA_LITUSE: u32 = 5; /// Add displacement to GP pubconst R_ALPHA_GPDISP: u32 = 6; /// PC+4 relative 23 bit shifted pubconst R_ALPHA_BRADDR: u32 = 7; /// PC+4 relative 16 bit shifted pubconst R_ALPHA_HINT: u32 = 8; /// PC relative 16 bit pubconst R_ALPHA_SREL16: u32 = 9; /// PC relative 32 bit pubconst R_ALPHA_SREL32: u32 = 10; /// PC relative 64 bit pubconst R_ALPHA_SREL64: u32 = 11; /// GP relative 32 bit, high 16 bits pubconst R_ALPHA_GPRELHIGH: u32 = 17; /// GP relative 32 bit, low 16 bits pubconst R_ALPHA_GPRELLOW: u32 = 18; /// GP relative 16 bit pubconst R_ALPHA_GPREL16: u32 = 19; /// Copy symbol at runtime pubconst R_ALPHA_COPY: u32 = 24; /// Create GOT entry pubconst R_ALPHA_GLOB_DAT: u32 = 25; /// Create PLT entry pubconst R_ALPHA_JMP_SLOT: u32 = 26; /// Adjust by program base pubconst R_ALPHA_RELATIVE: u32 = 27; pubconst R_ALPHA_TLS_GD_HI: u32 = 28; pubconst R_ALPHA_TLSGD: u32 = 29; pubconst R_ALPHA_TLS_LDM: u32 = 30; pubconst R_ALPHA_DTPMOD64: u32 = 31; pubconst R_ALPHA_GOTDTPREL: u32 = 32; pubconst R_ALPHA_DTPREL64: u32 = 33; pubconst R_ALPHA_DTPRELHI: u32 = 34; pubconst R_ALPHA_DTPRELLO: u32 = 35; pubconst R_ALPHA_DTPREL16: u32 = 36; pubconst R_ALPHA_GOTTPREL: u32 = 37; pubconst R_ALPHA_TPREL64: u32 = 38; pubconst R_ALPHA_TPRELHI: u32 = 39; pubconst R_ALPHA_TPRELLO: u32 = 40; pubconst R_ALPHA_TPREL16: u32 = 41;
// Diab tool values for `Rel*::r_type`. /// like EMB_SDA21, but lower 16 bit pubconst R_PPC_DIAB_SDA21_LO: u32 = 180; /// like EMB_SDA21, but high 16 bit pubconst R_PPC_DIAB_SDA21_HI: u32 = 181; /// like EMB_SDA21, adjusted high 16 pubconst R_PPC_DIAB_SDA21_HA: u32 = 182; /// like EMB_RELSDA, but lower 16 bit pubconst R_PPC_DIAB_RELSDA_LO: u32 = 183; /// like EMB_RELSDA, but high 16 bit pubconst R_PPC_DIAB_RELSDA_HI: u32 = 184; /// like EMB_RELSDA, adjusted high 16 pubconst R_PPC_DIAB_RELSDA_HA: u32 = 185;
/// GNU extension to support local ifunc. pubconst R_PPC_IRELATIVE: u32 = 248;
// Added when HA and HI relocs were changed to report overflows. pubconst R_PPC64_ADDR16_HIGH: u32 = 110; pubconst R_PPC64_ADDR16_HIGHA: u32 = 111; pubconst R_PPC64_TPREL16_HIGH: u32 = 112; pubconst R_PPC64_TPREL16_HIGHA: u32 = 113; pubconst R_PPC64_DTPREL16_HIGH: u32 = 114; pubconst R_PPC64_DTPREL16_HIGHA: u32 = 115;
/// GNU extension to support local ifunc. pubconst R_PPC64_JMP_IREL: u32 = 247; /// GNU extension to support local ifunc. pubconst R_PPC64_IRELATIVE: u32 = 248; /// half16 (sym+add-.) pubconst R_PPC64_REL16: u32 = 249; /// half16 (sym+add-.)@l pubconst R_PPC64_REL16_LO: u32 = 250; /// half16 (sym+add-.)@h pubconst R_PPC64_REL16_HI: u32 = 251; /// half16 (sym+add-.)@ha pubconst R_PPC64_REL16_HA: u32 = 252;
// PowerPC64 values for `FileHeader64::e_flags. /// PowerPC64 bits specifying ABI. /// /// 1 for original function descriptor using ABI, /// 2 for revised ABI without function descriptors, /// 0 for unspecified or not using any features affected by the differences. pubconst EF_PPC64_ABI: u32 = 3;
/// NB conflicts with EF_ARM_SOFT_FLOAT pubconst EF_ARM_ABI_FLOAT_SOFT: u32 = 0x200; /// NB conflicts with EF_ARM_VFP_FLOAT pubconst EF_ARM_ABI_FLOAT_HARD: u32 = 0x400;
// Other constants defined in the ARM ELF spec. version B-01. // NB. These conflict with values defined above. pubconst EF_ARM_SYMSARESORTED: u32 = 0x04; pubconst EF_ARM_DYNSYMSUSESEGIDX: u32 = 0x08; pubconst EF_ARM_MAPSYMSFIRST: u32 = 0x10;
// Constants defined in AAELF. pubconst EF_ARM_BE8: u32 = 0x0080_0000; pubconst EF_ARM_LE8: u32 = 0x0040_0000;
// ARM Thumb values for `st_type` component of `Sym*::st_info`. /// A Thumb function. pubconst STT_ARM_TFUNC: u8 = STT_LOPROC; /// A Thumb label. pubconst STT_ARM_16BIT: u8 = STT_HIPROC;
// ARM values for `SectionHeader*::sh_flags`. /// Section contains an entry point pubconst SHF_ARM_ENTRYSECT: u32 = 0x1000_0000; /// Section may be multiply defined in the input to a link step. pubconst SHF_ARM_COMDEF: u32 = 0x8000_0000;
// ARM values for `ProgramHeader*::p_flags`. /// Segment contains the location addressed by the static base. pubconst PF_ARM_SB: u32 = 0x1000_0000; /// Position-independent segment. pubconst PF_ARM_PI: u32 = 0x2000_0000; /// Absolute segment. pubconst PF_ARM_ABS: u32 = 0x4000_0000;
// ARM values for `ProgramHeader*::p_type`. /// ARM unwind segment. pubconst PT_ARM_EXIDX: u32 = PT_LOPROC + 1;
// ARM values for `SectionHeader*::sh_type`. /// ARM unwind section. pubconst SHT_ARM_EXIDX: u32 = SHT_LOPROC + 1; /// Preemption details. pubconst SHT_ARM_PREEMPTMAP: u32 = SHT_LOPROC + 2; /// ARM attributes section. pubconst SHT_ARM_ATTRIBUTES: u32 = SHT_LOPROC + 3;
/// Bitmask for `EF_AVR_ARCH_*`. pubconst EF_AVR_ARCH: u32 = 0x7F;
/// If set, it is assumed that the elf file uses local symbols as reference /// for the relocations so that linker relaxation is possible. pubconst EF_AVR_LINKRELAX_PREPARED: u32 = 0x80;
// AMD x86-64 values `Rel*::r_type`. /// No reloc pubconst R_X86_64_NONE: u32 = 0; /// Direct 64 bit pubconst R_X86_64_64: u32 = 1; /// PC relative 32 bit signed pubconst R_X86_64_PC32: u32 = 2; /// 32 bit GOT entry pubconst R_X86_64_GOT32: u32 = 3; /// 32 bit PLT address pubconst R_X86_64_PLT32: u32 = 4; /// Copy symbol at runtime pubconst R_X86_64_COPY: u32 = 5; /// Create GOT entry pubconst R_X86_64_GLOB_DAT: u32 = 6; /// Create PLT entry pubconst R_X86_64_JUMP_SLOT: u32 = 7; /// Adjust by program base pubconst R_X86_64_RELATIVE: u32 = 8; /// 32 bit signed PC relative offset to GOT pubconst R_X86_64_GOTPCREL: u32 = 9; /// Direct 32 bit zero extended pubconst R_X86_64_32: u32 = 10; /// Direct 32 bit sign extended pubconst R_X86_64_32S: u32 = 11; /// Direct 16 bit zero extended pubconst R_X86_64_16: u32 = 12; /// 16 bit sign extended pc relative pubconst R_X86_64_PC16: u32 = 13; /// Direct 8 bit sign extended pubconst R_X86_64_8: u32 = 14; /// 8 bit sign extended pc relative pubconst R_X86_64_PC8: u32 = 15; /// ID of module containing symbol pubconst R_X86_64_DTPMOD64: u32 = 16; /// Offset in module's TLS block pubconst R_X86_64_DTPOFF64: u32 = 17; /// Offset in initial TLS block pubconst R_X86_64_TPOFF64: u32 = 18; /// 32 bit signed PC relative offset to two GOT entries for GD symbol pubconst R_X86_64_TLSGD: u32 = 19; /// 32 bit signed PC relative offset to two GOT entries for LD symbol pubconst R_X86_64_TLSLD: u32 = 20; /// Offset in TLS block pubconst R_X86_64_DTPOFF32: u32 = 21; /// 32 bit signed PC relative offset to GOT entry for IE symbol pubconst R_X86_64_GOTTPOFF: u32 = 22; /// Offset in initial TLS block pubconst R_X86_64_TPOFF32: u32 = 23; /// PC relative 64 bit pubconst R_X86_64_PC64: u32 = 24; /// 64 bit offset to GOT pubconst R_X86_64_GOTOFF64: u32 = 25; /// 32 bit signed pc relative offset to GOT pubconst R_X86_64_GOTPC32: u32 = 26; /// 64-bit GOT entry offset pubconst R_X86_64_GOT64: u32 = 27; /// 64-bit PC relative offset to GOT entry pubconst R_X86_64_GOTPCREL64: u32 = 28; /// 64-bit PC relative offset to GOT pubconst R_X86_64_GOTPC64: u32 = 29; /// like GOT64, says PLT entry needed pubconst R_X86_64_GOTPLT64: u32 = 30; /// 64-bit GOT relative offset to PLT entry pubconst R_X86_64_PLTOFF64: u32 = 31; /// Size of symbol plus 32-bit addend pubconst R_X86_64_SIZE32: u32 = 32; /// Size of symbol plus 64-bit addend pubconst R_X86_64_SIZE64: u32 = 33; /// GOT offset for TLS descriptor. pubconst R_X86_64_GOTPC32_TLSDESC: u32 = 34; /// Marker for call through TLS descriptor. pubconst R_X86_64_TLSDESC_CALL: u32 = 35; /// TLS descriptor. pubconst R_X86_64_TLSDESC: u32 = 36; /// Adjust indirectly by program base pubconst R_X86_64_IRELATIVE: u32 = 37; /// 64-bit adjust by program base pubconst R_X86_64_RELATIVE64: u32 = 38; // 39 Reserved was R_X86_64_PC32_BND // 40 Reserved was R_X86_64_PLT32_BND /// Load from 32 bit signed pc relative offset to GOT entry without REX prefix, relaxable. pubconst R_X86_64_GOTPCRELX: u32 = 41; /// Load from 32 bit signed pc relative offset to GOT entry with REX prefix, relaxable. pubconst R_X86_64_REX_GOTPCRELX: u32 = 42;
// AM33 values `Rel*::r_type`. /// No reloc. pubconst R_MN10300_NONE: u32 = 0; /// Direct 32 bit. pubconst R_MN10300_32: u32 = 1; /// Direct 16 bit. pubconst R_MN10300_16: u32 = 2; /// Direct 8 bit. pubconst R_MN10300_8: u32 = 3; /// PC-relative 32-bit. pubconst R_MN10300_PCREL32: u32 = 4; /// PC-relative 16-bit signed. pubconst R_MN10300_PCREL16: u32 = 5; /// PC-relative 8-bit signed. pubconst R_MN10300_PCREL8: u32 = 6; /// Ancient C++ vtable garbage... pubconst R_MN10300_GNU_VTINHERIT: u32 = 7; /// ... collection annotation. pubconst R_MN10300_GNU_VTENTRY: u32 = 8; /// Direct 24 bit. pubconst R_MN10300_24: u32 = 9; /// 32-bit PCrel offset to GOT. pubconst R_MN10300_GOTPC32: u32 = 10; /// 16-bit PCrel offset to GOT. pubconst R_MN10300_GOTPC16: u32 = 11; /// 32-bit offset from GOT. pubconst R_MN10300_GOTOFF32: u32 = 12; /// 24-bit offset from GOT. pubconst R_MN10300_GOTOFF24: u32 = 13; /// 16-bit offset from GOT. pubconst R_MN10300_GOTOFF16: u32 = 14; /// 32-bit PCrel to PLT entry. pubconst R_MN10300_PLT32: u32 = 15; /// 16-bit PCrel to PLT entry. pubconst R_MN10300_PLT16: u32 = 16; /// 32-bit offset to GOT entry. pubconst R_MN10300_GOT32: u32 = 17; /// 24-bit offset to GOT entry. pubconst R_MN10300_GOT24: u32 = 18; /// 16-bit offset to GOT entry. pubconst R_MN10300_GOT16: u32 = 19; /// Copy symbol at runtime. pubconst R_MN10300_COPY: u32 = 20; /// Create GOT entry. pubconst R_MN10300_GLOB_DAT: u32 = 21; /// Create PLT entry. pubconst R_MN10300_JMP_SLOT: u32 = 22; /// Adjust by program base. pubconst R_MN10300_RELATIVE: u32 = 23; /// 32-bit offset for global dynamic. pubconst R_MN10300_TLS_GD: u32 = 24; /// 32-bit offset for local dynamic. pubconst R_MN10300_TLS_LD: u32 = 25; /// Module-relative offset. pubconst R_MN10300_TLS_LDO: u32 = 26; /// GOT offset for static TLS block offset. pubconst R_MN10300_TLS_GOTIE: u32 = 27; /// GOT address for static TLS block offset. pubconst R_MN10300_TLS_IE: u32 = 28; /// Offset relative to static TLS block. pubconst R_MN10300_TLS_LE: u32 = 29; /// ID of module containing symbol. pubconst R_MN10300_TLS_DTPMOD: u32 = 30; /// Offset in module TLS block. pubconst R_MN10300_TLS_DTPOFF: u32 = 31; /// Offset in static TLS block. pubconst R_MN10300_TLS_TPOFF: u32 = 32; /// Adjustment for next reloc as needed by linker relaxation. pubconst R_MN10300_SYM_DIFF: u32 = 33; /// Alignment requirement for linker relaxation. pubconst R_MN10300_ALIGN: u32 = 34;
// M32R values `Rel32::r_type`. /// No reloc. pubconst R_M32R_NONE: u32 = 0; /// Direct 16 bit. pubconst R_M32R_16: u32 = 1; /// Direct 32 bit. pubconst R_M32R_32: u32 = 2; /// Direct 24 bit. pubconst R_M32R_24: u32 = 3; /// PC relative 10 bit shifted. pubconst R_M32R_10_PCREL: u32 = 4; /// PC relative 18 bit shifted. pubconst R_M32R_18_PCREL: u32 = 5; /// PC relative 26 bit shifted. pubconst R_M32R_26_PCREL: u32 = 6; /// High 16 bit with unsigned low. pubconst R_M32R_HI16_ULO: u32 = 7; /// High 16 bit with signed low. pubconst R_M32R_HI16_SLO: u32 = 8; /// Low 16 bit. pubconst R_M32R_LO16: u32 = 9; /// 16 bit offset in SDA. pubconst R_M32R_SDA16: u32 = 10; pubconst R_M32R_GNU_VTINHERIT: u32 = 11; pubconst R_M32R_GNU_VTENTRY: u32 = 12; // M32R values `Rela32::r_type`. /// Direct 16 bit. pubconst R_M32R_16_RELA: u32 = 33; /// Direct 32 bit. pubconst R_M32R_32_RELA: u32 = 34; /// Direct 24 bit. pubconst R_M32R_24_RELA: u32 = 35; /// PC relative 10 bit shifted. pubconst R_M32R_10_PCREL_RELA: u32 = 36; /// PC relative 18 bit shifted. pubconst R_M32R_18_PCREL_RELA: u32 = 37; /// PC relative 26 bit shifted. pubconst R_M32R_26_PCREL_RELA: u32 = 38; /// High 16 bit with unsigned low pubconst R_M32R_HI16_ULO_RELA: u32 = 39; /// High 16 bit with signed low pubconst R_M32R_HI16_SLO_RELA: u32 = 40; /// Low 16 bit pubconst R_M32R_LO16_RELA: u32 = 41; /// 16 bit offset in SDA pubconst R_M32R_SDA16_RELA: u32 = 42; pubconst R_M32R_RELA_GNU_VTINHERIT: u32 = 43; pubconst R_M32R_RELA_GNU_VTENTRY: u32 = 44; /// PC relative 32 bit. pubconst R_M32R_REL32: u32 = 45;
/// 24 bit GOT entry pubconst R_M32R_GOT24: u32 = 48; /// 26 bit PC relative to PLT shifted pubconst R_M32R_26_PLTREL: u32 = 49; /// Copy symbol at runtime pubconst R_M32R_COPY: u32 = 50; /// Create GOT entry pubconst R_M32R_GLOB_DAT: u32 = 51; /// Create PLT entry pubconst R_M32R_JMP_SLOT: u32 = 52; /// Adjust by program base pubconst R_M32R_RELATIVE: u32 = 53; /// 24 bit offset to GOT pubconst R_M32R_GOTOFF: u32 = 54; /// 24 bit PC relative offset to GOT pubconst R_M32R_GOTPC24: u32 = 55; /// High 16 bit GOT entry with unsigned low pubconst R_M32R_GOT16_HI_ULO: u32 = 56; /// High 16 bit GOT entry with signed low pubconst R_M32R_GOT16_HI_SLO: u32 = 57; /// Low 16 bit GOT entry pubconst R_M32R_GOT16_LO: u32 = 58; /// High 16 bit PC relative offset to GOT with unsigned low pubconst R_M32R_GOTPC_HI_ULO: u32 = 59; /// High 16 bit PC relative offset to GOT with signed low pubconst R_M32R_GOTPC_HI_SLO: u32 = 60; /// Low 16 bit PC relative offset to GOT pubconst R_M32R_GOTPC_LO: u32 = 61; /// High 16 bit offset to GOT with unsigned low pubconst R_M32R_GOTOFF_HI_ULO: u32 = 62; /// High 16 bit offset to GOT with signed low pubconst R_M32R_GOTOFF_HI_SLO: u32 = 63; /// Low 16 bit offset to GOT pubconst R_M32R_GOTOFF_LO: u32 = 64; /// Keep this the last entry. pubconst R_M32R_NUM: u32 = 256;
// MicroBlaze values `Rel*::r_type`. /// No reloc. pubconst R_MICROBLAZE_NONE: u32 = 0; /// Direct 32 bit. pubconst R_MICROBLAZE_32: u32 = 1; /// PC relative 32 bit. pubconst R_MICROBLAZE_32_PCREL: u32 = 2; /// PC relative 64 bit. pubconst R_MICROBLAZE_64_PCREL: u32 = 3; /// Low 16 bits of PCREL32. pubconst R_MICROBLAZE_32_PCREL_LO: u32 = 4; /// Direct 64 bit. pubconst R_MICROBLAZE_64: u32 = 5; /// Low 16 bit. pubconst R_MICROBLAZE_32_LO: u32 = 6; /// Read-only small data area. pubconst R_MICROBLAZE_SRO32: u32 = 7; /// Read-write small data area. pubconst R_MICROBLAZE_SRW32: u32 = 8; /// No reloc. pubconst R_MICROBLAZE_64_NONE: u32 = 9; /// Symbol Op Symbol relocation. pubconst R_MICROBLAZE_32_SYM_OP_SYM: u32 = 10; /// GNU C++ vtable hierarchy. pubconst R_MICROBLAZE_GNU_VTINHERIT: u32 = 11; /// GNU C++ vtable member usage. pubconst R_MICROBLAZE_GNU_VTENTRY: u32 = 12; /// PC-relative GOT offset. pubconst R_MICROBLAZE_GOTPC_64: u32 = 13; /// GOT entry offset. pubconst R_MICROBLAZE_GOT_64: u32 = 14; /// PLT offset (PC-relative). pubconst R_MICROBLAZE_PLT_64: u32 = 15; /// Adjust by program base. pubconst R_MICROBLAZE_REL: u32 = 16; /// Create PLT entry. pubconst R_MICROBLAZE_JUMP_SLOT: u32 = 17; /// Create GOT entry. pubconst R_MICROBLAZE_GLOB_DAT: u32 = 18; /// 64 bit offset to GOT. pubconst R_MICROBLAZE_GOTOFF_64: u32 = 19; /// 32 bit offset to GOT. pubconst R_MICROBLAZE_GOTOFF_32: u32 = 20; /// Runtime copy. pubconst R_MICROBLAZE_COPY: u32 = 21; /// TLS Reloc. pubconst R_MICROBLAZE_TLS: u32 = 22; /// TLS General Dynamic. pubconst R_MICROBLAZE_TLSGD: u32 = 23; /// TLS Local Dynamic. pubconst R_MICROBLAZE_TLSLD: u32 = 24; /// TLS Module ID. pubconst R_MICROBLAZE_TLSDTPMOD32: u32 = 25; /// TLS Offset Within TLS Block. pubconst R_MICROBLAZE_TLSDTPREL32: u32 = 26; /// TLS Offset Within TLS Block. pubconst R_MICROBLAZE_TLSDTPREL64: u32 = 27; /// TLS Offset From Thread Pointer. pubconst R_MICROBLAZE_TLSGOTTPREL32: u32 = 28; /// TLS Offset From Thread Pointer. pubconst R_MICROBLAZE_TLSTPREL32: u32 = 29;
// Nios II values `Dyn::d_tag`. /// Address of _gp. pubconst DT_NIOS2_GP: u32 = 0x7000_0002;
// Nios II values `Rel*::r_type`. /// No reloc. pubconst R_NIOS2_NONE: u32 = 0; /// Direct signed 16 bit. pubconst R_NIOS2_S16: u32 = 1; /// Direct unsigned 16 bit. pubconst R_NIOS2_U16: u32 = 2; /// PC relative 16 bit. pubconst R_NIOS2_PCREL16: u32 = 3; /// Direct call. pubconst R_NIOS2_CALL26: u32 = 4; /// 5 bit constant expression. pubconst R_NIOS2_IMM5: u32 = 5; /// 5 bit expression, shift 22. pubconst R_NIOS2_CACHE_OPX: u32 = 6; /// 6 bit constant expression. pubconst R_NIOS2_IMM6: u32 = 7; /// 8 bit constant expression. pubconst R_NIOS2_IMM8: u32 = 8; /// High 16 bit. pubconst R_NIOS2_HI16: u32 = 9; /// Low 16 bit. pubconst R_NIOS2_LO16: u32 = 10; /// High 16 bit, adjusted. pubconst R_NIOS2_HIADJ16: u32 = 11; /// 32 bit symbol value + addend. pubconst R_NIOS2_BFD_RELOC_32: u32 = 12; /// 16 bit symbol value + addend. pubconst R_NIOS2_BFD_RELOC_16: u32 = 13; /// 8 bit symbol value + addend. pubconst R_NIOS2_BFD_RELOC_8: u32 = 14; /// 16 bit GP pointer offset. pubconst R_NIOS2_GPREL: u32 = 15; /// GNU C++ vtable hierarchy. pubconst R_NIOS2_GNU_VTINHERIT: u32 = 16; /// GNU C++ vtable member usage. pubconst R_NIOS2_GNU_VTENTRY: u32 = 17; /// Unconditional branch. pubconst R_NIOS2_UJMP: u32 = 18; /// Conditional branch. pubconst R_NIOS2_CJMP: u32 = 19; /// Indirect call through register. pubconst R_NIOS2_CALLR: u32 = 20; /// Alignment requirement for linker relaxation. pubconst R_NIOS2_ALIGN: u32 = 21; /// 16 bit GOT entry. pubconst R_NIOS2_GOT16: u32 = 22; /// 16 bit GOT entry for function. pubconst R_NIOS2_CALL16: u32 = 23; /// %lo of offset to GOT pointer. pubconst R_NIOS2_GOTOFF_LO: u32 = 24; /// %hiadj of offset to GOT pointer. pubconst R_NIOS2_GOTOFF_HA: u32 = 25; /// %lo of PC relative offset. pubconst R_NIOS2_PCREL_LO: u32 = 26; /// %hiadj of PC relative offset. pubconst R_NIOS2_PCREL_HA: u32 = 27; /// 16 bit GOT offset for TLS GD. pubconst R_NIOS2_TLS_GD16: u32 = 28; /// 16 bit GOT offset for TLS LDM. pubconst R_NIOS2_TLS_LDM16: u32 = 29; /// 16 bit module relative offset. pubconst R_NIOS2_TLS_LDO16: u32 = 30; /// 16 bit GOT offset for TLS IE. pubconst R_NIOS2_TLS_IE16: u32 = 31; /// 16 bit LE TP-relative offset. pubconst R_NIOS2_TLS_LE16: u32 = 32; /// Module number. pubconst R_NIOS2_TLS_DTPMOD: u32 = 33; /// Module-relative offset. pubconst R_NIOS2_TLS_DTPREL: u32 = 34; /// TP-relative offset. pubconst R_NIOS2_TLS_TPREL: u32 = 35; /// Copy symbol at runtime. pubconst R_NIOS2_COPY: u32 = 36; /// Create GOT entry. pubconst R_NIOS2_GLOB_DAT: u32 = 37; /// Create PLT entry. pubconst R_NIOS2_JUMP_SLOT: u32 = 38; /// Adjust by program base. pubconst R_NIOS2_RELATIVE: u32 = 39; /// 16 bit offset to GOT pointer. pubconst R_NIOS2_GOTOFF: u32 = 40; /// Direct call in .noat section. pubconst R_NIOS2_CALL26_NOAT: u32 = 41; /// %lo() of GOT entry. pubconst R_NIOS2_GOT_LO: u32 = 42; /// %hiadj() of GOT entry. pubconst R_NIOS2_GOT_HA: u32 = 43; /// %lo() of function GOT entry. pubconst R_NIOS2_CALL_LO: u32 = 44; /// %hiadj() of function GOT entry. pubconst R_NIOS2_CALL_HA: u32 = 45;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.