From ee705369b034475d9f0c0a036585894f4daa82c9 Mon Sep 17 00:00:00 2001 From: Christopher Cole Date: Thu, 26 Jan 2023 13:06:13 -0800 Subject: [PATCH] Add C-style definitions for Elf[32|64]_Sym --- src/symbol.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/symbol.rs b/src/symbol.rs index aa26c87..65deee2 100644 --- a/src/symbol.rs +++ b/src/symbol.rs @@ -6,6 +6,32 @@ use crate::parse::{ParseAt, ParseError, ParsingTable}; pub type SymbolTable<'data, E> = ParsingTable<'data, E, Symbol>; +/// C-style 32-bit ELF Symbol definition +/// +/// These C-style definitions are for users who want to implement their own ELF manipulation logic. +#[repr(C)] +pub struct Elf32_Sym { + pub st_name: u32, + pub st_value: u32, + pub st_size: u32, + pub st_info: u8, + pub st_other: u8, + pub st_shndx: u32, +} + +/// C-style 64-bit ELF Symbol definition +/// +/// These C-style definitions are for users who want to implement their own ELF manipulation logic. +#[repr(C)] +pub struct Elf64_Sym { + pub st_name: u32, + pub st_info: u8, + pub st_other: u8, + pub st_shndx: u16, + pub st_value: u64, + pub st_size: u64, +} + #[derive(Debug, Clone, PartialEq, Eq)] pub struct Symbol { /// This member holds an index into the symbol table's string table,