diff options
| author | Roland Reichwein <mail@reichwein.it> | 2020-03-29 18:30:04 +0200 | 
|---|---|---|
| committer | Roland Reichwein <mail@reichwein.it> | 2020-03-29 18:30:04 +0200 | 
| commit | 6154309f0cd3ed5071996951465808f2503e2eb1 (patch) | |
| tree | b1666eea410e859f814ae47ca47b8b2d7d333c50 /elf.cpp | |
| parent | b0cac4997b5767526b29187fecf2a87aa1b0ebef (diff) | |
mcc produces first dummy executable
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) | 
