summaryrefslogtreecommitdiff
path: root/src/elf.rs
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-10-31 20:59:02 -0400
committerpommicket <pommicket@gmail.com>2022-10-31 20:59:02 -0400
commit39c39f5bb7e767a6b5ef76f2d5221a7c8fcb3a4a (patch)
tree79f57f7b4d7d16dc12642696a7e7c47981eb2f3c /src/elf.rs
parentf0d5707492aa04808ce7bce44b405735424aeab4 (diff)
more relocation
Diffstat (limited to 'src/elf.rs')
-rw-r--r--src/elf.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/elf.rs b/src/elf.rs
index aa9b3f5..23c267f 100644
--- a/src/elf.rs
+++ b/src/elf.rs
@@ -2,9 +2,43 @@
use std::{io, mem};
+// executable type
pub const ET_REL: u16 = 1;
pub const ET_EXEC: u16 = 2;
+#[allow(unused)]
+pub const SHT_PROGBITS: u32 = 1; // Program data
+#[allow(unused)]
+pub const SHT_SYMTAB: u32 = 2; // Symbol table
+#[allow(unused)]
+pub const SHT_STRTAB: u32 = 3; // String table
+#[allow(unused)]
+pub const SHT_RELA: u32 = 4; // Relocation entries with addends
+#[allow(unused)]
+pub const SHT_HASH: u32 = 5; // Symbol hash table
+#[allow(unused)]
+pub const SHT_DYNAMIC: u32 = 6; // Dynamic linking information
+#[allow(unused)]
+pub const SHT_NOTE: u32 = 7; // Notes
+#[allow(unused)]
+pub const SHT_NOBITS: u32 = 8; // Program space with no data (bss)
+#[allow(unused)]
+pub const SHT_REL: u32 = 9; // Relocation entries, no addends
+
+// symbol type
+pub const STT_OBJECT: u8 = 1;
+pub const STT_FUNC: u8 = 2;
+
+// symbol bind
+pub const STB_LOCAL: u8 = 0;
+pub const STB_GLOBAL: u8 = 1;
+pub const STB_WEAK: u8 = 2;
+
+// section number (for relocations)
+pub const SHN_UNDEF: u16 = 0;
+pub const SHN_ABS: u16 = 0xfff1;
+pub const SHN_COMMON: u16 = 0xfff2;
+
#[repr(C)]
pub struct Header32 {
pub ident: [u8; 4],