1 /* ------------------------------------------------------------- */
2 /* for linking rt_printline and the signal/exception handler
3 from tccrun.c into executables. */
5 #define CONFIG_TCC_BACKTRACE_ONLY
8 int (*__rt_error
)(void*, void*, const char *, va_list);
11 # define __declspec(n)
15 void __bt_init(rt_context
*p
, int num_callers
)
17 __attribute__((weak
)) int main();
18 __attribute__((weak
)) void __bound_init(void*);
19 struct rt_context
*rc
= &g_rtctxt
;
20 //fprintf(stderr, "__bt_init %d %p %p\n", num_callers, p->stab_sym, p->bounds_start), fflush(stderr);
22 memcpy(rc
, p
, offsetof(rt_context
, next
));
23 rc
->num_callers
= num_callers
- 1;
25 __rt_error
= _rt_error
;
26 set_exception_handler();
28 p
->next
= rc
->next
, rc
->next
= p
;
30 if (__bound_init
&& p
->bounds_start
)
31 __bound_init(p
->bounds_start
);
34 /* copy a string and truncate it. */
35 static char *pstrcpy(char *buf
, size_t buf_size
, const char *s
)