remove magic_enum wrappers

Co-authored-by: Saadi <cosxmos@gmail.com>
This commit is contained in:
nmzik
2026-09-17 19:39:23 +04:00
parent c66d977c1d
commit cc8e02380f
9 changed files with 31 additions and 75 deletions
+11 -11
View File
@@ -6,7 +6,6 @@
#include "common/file.h"
#include "common/hostException.h"
#include "common/logging/log.h"
#include "common/magicEnum.h"
#include "common/platform/sysDbg.h"
#include "common/profiler.h"
#include "common/singleton.h"
@@ -29,6 +28,7 @@
#include <cstdlib>
#include <cstring>
#include <fmt/format.h>
#include <magic_enum.hpp>
#include <memory>
#include <vector>
@@ -330,7 +330,7 @@ static KYTY_SYSV_ABI uint64_t ResolveImportStubWithId(uint64_t record_id) {
LOGF("Unresolved import stub called [%u]: patch_vaddr=0x%016" PRIx64
" jmprela_index=%" PRIu32 " symbol=%s type=%s bind=%s program=%s\n",
log_index, record.patch_vaddr, record.index, record.name.c_str(),
Common::EnumName(record.type).c_str(), Common::EnumName(record.bind).c_str(),
magic_enum::enum_name(record.type), magic_enum::enum_name(record.bind),
record.program.c_str());
} else {
printf("Unresolved import stub called: <bad-record>\n");
@@ -1046,8 +1046,8 @@ static void RelocateRecord(uint32_t index, Elf64_Rela* r, Program* program, bool
patched = PatchGuestMemory64(ri.vaddr, value);
} else {
auto dbg_str = fmt::format("[{:016x}] <- {:016x}, {}, {}, {}, {}", ri.vaddr, ri.value,
ri.name.c_str(), Common::EnumName(ri.type).c_str(),
Common::EnumName(ri.bind).c_str(), ri.dbg_name.c_str());
ri.name.c_str(), magic_enum::enum_name(ri.type),
magic_enum::enum_name(ri.bind), ri.dbg_name.c_str());
if (unresolved != nullptr) {
unresolved->push_back(dbg_str);
@@ -1077,14 +1077,14 @@ static void RelocateRecord(uint32_t index, Elf64_Rela* r, Program* program, bool
const auto thunk = RegisterStubbedImport(index, program, ri);
LOGF("Relocate: unresolved PLT import patched to stub [%u] [%016" PRIx64 "] <- %016" PRIx64
", %s, %s, %s, %s\n",
index, ri.vaddr, thunk, ri.name.c_str(), Common::EnumName(ri.type).c_str(),
Common::EnumName(ri.bind).c_str(), Common::PathToString(program->file_name).c_str());
index, ri.vaddr, thunk, ri.name.c_str(), magic_enum::enum_name(ri.type),
magic_enum::enum_name(ri.bind), Common::PathToString(program->file_name).c_str());
} else if (patched && stubbed_func) {
const auto thunk = RegisterStubbedImport(index, program, ri);
LOGF("Relocate: unresolved non-PLT function patched to stub [%u] [%016" PRIx64
"] <- %016" PRIx64 ", %s, %s, %s, %s\n",
index, ri.vaddr, thunk, ri.name.c_str(), Common::EnumName(ri.type).c_str(),
Common::EnumName(ri.bind).c_str(), Common::PathToString(program->file_name).c_str());
index, ri.vaddr, thunk, ri.name.c_str(), magic_enum::enum_name(ri.type),
magic_enum::enum_name(ri.bind), Common::PathToString(program->file_name).c_str());
}
if (program->dbg_print_reloc) {
@@ -1092,8 +1092,8 @@ static void RelocateRecord(uint32_t index, Elf64_Rela* r, Program* program, bool
(ri.bind == BindType::Global || ri.bind == BindType::Weak ||
ri.type == SymbolType::TlsModule)) {
auto dbg_str = fmt::format("[{:016x}] <- {:016x}, {}, {}, {}, {}", ri.vaddr, ri.value,
ri.name.c_str(), Common::EnumName(ri.type).c_str(),
Common::EnumName(ri.bind).c_str(), ri.dbg_name.c_str());
ri.name.c_str(), magic_enum::enum_name(ri.type),
magic_enum::enum_name(ri.bind), ri.dbg_name.c_str());
LOGF("Relocate: %s\n", dbg_str.c_str());
}
@@ -2082,7 +2082,7 @@ void RuntimeLinker::LoadProgramToMemory(Program* program) {
"[%d] memory_size = %" PRIu64 "\n"
"[%d] mode = %s\n",
i, segment_addr, i, segment_file_size, i, segment_memory_size, i,
Common::EnumName(mode).c_str());
magic_enum::enum_name(mode));
program->elf->LoadSegment(segment_addr, phdr[i].p_offset, segment_file_size);