mirror of
git://repo.or.cz/tinycc.git
synced 2026-06-17 15:44:18 +08:00
win32: improve tccrun protection diagnostics
Report VirtualProtect failures with a Windows-specific -run diagnostic. On Win64, also treat RtlAddFunctionTable failure as an error so unwind registration problems are visible.
This commit is contained in:
parent
1a54e47dda
commit
601a088214
11
tccrun.c
11
tccrun.c
@ -427,7 +427,11 @@ redo:
|
||||
}
|
||||
if (protect_pages((void*)addr, n, f) < 0)
|
||||
return tcc_error_noabort(
|
||||
#ifdef _WIN32
|
||||
"VirtualProtect failed");
|
||||
#else
|
||||
"mprotect failed (did you mean to configure --with-selinux?)");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -502,11 +506,14 @@ static void *win64_add_function_table(TCCState *s1)
|
||||
void *p = NULL;
|
||||
if (s1->uw_pdata) {
|
||||
p = (void*)s1->uw_pdata->sh_addr;
|
||||
RtlAddFunctionTable(
|
||||
if (!RtlAddFunctionTable(
|
||||
(RUNTIME_FUNCTION*)p,
|
||||
s1->uw_pdata->data_offset / sizeof (RUNTIME_FUNCTION),
|
||||
s1->pe_imagebase
|
||||
);
|
||||
)) {
|
||||
tcc_error_noabort("RtlAddFunctionTable failed");
|
||||
p = NULL;
|
||||
}
|
||||
s1->uw_pdata = NULL;
|
||||
}
|
||||
return p;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user