summaryrefslogtreecommitdiffhomepage
path: root/elf.h
diff options
context:
space:
mode:
Diffstat (limited to 'elf.h')
-rw-r--r--elf.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/elf.h b/elf.h
index 9d1ba69..abcbca0 100644
--- a/elf.h
+++ b/elf.h
@@ -29,7 +29,7 @@ struct FileHeader
2, // 64 bit
1, // little endian
1, // Version: default == 1
- 3, // Linux
+ 0, // SysV, 3=Linux
0, // EI_ABIVERSION
0,0,0,0,0,0,0 // pad
};
@@ -39,13 +39,13 @@ struct FileHeader
uint64_t e_entry{0x0000000000401000};
uint64_t e_phoff{0x40};
uint64_t e_shoff{}; // section header table offset
- uint32_t e_flags{0x00000112}; // EXEC_P, HAS_SYMS, D_PAGED
+ uint32_t e_flags{};
uint16_t e_ehsize{0x40}; // size of this header
uint16_t e_phentsize{0x38}; // size of program header
uint16_t e_phnum{1}; // 1 program header
uint16_t e_shentsize{0x40}; // size of section header
- uint16_t e_shnum{2}; // number of section headers
- uint16_t e_shstrndx{1}; // 1st section header contains section names
+ uint16_t e_shnum{3}; // number of section headers
+ uint16_t e_shstrndx{2}; // 1st section header contains section names
};
// Segment
@@ -53,12 +53,12 @@ struct ProgramHeader
{
uint32_t p_type{1}; // Loadable segment
uint32_t p_flags{5}; // X=1 | W=2 | R=4
- uint64_t p_offset{0x0}; // offset in file
+ uint64_t p_offset{}; // offset in file
uint64_t p_vaddr{0x401000}; // virtual address
uint64_t p_paddr{0x401000}; // physical address, not really relevant
uint64_t p_filesz{}; // size of segment in file, e.g. size of code
uint64_t p_memsz{}; // size of segment in memory
- uint64_t p_align{0}; // alignment
+ uint64_t p_align{}; // alignment
};
struct SectionHeader
@@ -67,7 +67,7 @@ struct SectionHeader
uint32_t sh_type{1}; // program data
uint64_t sh_flags{6}; // ALLOC, EXE
uint64_t sh_addr{0x401000}; // virtual address
- uint64_t sh_offset{0x1000};
+ uint64_t sh_offset{};
uint64_t sh_size{}; // section size
uint32_t sh_link{};
uint32_t sh_info{};