aboutsummaryrefslogtreecommitdiff
path: root/tccrun.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccrun.c')
-rw-r--r--tccrun.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/tccrun.c b/tccrun.c
index 2fcecd9..6d31e2f 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -23,20 +23,28 @@
/* only native compiler supports -run */
#ifdef TCC_IS_NATIVE
+#ifndef _WIN32
+# include <sys/mman.h>
+#endif
+
#ifdef CONFIG_TCC_BACKTRACE
+# ifndef _WIN32
+# include <signal.h>
+# ifndef __OpenBSD__
+# include <sys/ucontext.h>
+# endif
+# else
+# define ucontext_t CONTEXT
+# endif
ST_DATA int rt_num_callers = 6;
ST_DATA const char **rt_bound_error_msg;
ST_DATA void *rt_prog_main;
-#endif
-
-#ifdef _WIN32
-#define ucontext_t CONTEXT
+static int rt_get_caller_pc(addr_t *paddr, ucontext_t *uc, int level);
+static void rt_error(ucontext_t *uc, const char *fmt, ...);
+static void set_exception_handler(void);
#endif
static void set_pages_executable(void *ptr, unsigned long length);
-static void set_exception_handler(void);
-static int rt_get_caller_pc(addr_t *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