Skip to content

Commit

Permalink
Add CustomRPXLoader to every OSFatal
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Jun 16, 2023
1 parent 3e42af8 commit a0f49da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ uint32_t do_start(int argc, char **argv) {
std::vector<RelocationData> 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());
Expand Down
8 changes: 4 additions & 4 deletions src/module/ModuleDataFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ std::vector<RelocationData> 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()]);
Expand All @@ -217,7 +217,7 @@ std::vector<RelocationData> 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 {};
}

Expand Down Expand Up @@ -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()]);
Expand All @@ -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 {};
}

Expand Down

0 comments on commit a0f49da

Please sign in to comment.