[−][src]Struct elf_utilities::symbol::elf64::Symbol64
Symbol64 is a entry of symbol table section.
Symbol64 はシンボルテーブルセクションのエントリである. ELF64で用いることを想定している.
Defaultトレイトを実装しているので,
Default::default()
を呼び出すことで簡単にNULLシンボルを作成できる.
Examples
use elf_utilities::symbol::Symbol64; let null_sym : Symbol64 = Default::default(); // Symbol64::new_null_symbol() のエイリアスでも作成可能. let null_sym2 : Symbol64 = Symbol64::new_null_symbol(); assert_eq!(null_sym, null_sym2);
ELFファイルを生成する用途でこのライブラリを使用できるように, バイト列への変換もサポートしている.
Examples
use elf_utilities::symbol::Symbol64; let null_sym : Symbol64 = Default::default(); // to_le_bytes() を利用してバイト列に変換できる. let sym_bytes = null_sym.to_le_bytes(); assert_eq!(sym_bytes.len() as elf_utilities::Elf64Xword, Symbol64::size())
Implementations
impl Symbol64
[src]
pub fn new_null_symbol() -> Self
[src]
pub fn size() -> Elf64Xword
[src]
size() provides Symbol64's size used by Shdr64.sh_entsize or else.
pub fn set_symbol_name(&mut self, name: String)
[src]
for comparison
pub fn compare_symbol_name(&self, other: String) -> bool
[src]
pub fn get_type(&self) -> u8
[src]
pub fn get_bind(&self) -> u8
[src]
pub fn set_name(&mut self, name: Elf64Word)
[src]
Set symbol name index to Symbol64
Examples
use elf_utilities::symbol::Symbol64; let mut null_sym : Symbol64 = Default::default(); null_sym.set_name(1); assert_eq!(null_sym.get_name(), 1);
pub fn set_info(&mut self, info: u8)
[src]
Set symbol's information to Symbol64 See symbol::symbol_info for constructing symbol's information.
Examples
use elf_utilities::symbol; let mut null_sym = symbol::Symbol64::new_null_symbol(); let sym_info = symbol::symbol_info(symbol::STB_GLOBAL, symbol::STT_FUNC); null_sym.set_info(sym_info); assert_eq!((1 << 4) | 2, null_sym.get_info());
pub fn set_other(&mut self, other: u8)
[src]
Set symbol's other value to Symbol64 See symbol::VISIBILITY and symbol::symbol_visibility
Examples
use elf_utilities::symbol; let mut null_sym = symbol::Symbol64::new_null_symbol(); let sym_vis = symbol::symbol_visibility(symbol::VISIBILITY::PROTECTED); null_sym.set_other(sym_vis); assert_eq!(0x3, null_sym.get_other());
pub fn set_shndx(&mut self, shndx: Elf64Section)
[src]
Set a section table index includes this symbol.
Examples
use elf_utilities::symbol::Symbol64; let mut null_sym : Symbol64 = Default::default(); null_sym.set_shndx(1); assert_eq!(null_sym.get_shndx(), 1);
pub fn set_value(&mut self, value: Elf64Addr)
[src]
Set symbol value to Symbol64
Examples
use elf_utilities::symbol::Symbol64; let mut null_sym : Symbol64 = Default::default(); null_sym.set_value(1); assert_eq!(null_sym.get_value(), 1);
pub fn set_size(&mut self, size: Elf64Xword)
[src]
Set symbol binary size to Symbol64
Examples
use elf_utilities::symbol::Symbol64; let mut null_sym : Symbol64 = Default::default(); null_sym.set_size(0x40); assert_eq!(null_sym.get_size(), 64);
pub fn get_name(&self) -> Elf64Word
[src]
Get the symbol name index.
pub fn get_info(&self) -> u8
[src]
Get this symbol's information.
pub fn get_other(&self) -> u8
[src]
Get this symbol's visibility.
pub fn get_shndx(&self) -> Elf64Section
[src]
Get a section table index that related with this symbol.
pub fn get_value(&self) -> Elf64Addr
[src]
Get this symbol's value.
pub fn get_size(&self) -> Elf64Xword
[src]
Get this symbol's size.
pub fn to_le_bytes(&self) -> Vec<u8>
[src]
Create Vec
Examples
use elf_utilities::symbol::Symbol64; let null_sym : Symbol64 = Default::default(); assert_eq!([0].repeat(Symbol64::size() as usize), null_sym.to_le_bytes());
Trait Implementations
impl Clone for Symbol64
[src]
impl Debug for Symbol64
[src]
impl Default for Symbol64
[src]
impl Eq for Symbol64
[src]
impl Ord for Symbol64
[src]
fn cmp(&self, other: &Symbol64) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Symbol64> for Symbol64
[src]
impl PartialOrd<Symbol64> for Symbol64
[src]
fn partial_cmp(&self, other: &Symbol64) -> Option<Ordering>
[src]
fn lt(&self, other: &Symbol64) -> bool
[src]
fn le(&self, other: &Symbol64) -> bool
[src]
fn gt(&self, other: &Symbol64) -> bool
[src]
fn ge(&self, other: &Symbol64) -> bool
[src]
impl StructuralEq for Symbol64
[src]
impl StructuralPartialEq for Symbol64
[src]
Auto Trait Implementations
impl RefUnwindSafe for Symbol64
impl Send for Symbol64
impl Sync for Symbol64
impl Unpin for Symbol64
impl UnwindSafe for Symbol64
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,