summaryrefslogtreecommitdiff
path: root/src/elf.rs
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-11-04 15:26:44 -0400
committerpommicket <pommicket@gmail.com>2022-11-04 15:26:44 -0400
commit273f02cd789c18346fb74021773c681405995c33 (patch)
tree44159a7de5628007983827e154a2a0e4ac2c6e9b /src/elf.rs
parent05de0fe271024ba67aa265974bc4d456dbfa3eba (diff)
nice Executable struct (not working yet)
Diffstat (limited to 'src/elf.rs')
-rw-r--r--src/elf.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/elf.rs b/src/elf.rs
index 8d714c4..aeeecc9 100644
--- a/src/elf.rs
+++ b/src/elf.rs
@@ -112,8 +112,8 @@ impl Default for Ehdr32 {
}
impl Ehdr32 {
- pub fn offsetof_entry(&self) -> usize {
- 0x18
+ pub fn size_of() -> usize {
+ mem::size_of::<Self>()
}
pub fn section_offset(&self, ndx: u16) -> u64 {
@@ -172,6 +172,10 @@ impl Default for Phdr32 {
}
impl Phdr32 {
+ pub fn size_of() -> usize {
+ mem::size_of::<Self>()
+ }
+
pub fn to_bytes(self) -> [u8; 0x20] {
unsafe { mem::transmute(self) }
}