aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjanus.lt <janus.lt>2017-11-04 00:16:37 +0100
committerjanus.lt <janus.lt>2017-11-04 00:18:37 +0100
commit32c9b51401c13fba9f0e2d2a4e791cdc9116143c (patch)
treebe2350affca2e3ce06fb17ae91f4ec3378a6051d
parentfc0188ffbcf29f856caedee8cef07d88be01e439 (diff)
downloadtinycc-32c9b51401c13fba9f0e2d2a4e791cdc9116143c.tar.gz
tinycc-32c9b51401c13fba9f0e2d2a4e791cdc9116143c.tar.bz2
Win64/PE: Changed runtime function unwind info to be added after relocation, fixes SEH + long jmps
-rw-r--r--tccrun.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tccrun.c b/tccrun.c
index b9a052b..d0501a0 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -247,10 +247,6 @@ static int tcc_relocate_ex(TCCState *s1, void *ptr, addr_t ptr_diff)
}
relocate_plt(s1);
-#ifdef _WIN64
- *(void**)ptr = win64_add_function_table(s1);
-#endif
-
for(i = 1; i < s1->nb_sections; i++) {
s = s1->sections[i];
if (0 == (s->sh_flags & SHF_ALLOC))
@@ -267,6 +263,11 @@ static int tcc_relocate_ex(TCCState *s1, void *ptr, addr_t ptr_diff)
if (s->sh_flags & SHF_EXECINSTR)
set_pages_executable((char*)ptr + ptr_diff, length);
}
+
+#ifdef _WIN64
+ *(void**)mem = win64_add_function_table(s1);
+#endif
+
return 0;
}