diff options
| author | grischka <grischka> | 2011-07-14 19:09:49 +0200 |
|---|---|---|
| committer | grischka <grischka> | 2011-07-14 19:09:49 +0200 |
| commit | df4c0892f3fb5170042652cd648a29c94c3a2eca (patch) | |
| tree | 0db41a085d08276f9804b4905949c60ff1f7500f /tccrun.c | |
| parent | 232650f8b3a786e82071c12a1ee8eea60684279a (diff) | |
| download | tinycc-df4c0892f3fb5170042652cd648a29c94c3a2eca.tar.gz tinycc-df4c0892f3fb5170042652cd648a29c94c3a2eca.tar.bz2 | |
tccrun: win64: add unwind function table for dynamic code
This works only when tcc.exe is compiled using MSC. MinGW does
something in the startup code that defeats it.
Diffstat (limited to 'tccrun.c')
| -rw-r--r-- | tccrun.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -30,6 +30,10 @@ static int rt_get_caller_pc(uplong *paddr, ucontext_t *uc, int level); static void rt_error(ucontext_t *uc, const char *fmt, ...); static int tcc_relocate_ex(TCCState *s1, void *ptr); +#ifdef _WIN64 +static void win64_add_function_table(TCCState *s1); +#endif + /* ------------------------------------------------------------- */ /* Do all relocations (needed before using tcc_get_symbol()) Returns -1 on error. */ @@ -189,6 +193,10 @@ static int tcc_relocate_ex(TCCState *s1, void *ptr) set_pages_executable(s1->runtime_plt_and_got, s1->runtime_plt_and_got_offset); #endif + +#ifdef _WIN64 + win64_add_function_table(s1); +#endif return 0; } @@ -579,6 +587,17 @@ static void set_exception_handler(void) } #ifdef _WIN64 +static void win64_add_function_table(TCCState *s1) +{ + RtlAddFunctionTable( + (RUNTIME_FUNCTION*)(uplong)s1->uw_pdata->sh_addr, + s1->uw_pdata->data_offset / sizeof (RUNTIME_FUNCTION), + (uplong)text_section->sh_addr + ); +} +#endif + +#ifdef _WIN64 #define Eip Rip #define Ebp Rbp #endif |
