aboutsummaryrefslogtreecommitdiff
path: root/tccrun.c
diff options
context:
space:
mode:
authormob <mob>2012-02-26 19:02:51 -0600
committermob <mob>2012-02-26 19:02:51 -0600
commitd7a7c3769d0a1dcb8400258cd8adf78a8566de61 (patch)
tree1333ad336c0626f41ec5690ea9e34c908c967d60 /tccrun.c
parent6e13c35334200e7ef918308aeb820404d7b35283 (diff)
downloadtinycc-d7a7c3769d0a1dcb8400258cd8adf78a8566de61.tar.gz
tinycc-d7a7c3769d0a1dcb8400258cd8adf78a8566de61.tar.bz2
Multiple fixes for 64 bit sections
This changeset attempts to fix a few problems when giving using the high 32bits of a 64bit section offset. There are likely more issues (or perhaps regressions) lurking in the muck here. In general, this moves a few data type declarations to use uplong. Also, add support for 64bit mingw32 building under cygwin. Because native types are used for 64 bit offsets, this won't fix challenges with cross compiling from 32bit -> 64bit. Tested under cygwin, against binary compiled with -Wl,-Ttext=0xffffff8000000000 Signed-off-by: Andrew Mulbrook <andrew262@gmail.com>
Diffstat (limited to 'tccrun.c')
-rw-r--r--tccrun.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tccrun.c b/tccrun.c
index de0ef89..2ea3c49 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -36,10 +36,11 @@ 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
+#if defined TCC_TARGET_X86_64 && defined TCC_TARGET_PE
static void win64_add_function_table(TCCState *s1);
#endif
+
/* ------------------------------------------------------------- */
/* Do all relocations (needed before using tcc_get_symbol())
Returns -1 on error. */
@@ -193,7 +194,7 @@ static int tcc_relocate_ex(TCCState *s1, void *ptr)
s1->runtime_plt_and_got_offset);
#endif
-#ifdef _WIN64
+#if defined TCC_TARGET_X86_64 && defined TCC_TARGET_PE
win64_add_function_table(s1);
#endif
return 0;
@@ -621,7 +622,8 @@ static void set_exception_handler(void)
SetUnhandledExceptionFilter(cpu_exception_handler);
}
-#ifdef _WIN64
+#ifdef TCC_TARGET_PE
+#ifdef TCC_TARGET_X86_64
static void win64_add_function_table(TCCState *s1)
{
RtlAddFunctionTable(
@@ -631,6 +633,7 @@ static void win64_add_function_table(TCCState *s1)
);
}
#endif
+#endif
/* return the PC at frame level 'level'. Return non zero if not found */
static int rt_get_caller_pc(uplong *paddr, CONTEXT *uc, int level)