|
|
@ -7,6 +7,8 @@ |
|
|
|
#include "../tccrun.c" |
|
|
|
|
|
|
|
int (*__rt_error)(void*, void*, const char *, va_list); |
|
|
|
__attribute__((weak)) void __bound_checking_lock(void); |
|
|
|
__attribute__((weak)) void __bound_checking_unlock(void); |
|
|
|
|
|
|
|
#ifndef _WIN32 |
|
|
|
# define __declspec(n) |
|
|
@ -21,8 +23,10 @@ void __bt_init(rt_context *p, int num_callers) |
|
|
|
//fprintf(stderr, "__bt_init %d %p %p\n", num_callers, p->stab_sym, p->bounds_start), fflush(stderr);
|
|
|
|
/* call __bound_init here due to redirection of sigaction */ |
|
|
|
/* needed to add global symbols */ |
|
|
|
if (__bound_init && p->bounds_start) |
|
|
|
if (p->bounds_start) { |
|
|
|
__bound_init(p->bounds_start, -1); |
|
|
|
__bound_checking_lock(); |
|
|
|
} |
|
|
|
if (num_callers) { |
|
|
|
memcpy(rc, p, offsetof(rt_context, next)); |
|
|
|
rc->num_callers = num_callers - 1; |
|
|
@ -32,6 +36,8 @@ void __bt_init(rt_context *p, int num_callers) |
|
|
|
} else { |
|
|
|
p->next = rc->next, rc->next = p; |
|
|
|
} |
|
|
|
if (p->bounds_start) |
|
|
|
__bound_checking_unlock(); |
|
|
|
} |
|
|
|
|
|
|
|
__declspec(dllexport) |
|
|
@ -40,8 +46,10 @@ void __bt_exit(rt_context *p) |
|
|
|
__attribute__((weak)) void __bound_exit_dll(void*); |
|
|
|
struct rt_context *rc = &g_rtctxt; |
|
|
|
|
|
|
|
if (__bound_exit_dll && p->bounds_start) |
|
|
|
if (p->bounds_start) { |
|
|
|
__bound_exit_dll(p->bounds_start); |
|
|
|
__bound_checking_lock(); |
|
|
|
} |
|
|
|
while (rc) { |
|
|
|
if (rc->next == p) { |
|
|
|
rc->next = rc->next->next; |
|
|
@ -49,6 +57,8 @@ void __bt_exit(rt_context *p) |
|
|
|
} |
|
|
|
rc = rc->next; |
|
|
|
} |
|
|
|
if (p->bounds_start) |
|
|
|
__bound_checking_unlock(); |
|
|
|
} |
|
|
|
|
|
|
|
/* copy a string and truncate it. */ |
|
|
|