diff options
Diffstat (limited to 'elf.cpp')
-rw-r--r-- | elf.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,6 +1,7 @@ #include "elf.h" #include "file.h" +#include "minicc.h" #include <iostream> @@ -156,8 +157,8 @@ namespace { { if (elf.size() < size) { elf.resize(size); - } else - throw std::runtime_error("Padding not possible. Too many bytes already."); + } else if (elf.size() > size) + throw std::runtime_error("Padding not possible. Too many bytes already. ("s + std::to_string(elf.size()) + " > "s + std::to_string(size) + ")"s); } } @@ -195,6 +196,8 @@ void Elf::Write(const std::filesystem::path& path, const std::vector<uint8_t>& c AddSectionHeaderSectionNames(elf, code, data); File::setFile(path, elf); + + fs::permissions(path, fs::perms::owner_exec | fs::perms::group_exec | fs::perms::others_exec, fs::perm_options::add); } std::vector<uint8_t> Elf::Read(const std::filesystem::path& path) |