From a0f49dab937c206be570fac9c0bf852add313993 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 16 Jun 2023 17:12:35 +0200 Subject: [PATCH] Add CustomRPXLoader to every OSFatal --- src/dynamic.c | 6 +++--- src/main.cpp | 2 +- src/module/ModuleDataFactory.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dynamic.c b/src/dynamic.c index 79a56dc..70078e7 100644 --- a/src/dynamic.c +++ b/src/dynamic.c @@ -11,9 +11,9 @@ #undef IMPORT_BEGIN #undef IMPORT_END -#define IMPORT(name) \ - do { \ - if (OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0) OSFatal("Function " #name " is NULL"); \ +#define IMPORT(name) \ + do { \ + if (OSDynLoad_FindExport(handle, 0, #name, &addr_##name) < 0) OSFatal("CustomRPXLoader: Function " #name " is NULL"); \ } while (0) #define IMPORT_BEGIN(lib) OSDynLoad_Acquire(#lib ".rpl", &handle) /* #define IMPORT_END() OSDynLoad_Release(handle) */ diff --git a/src/main.cpp b/src/main.cpp index fc2f6c2..7154d49 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -119,7 +119,7 @@ uint32_t do_start(int argc, char **argv) { std::vector relocData = moduleData->getRelocationDataList(); if (!doRelocation(relocData, gModuleData->trampolines, DYN_LINK_TRAMPOLIN_LIST_LENGTH)) { DEBUG_FUNCTION_LINE("relocations failed"); - OSFatal("Relocations failed"); + OSFatal("CustomRPXLoader: Relocations failed"); } if (moduleData->getBSSAddr() != 0) { DEBUG_FUNCTION_LINE("memset .bss %08X (%d)", moduleData->getBSSAddr(), moduleData->getBSSSize()); diff --git a/src/module/ModuleDataFactory.cpp b/src/module/ModuleDataFactory.cpp index 3c93981..8a610b7 100644 --- a/src/module/ModuleDataFactory.cpp +++ b/src/module/ModuleDataFactory.cpp @@ -203,7 +203,7 @@ std::vector ModuleDataFactory::getImportRelocationData(const elf Elf64_Addr sym_value; if (!rel.get_entry(j, offset, symbol, type, addend)) { - OSFatal("Failed to get relocation"); + OSFatal("CustomRPXLoader: get_entry failed"); return {}; } symbol_section_accessor symbols(reader, reader.sections[(Elf_Half) psec->get_link()]); @@ -217,7 +217,7 @@ std::vector ModuleDataFactory::getImportRelocationData(const elf if (!symbols.get_symbol(symbol, sym_name, sym_value, size, bind, symbolType, sym_section_index, other)) { - OSFatal("Failed to get relocation"); + OSFatal("CustomRPXLoader: get_symbol failed"); return {}; } @@ -261,7 +261,7 @@ bool ModuleDataFactory::linkSection(const elfio &reader, uint32_t section_index, Elf64_Addr sym_value; if (!rel.get_entry(j, offset, symbol, type, addend)) { - OSFatal("Failed to get relocation"); + OSFatal("CustomRPXLoader: get_entry failed"); return {}; } symbol_section_accessor symbols(reader, reader.sections[(Elf_Half) psec->get_link()]); @@ -275,7 +275,7 @@ bool ModuleDataFactory::linkSection(const elfio &reader, uint32_t section_index, if (!symbols.get_symbol(symbol, sym_name, sym_value, size, bind, symbolType, sym_section_index, other)) { - OSFatal("Failed to get relocation"); + OSFatal("CustomRPXLoader: get_symbol failed"); return {}; }