Skip to content

Commit

Permalink
WIP: Include symbol name in relocation error
Browse files Browse the repository at this point in the history
Need some kind of check on the length of ptr->name
(cf. cannot_resolve_msg)
  • Loading branch information
dra27 committed Dec 30, 2024
1 parent 20599e3 commit 3dc05ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions flexdll.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,17 +371,17 @@ static void relocate(resolver f, void *data, reloctbl *tbl, void **jmptbl, err_t
retry:
if (s != (INT32) s) {
if (!jmptbl) {
sprintf(err->message, "flexdll error: cannot relocate RELOC_%s, target is too far: %p %p",
reloc_type, (void *)((UINT_PTR) s), (void *) ((UINT_PTR)(INT32) s));
sprintf(err->message, "flexdll error: cannot relocate %s RELOC_%s, target is too far: %p %p",
ptr->name, reloc_type, (void *)((UINT_PTR) s), (void *) ((UINT_PTR)(INT32) s));
err->code = 3;
return;
}
if (!sym->trampoline) {
void* trampoline;
/* trampolines cannot be created for data */
if (VirtualQuery(sym->addr, &info, sizeof(info)) && !(info.Protect & 0xf0)) {
sprintf(err->message, "flexdll error: cannot relocate RELOC_%s, target is too far, and not executable: %p %p",
reloc_type, (void *)((UINT_PTR) s), (void *) ((UINT_PTR)(INT32) s));
sprintf(err->message, "flexdll error: cannot relocate %s RELOC_%s, target is too far, and not executable: %p %p",
ptr->name, reloc_type, (void *)((UINT_PTR) s), (void *) ((UINT_PTR)(INT32) s));
err->code = 3;
return;
}
Expand Down

0 comments on commit 3dc05ee

Please sign in to comment.