adds namespaces for ELFIO

This commit is contained in:
2024-09-23 11:51:32 +02:00
parent 62768bf81e
commit 2f3abf2f76
4 changed files with 18 additions and 14 deletions

View File

@@ -319,7 +319,8 @@ struct riscv_hart_common {
uint64_t tohost = tohost_dflt;
uint64_t fromhost = fromhost_dflt;
bool read_elf_file(std::string name, uint8_t expected_elf_class, std::function<iss::status(uint64_t, uint64_t, const uint8_t* const)> cb) {
bool read_elf_file(std::string name, uint8_t expected_elf_class,
std::function<iss::status(uint64_t, uint64_t, const uint8_t* const)> cb) {
// Create elfio reader
ELFIO::elfio reader;
// Load ELF data
@@ -327,12 +328,12 @@ struct riscv_hart_common {
// check elf properties
if(reader.get_class() != expected_elf_class)
return false;
if(reader.get_type() != ET_EXEC)
return false;
if(reader.get_machine() != EM_RISCV)
if(reader.get_type() != ELFIO::ET_EXEC)
return false;
if(reader.get_machine() != ELFIO::EM_RISCV)
return false;
entry_address = reader.get_entry();
for(const auto pseg : reader.segments) {
for(const auto& pseg : reader.segments) {
const auto fsize = pseg->get_file_size(); // 0x42c/0x0
const auto seg_data = pseg->get_data();
const auto type = pseg->get_type();
@@ -343,7 +344,7 @@ struct riscv_hart_common {
}
}
const auto sym_sec = reader.sections[".symtab"];
if(SHT_SYMTAB == sym_sec->get_type() || SHT_DYNSYM == sym_sec->get_type()) {
if(ELFIO::SHT_SYMTAB == sym_sec->get_type() || ELFIO::SHT_DYNSYM == sym_sec->get_type()) {
ELFIO::symbol_section_accessor symbols(reader, sym_sec);
auto sym_no = symbols.get_symbols_num();
std::string name;