summaryrefslogtreecommitdiff
path: root/api/elf/elf.h
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2021-03-17 12:38:27 +0000
committerAda Christine <adachristine18@gmail.com>2021-03-17 12:38:27 +0000
commit53ca88735db910c746d6190cca39fcd70d66b650 (patch)
treeab0da3a88009f0ddf0e6e2634d0962c364393203 /api/elf/elf.h
initial commit
Diffstat (limited to 'api/elf/elf.h')
-rw-r--r--api/elf/elf.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/api/elf/elf.h b/api/elf/elf.h
new file mode 100644
index 0000000..3d82bc0
--- /dev/null
+++ b/api/elf/elf.h
@@ -0,0 +1,83 @@
+#pragma once
+
+#include <stdint.h>
+
+typedef uint8_t Elf_Byte;
+
+#define EI_MAG0 0
+#define EI_MAG1 1
+#define EI_MAG2 2
+#define EI_MAG3 3
+#define EI_CLASS 4
+#define EI_DATA 5
+#define EI_VERSION 6
+#define EI_OSABI 7
+#define EI_ABIVERSION 8
+#define EI_PAD 9
+#define EI_NIDENT 16
+
+#define ELFMAG0 0x7f
+#define ELFMAG1 'E'
+#define ELFMAG2 'L'
+#define ELFMAG3 'F'
+
+#define ELFCLASSNONE 0
+#define ELFCLASS32 1
+#define ELFCLASS64 2
+
+#define ELFDATANONE 0
+#define ELFDATA2LSB 1
+#define ELFDATA2MSB 2
+
+#define EI_VERSION 6
+#define EV_NONE 0
+#define EV_CURRENT 1
+
+#define ELFOSABI_NONE 0
+#define ELFOSABI_SYSV EI_OSABI_NONE
+
+#define ET_NONE 0
+#define ET_REL 1
+#define ET_EXEC 2
+#define ET_DYN 3
+#define ET_CORE 4
+#define ET_LOOS 0xfe00
+#define ET_HIOS 0xfeff
+
+#define EM_NONE 0
+
+#define PT_NULL 0
+#define PT_LOAD 1
+#define PT_DYNAMIC 2
+
+#define PF_X 0x01
+#define PF_W 0x02
+#define PF_R 0x04
+
+#define SHT_NULL 0
+#define SHT_PROGITS 1
+#define SHT_SYMTAB 2
+#define SHT_STRTAB 3
+#define SHT_RELA 4
+#define SHT_HASH 5
+#define SHT_DYNAMIC 6
+
+#define SHF_WRITE 0x1
+#define SHF_ALLOC 0x2
+#define SHF_EXEC 0x4
+#define SHF_MERGE 0x10
+#define SHF_STRINGS 0x20
+
+#define DT_NULL 0
+#define DT_NEEDED 1
+#define DT_PLTRELSZ 2
+#define DT_PLTGOT 3
+#define DT_HASH 4
+#define DT_STRTAB 5
+#define DT_SYMTAB 6
+#define DT_RELA 7
+#define DT_RELASZ 8
+#define DT_RELAENT 9
+#define DT_STRSZ 10
+#define DT_SYMENT 11
+