#[repr(C)]pub struct Symbol64 {
pub st_name: Elf64Word,
pub st_info: u8,
pub st_other: u8,
pub st_shndx: Elf64Section,
pub st_value: Elf64Addr,
pub st_size: Elf64Xword,
pub symbol_name: String,
}
Expand description
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!(Symbol64::SIZE, sym_bytes.len())
Fields§
§st_name: Elf64Word
Symbol name index.
st_info: u8
Information that includes symbol binds and symbol types. symbol typeやsymbol bindを使用する際は,対応するメソッドを使用することを推奨する.
st_other: u8
Symbol’s visibility. See Visibility.
st_shndx: Elf64Section
A section table index that includes the symbol.
st_value: Elf64Addr
Symbol’s value.
st_size: Elf64Xword
Symbol’s size.
symbol_name: String
option member for utilities.
Implementations§
Source§impl Symbol64
impl Symbol64
pub const SIZE: usize = 24usize
Sourcepub fn new_null_symbol() -> Self
pub fn new_null_symbol() -> Self
NULLシンボルの作成
Sourcepub fn compare_by<P>(&self, predicate: P) -> bool
pub fn compare_by<P>(&self, predicate: P) -> bool
for utilities
pub fn get_type(&self) -> Type
pub fn get_bind(&self) -> Bind
pub fn get_visibility(&self) -> Visibility
Sourcepub fn set_info(&mut self, sym_type: Type, bind: Bind)
pub fn set_info(&mut self, sym_type: Type, bind: Bind)
Set symbol’s information to Symbol64
§Examples
use elf_utilities::symbol;
let mut null_sym = symbol::Symbol64::new_null_symbol();
null_sym.set_info(symbol::Type::Func, symbol::Bind::Global);
assert_eq!((1 << 4) | 2, null_sym.st_info);
Sourcepub fn to_le_bytes(&self) -> Vec<u8> ⓘ
pub fn to_le_bytes(&self) -> Vec<u8> ⓘ
Create Vec
§Examples
use elf_utilities::symbol::Symbol64;
let null_sym : Symbol64 = Default::default();
assert_eq!([0].repeat(Symbol64::SIZE), null_sym.to_le_bytes());
pub fn deserialize(buf: &[u8], start: usize) -> Result<Self, Box<dyn Error>>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Symbol64
impl<'de> Deserialize<'de> for Symbol64
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Symbol64
impl Ord for Symbol64
Source§impl PartialOrd for Symbol64
impl PartialOrd for Symbol64
impl Eq for Symbol64
impl StructuralPartialEq for Symbol64
Auto Trait Implementations§
impl Freeze for Symbol64
impl RefUnwindSafe for Symbol64
impl Send for Symbol64
impl Sync for Symbol64
impl Unpin for Symbol64
impl UnwindSafe for Symbol64
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more