summaryrefslogtreecommitdiff
path: root/src/elf.rs
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-11-05 11:43:27 -0400
committerpommicket <pommicket@gmail.com>2022-11-05 11:43:27 -0400
commitbae6a477b04f7a767678c88089e28dd9e5c5b879 (patch)
treeeeb29337826fc89d5ad0179598fb99719faf5405 /src/elf.rs
parentbd54f4f57a56de5b2d8b80949acfd499a62a0bbf (diff)
cleaned up code a bit
Diffstat (limited to 'src/elf.rs')
-rw-r--r--src/elf.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/elf.rs b/src/elf.rs
index 1f9f0dd..23dd246 100644
--- a/src/elf.rs
+++ b/src/elf.rs
@@ -31,7 +31,7 @@ pub const DT_SYMENT: u32 = 11;
pub const DT_REL: u32 = 17;
pub const DT_RELSZ: u32 = 18;
pub const DT_RELENT: u32 = 19;
-
+
pub const PT_DYNAMIC: u32 = 2;
pub const PT_INTERP: u32 = 3;
@@ -123,7 +123,7 @@ impl Ehdr32 {
pub fn size_of() -> usize {
mem::size_of::<Self>()
}
-
+
pub fn section_offset(&self, ndx: u16) -> u64 {
ndx as u64 * self.shentsize as u64 + self.shoff as u64
}
@@ -205,20 +205,19 @@ pub struct Rel32 {
}
macro_rules! impl_bytes {
- ($r#type: ident, $n: literal) => {
- impl FromBytes<$n> for $r#type {
+ ($type: ident, $n: literal) => {
+ impl FromBytes<$n> for $type {
fn from_bytes(bytes: [u8; $n]) -> Self {
unsafe { mem::transmute(bytes) }
}
}
-
- impl ToBytes<$n> for $r#type {
+
+ impl ToBytes<$n> for $type {
fn to_bytes(self) -> [u8; $n] {
unsafe { mem::transmute(self) }
}
}
-
- }
+ };
}
impl_bytes!(Ehdr32, 0x34);