summaryrefslogtreecommitdiffhomepage
path: root/elf.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-03-29 16:14:55 +0200
committerRoland Reichwein <mail@reichwein.it>2020-03-29 16:14:55 +0200
commitb7e53bf9d091874d8028b37f6e4940b504cc9234 (patch)
tree44b223d52e889704b0205ac8fc6da728de27f29e /elf.h
parent9d3f2b289563cb7c845c8a35cb0e7553b21f85e2 (diff)
Code and data segment
Diffstat (limited to 'elf.h')
-rw-r--r--elf.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/elf.h b/elf.h
index abcbca0..260f86f 100644
--- a/elf.h
+++ b/elf.h
@@ -42,10 +42,10 @@ struct FileHeader
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_phnum{2}; // program headers: .text, .data
uint16_t e_shentsize{0x40}; // size of section header
- uint16_t e_shnum{3}; // number of section headers
- uint16_t e_shstrndx{2}; // 1st section header contains section names
+ uint16_t e_shnum{4}; // number of section headers
+ uint16_t e_shstrndx{3}; // 1st section header contains section names
};
// Segment
@@ -76,7 +76,7 @@ struct SectionHeader
};
#pragma pack(pop)
-void Write(const std::filesystem::path& path, const std::vector<uint8_t>&);
+void Write(const std::filesystem::path& path, const std::vector<uint8_t>& code, const std::vector<uint8_t>& data);
std::vector<uint8_t> Read(const std::filesystem::path& path);
}