[][src]Struct elf_utilities::symbol::Symbol32

#[repr(C)]pub struct Symbol32 {
    pub st_name: Elf32Word,
    pub st_value: Elf32Addr,
    pub st_size: Elf32Word,
    pub st_info: u8,
    pub st_other: u8,
    pub st_shndx: Elf32Section,
    pub symbol_name: Option<String>,
}

Symbol32 is a entry of symbol table section.

Symbol32 はシンボルテーブルセクションのエントリである. ELF32で用いることを想定している.

Defaultトレイトを実装しているので, Default::default() を呼び出すことで簡単にNULLシンボルを作成できる.

Examples

use elf_utilities::symbol::Symbol32;
let null_sym : Symbol32 = Default::default();

// Symbol32::new_null_symbol() のエイリアスでも作成可能.
let null_sym2 : Symbol32 = Symbol32::new_null_symbol();

assert_eq!(null_sym, null_sym2);

ELFファイルを生成する用途でこのライブラリを使用できるように, バイト列への変換もサポートしている.

Examples

use elf_utilities::symbol::Symbol32;
let null_sym : Symbol32 = Default::default();

// to_le_bytes() を利用してバイト列に変換できる.
let sym_bytes = null_sym.to_le_bytes();
assert_eq!(Symbol32::size() as usize, sym_bytes.len())

Fields

st_name: Elf32Word

Symbol name index.

st_value: Elf32Addr

Symbol's value.

st_size: Elf32Word

Symbol's size.

st_info: u8

Information that includes symbol binds and symbol types.

st_other: u8

Symbol's visibility. See symbol::VISIBILITY.

st_shndx: Elf32Section

A section table index that includes the symbol.

symbol_name: Option<String>

option member for utilities.

Implementations

impl Symbol32[src]

pub fn new_null_symbol() -> Self[src]

pub fn size() -> Elf32Xword[src]

size() provides Symbol32's size used by Shdr32.sh_entsize or else.

pub fn compare_by<P>(&self, predicate: P) -> bool where
    P: Fn(&Self) -> bool
[src]

for utilities

pub fn get_type(&self) -> Type[src]

pub fn get_bind(&self) -> Bind[src]

pub fn get_visibility(&self) -> Visibility[src]

pub fn set_info(&mut self, sym_type: Type, bind: Bind)[src]

Set symbol's information to Symbol32

Examples

use elf_utilities::symbol;
let mut null_sym = symbol::Symbol32::new_null_symbol();

null_sym.set_info(symbol::Type::Func, symbol::Bind::Global);

assert_eq!((1 << 4) | 2, null_sym.st_info);

pub fn to_le_bytes(&self) -> Vec<u8>[src]

Create Vec from Symbol32's each fields.

Examples

use elf_utilities::symbol::Symbol32;
let null_sym : Symbol32 = Default::default();

assert_eq!([0].repeat(Symbol32::size() as usize), null_sym.to_le_bytes());

pub fn deserialize(buf: &[u8], start: usize) -> Result<Self, Box<dyn Error>>[src]

Trait Implementations

impl Clone for Symbol32[src]

impl Debug for Symbol32[src]

impl Default for Symbol32[src]

impl<'de> Deserialize<'de> for Symbol32[src]

impl Eq for Symbol32[src]

impl Hash for Symbol32[src]

impl Ord for Symbol32[src]

impl PartialEq<Symbol32> for Symbol32[src]

impl PartialOrd<Symbol32> for Symbol32[src]

impl Serialize for Symbol32[src]

impl StructuralEq for Symbol32[src]

impl StructuralPartialEq for Symbol32[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.